Return to Snippet

Revision: 8782
at October 7, 2008 14:46 by hemanthhm


Initial Code
#!/usr/bin/env python
#
#       best.py
#       
#       Copyright 2008 hemanth <[email protected]>
#       
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.




import commands
import os
import pickle
 
def readDir():
		directory = raw_input('In which folder would you like to save the songs??\n')
		if(os.path.exists(directory)):
				print 'Error!! Please give an other name '
				directory = raw_input('In which folder would you like to save the songs??\n')
				os.mkdir(directory)
				os.chdir(directory)
		else:
			os.mkdir(directory)
			os.chdir(directory)
		

readDir()
url = raw_input('Which url are you aiming at ?\n')
tmp = open('tempo.txt','w');
tmp.writelines(url)
tmp.close()
tmp = open('tempo.txt','r');
link = tmp.read()
os.system(" curl " + link +"| egrep -o 'http:.*All\.ram'  > final.txt  ")



infile =open('final.txt', 'r')
outfile = open('tmp.txt', 'w')

	

for line in infile:
	
	outfile = open('tmp.txt', 'w')
	key = line
	list = key.split("/")
	dir = list[6]
	outfile.writelines(key)
	outfile.close()
	open('tmp.txt','r')
	os.system("cat tmp.txt | xargs -n1 -i curl {} > links")
	os.system("wget -P %s -i links" %dir)

infile.close()
outfile.close()
os.remove(outfile.name)
os.remove('links')
os.remove(tmp.name)

Initial URL


Initial Description


Initial Title
Download all *.rm files from a site link or and xml link having ram files

Initial Tags
python, download

Initial Language
Python