Tuesday, March 22, 2011

Ideas for a script for batch downloading of MP3s from freemusicarchive.org

As you can see from this video, it's still a pretty manual process:

But there should be a way to automate it.

Here's the process that I imagine the script would follow.  Items in red I haven't worked out how to do yet in Python.  I believe Python is the best language to do it in (plus I *really* want to do it in Python), but BASH is what I've really used to date so that's more-or-less what I think in.

#!/usr/bin/python
#freemusicfetcher.py
#Released under a GPLv3 Licence by Clockwork PC

#Ask the user what genre and sorting is desired:

input("Which genre?")

#Provide a list of options: Blues, Electronic, Hip-Hop, Classical, etc.

input("Which sorting method?")

# Provide a list of options: Most Interesting or Date Added

#Generate the query URL, e.g. for Most Interesting Blues, http://freemusicarchive.org/genre/Blues/?sort=track_interest

# mkdir ~/Music/freemusicarchive/[Selected Genre]

# cd ~/Music/freemusicarchive/[Selected Genre]
# wget http://freemusicarchive.org/genre/Blues/?sort=track_interest [for example]

# Generate a BASH script in ~/Documents/bin/ called musicfetcher.sh and make it executable

# Use something like grep to find all of "http://freemusicarchive.org/music/download/*" but nothing else, not even the quotation marks in the text

# Copy all the http://freemusicarchive.org/music/download/* and paste them into musicfetcher.sh

# In musicfetcher.sh replace ALL "http" with "gnome-terminal -x http"

# cp ~/Documents/bin/musicfetcher.sh ~/Music/freemusicarchive/musicfetcher.sh
# chmod +x ~/Music/freemusicarchive/musicfetcher.sh [if necessary]
# /bin/bash ~/Music/freemusicarchive/freemusicarchive-fetcher_.sh

-- Alex

Picture

No comments:

Post a Comment