Back to post index

Using git to track unlistened to podcasts
Tags: [git] [git-annex] [podcasts]
Published: 20 Nov 2017 21:10

I use git annex as a podcatcher, and only recently thought of the following idea: have a separate git branch called ‘unlistened’ and git rm symlinks to podcasts that I’ve listened to.

I run git annex importfeed nightly in a cron job to grab new podcasts. Periodically I run git annex sync on my workstation, and then I can see when podcasts that I’m listening to have new episodes. Previously I would simply see which symlinks were not “dead” (i.e. not pointing to an annex object), and this would indicate both where I was in the list of episodes, and which new episode’s annex objects I had to copy over.

ls --color is helpful here:

But this doesn’t work if I have moved the annex objects off my workstation to make room for others - all symlinks would be red, and I wouldn’t know where I left off. Previously I solved this with a text file called “last” where I recorded the last listened to podcast in each feed’s directory.

Using an ‘unlistened’ branch obviates both of these methods - now, when I listen to a podcast, I can move the annex objects to the origin and git rm the symlink. When I git annex sync on the master branch, it will pull in new episodes, and I can then rebase the unlistened branch on top of master and copy over annex objects that are new.

Something neat you can do: you can “ask” how many podcasts you have listened to so far with git:

jwm@magnus:~/library/podcasts [unlistened] [] $ git diff master --name-only | wc -l
2230

Which may be a surprise to you (although not really, if you consider that you listen for roughly an hour a day…).