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:

  1. The $deleteFilter is deprecated because none of the mp3 files are actually harmed when "deleted"
  2. 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)
  3. Most importantly, you don't need the --ignore-length switch on wget anymore
  4. 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 an rm <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 | TrackBack

This 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.

You can receive updates whenever a new post is written by subscribing to the recent posts RSS feed or

Post a comment

Remember personal info?

Note: I'm running the MT-Keystrokes plugin to filter out spam comments, which unfortunately means you have to have Javascript turned on to be able to comment.