podget
podget copied to clipboard
Saving files with number sequence representing order in xml?
I have a problematic podcast - the person who makes it has his own system of naming files, which is not alphanumeric. Nor can you rely on the file date. Or anything about the id3. And therefore he hand-crafts his rss files. Yeah, I know. Go figure. I asked, and he won't change. Meaning that the files, once downloaded, are completely unsortable. I see there are many filename fixes - I was just wondering if it would be tricky to rename files based on the sequence they downloaded?
ie, if the first file in the xml was called "randomname,mp3", and the second was "gofigure,mp3", that they would actually download as 1.mp3, 2.mp3 etc? Even more annoyingly, files are removed when they expire, which is based on nothing publically available. So it's not like I can expire after 7 days.
So I'd be doing a "--force" for each check anyway, and downloading all files freshly.
Yes, I know everything is wrong about the above and that a podcast is almost completely the wrong way of him distributing the files, but that's what I'm stuck with. Any ideas?
PS - I've not forgotten the doc pull request. Tomorrow!
This reminds me of a problem I had with an earlier feed. Every item from it's feed wanted to download with the same common name. Obviously this will not work. What we did at the time was add an option to the Serverlist file called OPT_FILENAME_RENAME_MDATE that would add a prefix to each filename that reflected the date it was downloaded. However if you are doing a '--force' then that probably won't work for you....
Renaming the files numerically would require a few hacks. It's probably possible but not something I can recall looking into. It would probably have to be a feed dependent feature similar to OPT_FILENAME_RENAME_MDATE.
If you'd care to share the feed URL, I can take a look at it to see if there's anything we can do.
Thanks as always! http://www.infosound.org.uk/infosound.xml
Hi @dvehrs - well, I needed a quick fix. Turned out to be not-so-quick, and requires 5 external libraries, but I got there in the end! I'm a js/node newbie, so this code is probably horrible, but might explain what I'm trying to do. Necessarily, the entire podcast is re-downloaded on every single change. Here you go - enjoy(?!) https://gist.github.com/lardconcepts/0b6ffc18d89a5a4c5952e855822cf0d3
Ultimately, though, if it's reasonably easy, it would be great to have this "baked in" to podget as another option 😃