Advertisement
Guest User

xxhds

a guest
Nov 24th, 2008
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. import urllib
  2. import xml.dom.minidom
  3. import re
  4. import time
  5. import os
  6.  
  7. #Put your own movie directory here
  8. movie_dir="/var/raid/MOVIES"
  9.  
  10. ##########
  11. # MOVIES #
  12. ##########
  13. def isInQueue(download_title):
  14. #put your address for the api stuff here
  15. queue=xml.dom.minidom.parse(urllib.urlopen("http://192.168.7.144:7777/sabnzbd/api?mode=qstatus&output=xml"))
  16. for job in queue.getElementsByTagName("job"):
  17. filename=job.getElementsByTagName("filename")[0].childNodes[0].data
  18. if filename == download_title:
  19. return 1
  20. return 0
  21.  
  22. def isMissing(check_movie_title):
  23. if os.path.exists(movie_dir + "/" + check_movie_title + ".avi") or os.path.exists(movie_dir + "/" + check_movie_title):
  24. return 0
  25. else:
  26. return 1
  27.  
  28. def isGoodMovie(imdb_html):
  29. #This is set up to only get movies above an 8.0, with over 1000 votes
  30. if re.compile("<b>[6-9]\.[0-9]/10</b>").search(imdb_html) and re.compile(">[0-9]*,[0-9][0-9][0-9] votes<").search(imdb_html):
  31. return 1
  32. else:
  33. return 0
  34.  
  35. def download(report_id):
  36. print time.strftime("%Y-%m-%d %H:%M:%S")+"\x1b[32;01m"+" Downloading: "+"\x1b[0m"+ movie_title
  37. #put your address for the api stuff here
  38. #urllib.urlretrieve(msgid,"/var/bigraid/put_nzbs_here/"+movie_title+".nzb")
  39. urllib.urlopen("http://192.168.7.144:7777/sabnzbd/api?mode=addurl&name="+msgid+"&cat=movies")
  40.  
  41.  
  42. #Put your own rss feed for movies here
  43. dom=xml.dom.minidom.parse(urllib.urlopen("http://www.nzbs.org/rss.php?catid=2&i=XXXXX&h=XXXXXXXXXXXXXXXXXXX&dl=1"))
  44.  
  45. for node in dom.getElementsByTagName("item"):
  46.  
  47. report_title=node.getElementsByTagName("title")[0].childNodes[0].data
  48. movie_title = re.sub("\;","\:",report_title)
  49. movie_title = re.sub("\s","\:",movie_title)
  50. #print("MOVIE: "+movie_title)
  51.  
  52. report_description=node.getElementsByTagName("description")[0].childNodes[0].data
  53. movie_desc = re.search("IMDB:.+\/\"\>", report_description)
  54.  
  55. if movie_desc:
  56. movie_link = re.search("http.+\/",movie_desc.group())
  57. imdb_link=movie_link.group()
  58. #print(imdb_link)
  59. sock = urllib.urlopen(imdb_link)
  60. htmlSource = sock.read()
  61. sock.close()
  62.  
  63. if (isGoodMovie(htmlSource) == 1) and (isMissing(movie_title) == 1) and (isInQueue(report_title) == 0):
  64. msgid=node.getElementsByTagName("link")[0].childNodes[0].data
  65. msgid = urllib.quote(msgid)
  66. download(msgid)
  67. else:
  68. print time.strftime("%Y-%m-%d %H:%M:%S")+"\x1b[31;01m"+" SKIPPING: "+"\x1b[0m"+ movie_title
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement