I've worked out how it would work, but I need to learn how to get Python to find the substrings in question.
Any advice would be appreciated:#!/usr/bin/python
#findurl.py
#Released under a GPLv3 Licence by Clockwork PC import os
H = os.getenv("HOME")#Get the lines in the file that contain the URL substrings
for line in open("/home/clockworkpcasus/Music/freemusicarchive.org/index.html"):
if "http://freemusicarchive.org/music/download" in line:
print line
#Create a BASH script in ~/Documents/bin
os.system("cpcbash.sh") #Move the newly created script into ~/Music/freemusicarchive.org
os.system("cd ~/Documents/bin && mv `ls -alt | grep sh | head -n 1 | awk '{print $8}'` ~/Music/freemusicarchive.org/musicfetcher.sh") #Make musicfetcher.sh executable
os.system("chmod +x ~/Music/freemusicarchive.org/musicfetcher.sh")#Copy the URL substrings into ~/Music/freemusicarchive.org/musicfetcher.sh #Turn each URL substring into the following: gnome-terminal -x wget http://freemusicarchive.org/Download/Music... etc.#Save ~/Music/freemusicarchive.org/musicfetcher.sh #Execute the script
os.system("/bin/bash ~/Music/freemusicarchive.org/musicfetcher.sh"
Any advice would be appreciated:#!/usr/bin/python
#findurl.py
#Released under a GPLv3 Licence by Clockwork PC import os
H = os.getenv("HOME")#Get the lines in the file that contain the URL substrings
for line in open("/home/clockworkpcasus/Music/freemusicarchive.org/index.html"):
if "http://freemusicarchive.org/music/download" in line:
print line
#Create a BASH script in ~/Documents/bin
os.system("cpcbash.sh") #Move the newly created script into ~/Music/freemusicarchive.org
os.system("cd ~/Documents/bin && mv `ls -alt | grep sh | head -n 1 | awk '{print $8}'` ~/Music/freemusicarchive.org/musicfetcher.sh") #Make musicfetcher.sh executable
os.system("chmod +x ~/Music/freemusicarchive.org/musicfetcher.sh")#Copy the URL substrings into ~/Music/freemusicarchive.org/musicfetcher.sh #Turn each URL substring into the following: gnome-terminal -x wget http://freemusicarchive.org/Download/Music... etc.#Save ~/Music/freemusicarchive.org/musicfetcher.sh #Execute the script
os.system("/bin/bash ~/Music/freemusicarchive.org/musicfetcher.sh"
No comments:
Post a Comment