Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def seTv(show):
- pat = '/home/ryan/python/tv/'
- pat = pat + show
- epList = os.listdir(pat)
- fileP = "/home/ryan/python/tvtext/episodes.txt"
- f = open(fileP, "w")
- print epList
- hdrs = ['Title', 'Plot', 'imdbRating', 'Season', 'Episode', 'seriesID']
- def searchTvSe(ep):
- ep = str(ep)
- print ep
- seq = ep.split(";")
- print seq
- tit = seq[0]
- seq[0] = seq[0].replace(" ", "+")
- url = "http://www.omdbapi.com/?t=%s&Season=%s&Episode=%s&plot=full&r=json" % (seq[0], seq[1], seq[2])
- respo = u.urlopen(url)
- respo = json.loads(str(respo.read()))
- if not os.path.exists("/var/www/html/images/"+tit):
- os.makedirs("/var/www/html/images/"+tit)
- imgNa = "/var/www/html/images/" + tit + "/" + respo["Title"] + ".jpg";
- for each in hdrs:
- #print respo[each] # ==== This checks to see if it is working, it is =====
- f.write(respo[each] + "t")
- urllib.urlretrieve(respo["Poster"], imgNa)
- for co, tt in enumerate(epList):
- f.write("N t" + str(co) + "t")
- searchTvSe(tt)
- f.write("n")
- f.close()
- fullTv()
- f = open(fileP, "w")
- f = open(fileP, "a")
- with open('file.txt', 'a') as myfile:
- myfile.write("Hello world!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement