Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib
- import xml.dom.minidom
- import re
- import time
- import os
- #Put your own movie directory here
- movie_dir="/var/raid/MOVIES"
- ##########
- # MOVIES #
- ##########
- def isInQueue(download_title):
- #put your address for the api stuff here
- queue=xml.dom.minidom.parse(urllib.urlopen("http://192.168.7.144:7777/sabnzbd/api?mode=qstatus&output=xml"))
- for job in queue.getElementsByTagName("job"):
- filename=job.getElementsByTagName("filename")[0].childNodes[0].data
- if filename == download_title:
- return 1
- return 0
- def isMissing(check_movie_title):
- if os.path.exists(movie_dir + "/" + check_movie_title + ".avi") or os.path.exists(movie_dir + "/" + check_movie_title):
- return 0
- else:
- return 1
- def isGoodMovie(imdb_html):
- #This is set up to only get movies above an 8.0, with over 1000 votes
- 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):
- return 1
- else:
- return 0
- def download(report_id):
- print time.strftime("%Y-%m-%d %H:%M:%S")+"\x1b[32;01m"+" Downloading: "+"\x1b[0m"+ movie_title
- #put your address for the api stuff here
- #urllib.urlretrieve(msgid,"/var/bigraid/put_nzbs_here/"+movie_title+".nzb")
- urllib.urlopen("http://192.168.7.144:7777/sabnzbd/api?mode=addurl&name="+msgid+"&cat=movies")
- #Put your own rss feed for movies here
- dom=xml.dom.minidom.parse(urllib.urlopen("http://www.nzbs.org/rss.php?catid=2&i=XXXXX&h=XXXXXXXXXXXXXXXXXXX&dl=1"))
- for node in dom.getElementsByTagName("item"):
- report_title=node.getElementsByTagName("title")[0].childNodes[0].data
- movie_title = re.sub("\;","\:",report_title)
- movie_title = re.sub("\s","\:",movie_title)
- #print("MOVIE: "+movie_title)
- report_description=node.getElementsByTagName("description")[0].childNodes[0].data
- movie_desc = re.search("IMDB:.+\/\"\>", report_description)
- if movie_desc:
- movie_link = re.search("http.+\/",movie_desc.group())
- imdb_link=movie_link.group()
- #print(imdb_link)
- sock = urllib.urlopen(imdb_link)
- htmlSource = sock.read()
- sock.close()
- if (isGoodMovie(htmlSource) == 1) and (isMissing(movie_title) == 1) and (isInQueue(report_title) == 0):
- msgid=node.getElementsByTagName("link")[0].childNodes[0].data
- msgid = urllib.quote(msgid)
- download(msgid)
- else:
- 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