July 25, 2004
Delete reworked
I've revamped the way that "deleting" songs works on NewMusicRadio. Now the "deleted" songs are just added to a list of files to exclude, and the original files are left as-is.
This means that:
- The
$deleteFilter
is deprecated because none of the mp3 files are actually harmed when "deleted" - I can decide I don't like tracks that came on CDs without ending up with random tracks in my music collection being deleted (even if they aren't tracks I like)
- Most importantly, you don't need the
--ignore-length
switch onwget
anymore - You also don't need the
chmod g+w
because the script doesn't have to overwrite files
I've added a few lines of statistics output to my cron
script because I'm curious as to how many files drop off the list as "too old" each day, and how many new files are added. These are the extra find
and wc
lines.
The final big change is with the line:
find /home/tunes/downloads/ -name \*.mp3 -mtime +42 -exec rm {} \;
This deletes any mp3s older than 42 days in the directory /home/tunes/downloads/ (or any directories below that). In detail:
/home/tunes/downloads/
this is the directory where all my downloaded (mp3 blogs and Soulseek) mp3s live-name \*.mp3
find should only look for files called <something>.mp3-mtime +42
only look for files older than 42 days. The + is important, -42 means look for files younger than 42 days-exec rm {} \;
for each file found, perform anrm <filename>;
to delete it
There's still more to play with to link the mp3s downloaded from mp3 blogs to their source, but I think the bare bones of it are now working correctly.
Posted by Adrian at July 25, 2004 09:24 PM | TrackBackThis blog post is on the personal blog of Adrian McEwen. If you want to explore the site a bit further, it might be worth having a look at the most recent entries or look through the archives or categories over on the left.
If you want to hire my company to help you with the Internet of Things then get in touch. If you want to learn more about the Internet of Things, then buy my book Designing the Internet of Things (amazon.co.uk amazon.com).