Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. def seTv(show):
  2. pat = '/home/ryan/python/tv/'
  3. pat = pat + show
  4. epList = os.listdir(pat)
  5. fileP = "/home/ryan/python/tvtext/episodes.txt"
  6. f = open(fileP, "w")
  7. print epList
  8. hdrs = ['Title', 'Plot', 'imdbRating', 'Season', 'Episode', 'seriesID']
  9. def searchTvSe(ep):
  10. ep = str(ep)
  11. print ep
  12. seq = ep.split(";")
  13. print seq
  14. tit = seq[0]
  15. seq[0] = seq[0].replace(" ", "+")
  16. url = "http://www.omdbapi.com/?t=%s&Season=%s&Episode=%s&plot=full&r=json" % (seq[0], seq[1], seq[2])
  17. respo = u.urlopen(url)
  18. respo = json.loads(str(respo.read()))
  19. if not os.path.exists("/var/www/html/images/"+tit):
  20. os.makedirs("/var/www/html/images/"+tit)
  21. imgNa = "/var/www/html/images/" + tit + "/" + respo["Title"] + ".jpg";
  22. for each in hdrs:
  23. #print respo[each] # ==== This checks to see if it is working, it is =====
  24. f.write(respo[each] + "t")
  25. urllib.urlretrieve(respo["Poster"], imgNa)
  26.  
  27. for co, tt in enumerate(epList):
  28. f.write("N t" + str(co) + "t")
  29. searchTvSe(tt)
  30. f.write("n")
  31. f.close()
  32.  
  33. fullTv()
  34.  
  35. f = open(fileP, "w")
  36.  
  37. f = open(fileP, "a")
  38.  
  39. with open('file.txt', 'a') as myfile:
  40. myfile.write("Hello world!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement