You can use git-annex as a podcatcher, to download podcast contents. No additional software is required, but your git-annex must be built with the Feeds feature (run git annex version to check).

All you need to do is put something like this in a cron job:

cd somerepo && git annex importfeed http://url/to/podcast http://other/podcast/url

This downloads the urls, and parses them as RSS, Atom, or RDF feeds. All enclosures are downloaded and added to the repository, the same as if you had manually run git annex addurl on each of them.

git-annex will avoid downloading a file from a feed if its url has already been stored in the repository before. So once a file is downloaded, you can move it around, delete it, git annex drop its content, etc, and it will not be downloaded again by repeated runs of git annex importfeed. Just how a podcatcher should behave.

templates

To control the filenames used for items downloaded from a feed, there's a --template option. The default is --template='${feedtitle}/${itemtitle}${extension}'

Other available template variables:
feedauthor, itemauthor, itemsummary, itemdescription, itemrights, itemid

catching up

To catch up on a feed without downloading its contents, use git annex importfeed --relaxed, and delete the symlinks it creates. Next time you run git annex addurl it will only fetch any new items.

fast mode

To add a feed without downloading its contents right now, use git annex importfeed --fast. Then you can use git annex get as usual to download the content of an item.

storing the podcast list in git

You can check the list of podcast urls into git right next to the files it downloads. Just make a file named feeds and add one podcast url per line.

Then you can run git-annex on all the feeds:

xargs git-annex importfeed < feeds

distributed podcatching

A nice benefit of using git-annex as a podcatcher is that you can run git annex importfeed on the same url in different clones of a repository, and git annex sync will sync it all up.

centralized podcatching

You can also have a designated machine which always fetches all podcstas to local disk and stores them. That way, you can archive podcasts with time-delayed deletion of upstream content. You can also work around slow downloads upstream by podcatching to a server with ample bandwidth or work around a slow local Internet connection by podcatching to your home server and transferring to your laptop on demand.

It seems that some of my feeds get stored into keys that generate a too long filename:

podcasts/.git/annex/tmp/b1f_325_URL-s143660317--http&c%%feedproxy.google.com%~r%mixotic%~5%urTIRWQK2OQ%Mixotic__258__-__Michael__Miller__-__Galactic__Technolgies.mp3.log.web:
openBinaryFile: invalid argument (File name too long)

Is there a way to work around this?

Comment by ckeen Tue Jul 30 14:39:44 2013
@ckeen You seem to be using a filesystem that does not support filenames 150 characters long. This is unusual -- even windows and android can support a filename up to 255 characters in length. git-annex addurl already deals with this sort of problem by limiting the filename to 255 characters. If you'd like to file a bug report with details about your system, I can try to make git-annex support its limitations, I suppose.
Comment by http://joeyh.name/ Tue Jul 30 17:16:07 2013

Looking forward to seeing it in Debian unstable; where it will definitely replace my hpodder setup.

I guess there is no easy way to re-use the files already downloaded with hpodder? At first I thought that git annex importfeed --relaxed followed by adding the files to the git annex would work, but importfeed stores URLs, not content-based hashes, so it wouldn’t match up.

Comment by http://www.joachim-breitner.de/ Tue Jul 30 21:21:57 2013

@nomeata, well, you can, but it has to download the files again.

When run without --fast, importfeed does use content based hashes, so if you run it in a temporary directory, it will download the content redundantly, hash it and see it's the same, and add the url to that hash. You can then delete the temporary directory, and the files hpodder had downloaded will have the url attached to them now. I don't know if this really buys you anything over deleting the hpodder files and starting over though.

Comment by http://joeyh.name/ Tue Jul 30 21:29:50 2013
Currently I have my podcasts imported with --fast. For some reason there are podcast episodes missing. This has been done propably during my period of toying with the feature. If I retry on a clean annex I see all episodes. My suspicion is that git-annex has been interrupted during downloading a feed but now somehow thinks it's already there. How can I debug this situation and/or force git annex to retry all the links in a feed?
Comment by ckeen Wed Jul 31 10:35:50 2013

The only way it can skip downloading a file is if its url has already been seen before. Perhaps you deleted them?

I've made importfeed --force re-download files it's seen before.

Comment by http://joeyh.name/ Wed Jul 31 16:20:39 2013
Is it intentionally saving URLs with a prefixed 2_? I have sorted out all missing URLs and renamed it, so no harm done, but it has been a bit of a hassle to get there.
Comment by ckeen Thu Aug 1 09:47:34 2013
I've now made importfeed --force a bit smarter about reusing existing files.
Comment by http://joeyh.name/ Thu Aug 1 16:05:10 2013
Comments on this page are closed.