def Initialize(): global ROOTPATH, FALLBACKTOENG, SUBENG, LOGFILE, SUBNL, LOGLEVEL, SKIPHIDDENDIRS, \ SUBNL, LOGLEVEL, LOGLEVELCONSOLE, LOGSIZE, LOGNUM, SKIPSHOW, SKIPSHOWUPPER, \ USERNAMEMAPPING, USERNAMEMAPPINGUPPER, NAMEMAPPING, NAMEMAPPINGUPPER, \ SHOWID_CACHE, POSTPROCESSCMD, CONFIGFILE, WORKDIR, NOTIFYEN, NOTIFYNL, \ MAILSRV, MAILFROMADDR, MAILTOADDR, MAILUSERNAME, CONFIGVERSION, CONFIGUPGRADED, \ MAILPASSWORD, MAILSUBJECT, MAILENCRYPTION, \ GROWLHOST, GROWLPORT, GROWLPASS, \ TWITTERKEY, TWITTERSECRET, NMAAPI, NOTIFYMAIL, NOTIFYGROWL, NOTIFYTWITTER, NOTIFYNMA, \ WANTEDQUEUE, \ NLRSSURL, ENRSSURL, APIKEY, API, APIRSS, TIMEOUT, APICALLS, \ APICALLSLASTRESET, APICALLSRESETINT, APICALLSMAX, \ SCHEDULERSCANDISK, SCHEDULERCHECKSUB, SCHEDULERCHECKRSS, SCHEDULERDOWNLOADSUBS, \ DAEMON, NOTIFYPROWL, PROWLAPI, PROWLPRIORITY, PUSHALOTAPI, NOTIFYPUSHALOT, \ DBFILE, MOBILEUSERAGENTS, MOBILEAUTOSUB, \ USERAGENT, VERSIONURL DBFILE = 'database.db' release = autosubversion.split(' ')[0] versionnumber = autosubversion.split(' ')[1] VERSIONURL = 'http://auto-sub.googlecode.com/hg/autosub/version.py' USERAGENT = 'AutoSub/' + versionnumber + release.lower()[0] WANTEDQUEUE = [] NLRSSURL = "http://feeds.bierdopje.com/bierdopje/subs/dutch" ENRSSURL = "http://feeds.bierdopje.com/bierdopje/subs/english" APIKEY = "BB442E7744E9B541" TIMEOUT = 300 #default http timeout if CONFIGFILE == None: CONFIGFILE = "config.properties" Config.ReadConfig(CONFIGFILE) if CONFIGUPGRADED: print "AutoSub: Config seems to be upgraded. Writing config" Config.WriteConfig() print "AutoSub: Writing config done" API = "http://api.bierdopje.com/%s/" % APIKEY APIRSS = "/apikey/%s/" % APIKEY MOBILEUSERAGENTS = [ "midp", "240x320", "blackberry", "netfront", "nokia", "panasonic", "portalmmm", "sharp", "sie-", "sonyericsson", "symbian", "windows ce", "benq", "mda", "mot-", "opera mini", "philips", "pocket pc", "sagem", "samsung", "sda", "sgh-", "vodafone", "xda", "palm", "iphone", "ipod", "ipad", "android", "windows phone" ] MOBILEAUTOSUB = True APICALLSLASTRESET = time.time() APICALLSRESETINT = 86400 APICALLSMAX = 300 APICALLS = APICALLSMAX
def Initialize(): global ROOTPATH, FALLBACKTOENG, SUBENG, LOGFILE, SUBNL, LOGLEVEL, SKIPHIDDENDIRS, \ SUBNL, LOGLEVEL, LOGLEVELCONSOLE, LOGSIZE, LOGNUM, SKIPSHOW, SKIPSHOWUPPER, \ USERNAMEMAPPING, USERNAMEMAPPINGUPPER, NAMEMAPPING, NAMEMAPPINGUPPER, \ SHOWID_CACHE, POSTPROCESSCMD, CONFIGFILE, WORKDIR, NOTIFYEN, NOTIFYNL, \ MAILSRV, MAILFROMADDR, MAILTOADDR, MAILUSERNAME, CONFIGVERSION, CONFIGUPGRADED, \ MAILPASSWORD, MAILSUBJECT, MAILENCRYPTION, \ GROWLHOST, GROWLPORT, GROWLPASS, \ TWITTERKEY, TWITTERSECRET, NMAAPI, NOTIFYMAIL, NOTIFYGROWL, NOTIFYTWITTER, NOTIFYNMA, \ WANTEDQUEUE, \ NLRSSURL, ENRSSURL, APIKEY, API, APIRSS, TIMEOUT, APICALLS, \ APICALLSLASTRESET, APICALLSRESETINT, APICALLSMAX, \ SCHEDULERSCANDISK, SCHEDULERCHECKSUB, SCHEDULERCHECKRSS, SCHEDULERDOWNLOADSUBS, \ DAEMON, NOTIFYPROWL, PROWLAPI, PROWLPRIORITY, PUSHALOTAPI, NOTIFYPUSHALOT, \ DBFILE, MOBILEUSERAGENTS, MOBILEAUTOSUB, \ USERAGENT, VERSIONURL DBFILE = 'database.db' release = autosubversion.split(' ')[0] versionnumber = autosubversion.split(' ')[1] VERSIONURL = 'http://auto-sub.googlecode.com/hg/autosub/version.py' USERAGENT = 'AutoSub/' + versionnumber + release.lower()[0] WANTEDQUEUE = [] NLRSSURL = "http://feeds.bierdopje.com/bierdopje/subs/dutch" ENRSSURL = "http://feeds.bierdopje.com/bierdopje/subs/english" APIKEY = "BB442E7744E9B541" TIMEOUT = 300 #default http timeout if CONFIGFILE==None: CONFIGFILE = "config.properties" Config.ReadConfig(CONFIGFILE) if CONFIGUPGRADED: print "AutoSub: Config seems to be upgraded. Writing config" Config.WriteConfig() print "AutoSub: Writing config done" API = "http://api.bierdopje.com/%s/" %APIKEY APIRSS = "/apikey/%s/" %APIKEY MOBILEUSERAGENTS = ["midp", "240x320", "blackberry", "netfront", "nokia", "panasonic", "portalmmm", "sharp", "sie-", "sonyericsson", "symbian", "windows ce", "benq", "mda", "mot-", "opera mini", "philips", "pocket pc", "sagem", "samsung", "sda", "sgh-", "vodafone", "xda", "palm", "iphone", "ipod", "ipad", "android", "windows phone"] MOBILEAUTOSUB = True APICALLSLASTRESET = time.time() APICALLSRESETINT = 86400 APICALLSMAX = 300 APICALLS = APICALLSMAX
def CheckVersion(): ''' CheckVersion Return values: 0 Same version 1 New version 2 New (higher) release, same version 3 New lower release, higher version 4 Release lower, version lower ''' # Check this because it's faulty try: req = urllib2.Request(autosub.VERSIONURL) req.add_header("User-agent", autosub.USERAGENT) resp = urllib2.urlopen(req,None,autosub.TIMEOUT) response = resp.read() resp.close() except: log.error("checkVersion: The server returned an error for request %s" % autosub.VERSIONURL) return None try: version_online = response.split("'")[1] except: return None release = version_online.split(' ')[0] versionnumber = version_online.split(' ')[1] running_release = autosubversion.split(' ')[0] running_versionnumber = autosubversion.split(' ')[1] log.info("checkVersion: %s %s vs. %s %s" %(running_release, running_versionnumber, release, versionnumber)) if release == running_release: #Alpha = Alpha if versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 1 else: #0.5.6 = 0.5.6 return 0 elif release > running_release: #Beta > Alpha if versionnumber == running_versionnumber: #0.5.5 = 0.5.5 return 2 elif versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 4 elif release < running_release: #Alpha < Beta if versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 3
def CheckVersion(): ''' CheckVersion Return values: 0 Same version 1 New version 2 New (higher) release, same version 3 New lower release, higher version 4 Release lower, version lower ''' try: req = urllib2.Request(autosub.VERSIONURL) req.add_header("User-agent", autosub.USERAGENT) resp = urllib2.urlopen(req, None, autosub.TIMEOUT) respone = resp.read() resp.close() except: log.error("checkVersion: The server returned an error for request %s" % autosub.VERSIONURL) return None try: match = re.search('(Alpha|Beta|Stable) (\d+)\.(\d+)\.(\d+)', respone) version_online = match.group(0) except: return None release = version_online.split(' ')[0] versionnumber = version.StrictVersion(version_online.split(' ')[1]) running_release = autosubversion.split(' ')[0] running_versionnumber = version.StrictVersion(autosubversion.split(' ')[1]) if release == running_release: #Alpha = Alpha if versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 1 else: #0.5.6 = 0.5.6 return 0 elif release > running_release: #Beta > Alpha if versionnumber == running_versionnumber: #0.5.5 = 0.5.5 return 2 elif versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 4 elif release < running_release: #Alpha < Beta if versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 3
def CheckVersion(): ''' CheckVersion Return values: 0 Same version 1 New version 2 New (higher) release, same version 3 New lower release, higher version 4 Release lower, version lower ''' try: req = urllib2.Request(autosub.VERSIONURL) req.add_header("User-agent", autosub.USERAGENT) resp = urllib2.urlopen(req,None,autosub.TIMEOUT) respone = resp.read() resp.close() except: log.error("checkVersion: The server returned an error for request %s" % autosub.VERSIONURL) return None try: match = re.search('(Alpha|Beta|Stable) (\d+)\.(\d+)\.(\d+)', respone) version_online = match.group(0) except: return None release = version_online.split(' ')[0] versionnumber = version.StrictVersion(version_online.split(' ')[1]) running_release = autosubversion.split(' ')[0] running_versionnumber = version.StrictVersion(autosubversion.split(' ')[1]) if release == running_release: #Alpha = Alpha if versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 1 else: #0.5.6 = 0.5.6 return 0 elif release > running_release: #Beta > Alpha if versionnumber == running_versionnumber: #0.5.5 = 0.5.5 return 2 elif versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 4 elif release < running_release: #Alpha < Beta if versionnumber > running_versionnumber: #0.5.6 > 0.5.5 return 3
def Initialize(): global ROOTPATH, FALLBACKTOENG, DOWNLOADENG, DOWNLOADDUTCH, SUBENG, LOGFILE, SUBNL, LOGLEVEL, SKIPHIDDENDIRS, \ LOGLEVELCONSOLE, LOGSIZE, LOGNUM, SKIPSHOW, SKIPSHOWUPPER, SKIPSTRINGNL,SKIPSTRINGEN, \ USERNAMEMAPPING, USERNAMEMAPPINGUPPER, NAMEMAPPING, NAMEMAPPINGUPPER, USERADDIC7EDMAPPING, USERADDIC7EDMAPPINGUPPER, \ SHOWID_CACHE, POSTPROCESSCMD, CONFIGFILE, WORKDIR, NOTIFYEN, NOTIFYNL, ENGLISHSUBDELETE, \ MAILSRV, MAILFROMADDR, MAILTOADDR, MAILUSERNAME, CONFIGVERSION, CONFIGUPGRADED, HOMELAYOUTFIRST, \ MAILPASSWORD, MAILSUBJECT, MAILENCRYPTION, \ GROWLHOST, GROWLPORT, GROWLPASS, \ TWITTERKEY, TWITTERSECRET, NMAAPI, NOTIFYMAIL, NOTIFYGROWL, NOTIFYTWITTER, NOTIFYNMA, \ WANTEDQUEUE, ADDIC7EDAPI, \ APIKEY, API, IMDBAPI, TIMEOUT, \ APICALLSLASTRESET_TVDB, APICALLSLASTRESET_SUBSEEKER, APICALLSRESETINT_TVDB, APICALLSRESETINT_SUBSEEKER, \ APICALLSMAX_TVDB, APICALLSMAX_SUBSEEKER, APICALLS_TVDB, APICALLS_SUBSEEKER, \ SCHEDULERSCANDISK, SCHEDULERCHECKSUB, SCHEDULERDOWNLOADSUBS, DOWNLOADS_A7, DOWNLOADS_A7MAX, \ DAEMON, NOTIFYPROWL, PROWLAPI, PROWLPRIORITY, PUSHALOTAPI, NOTIFYPUSHALOT, NOTIFYPUSHOVER, PUSHOVERAPI, \ DBFILE, DBCONNECTION, DBIDCACHE, DBEPISODECACHE, MOBILEUSERAGENTS, MOBILEAUTOSUB, NMAPRIORITY, \ USERAGENT, VERSIONURL, TVDBURL, ZIPURL, UPDATECOUNT,\ ENGLISH, DUTCH, PODNAPISILANG, SUBSCENELANG, OPENSUBTITLESLANG, UNDERTEXTERLANG, \ ADDIC7EDLANG, ADDIC7EDUSER, ADDIC7EDPASSWD, NOTIFYBOXCAR2, BOXCAR2TOKEN, \ NOTIFYPLEX, PLEXSERVERHOST, PLEXSERVERPORT, OPENSUBTITLESDL,OPENSUBTITLESTIME,\ OPENSUBTITLESLOGGED_IN, OPENSUBTTITLESSESSION, CURRENTLANG, OPENSUBTITLESUSER, OPENSUBTITLESPASSWD, OPENSUBTITLESURL, OPENSUBTITLESAPI DBFILE = 'database.db' release = autosubversion.split(' ')[0] versionnumber = autosubversion.split(' ')[1] VERSIONURL = 'https://raw.githubusercontent.com/BenjV/autosub/master/autosub/version.py' ZIPURL = 'https://github.com/BenjV/autosub/archive/master.zip' USERAGENT = 'AutoSub/' + versionnumber + release.lower()[0] WANTEDQUEUE = [] APIKEY = "24430affe80bea1edf0e8413c3abf372a64afff2" TIMEOUT = 300 #default http timeout if CONFIGFILE == None: CONFIGFILE = "config.properties" Config.ReadConfig(CONFIGFILE) if CONFIGUPGRADED: print "AutoSub: Config seems to be upgraded. Writing config" Config.WriteConfig() print "AutoSub: Writing config done" API = "http://api.subtitleseeker.com/get/title_subtitles/?api_key=%s" % APIKEY IMDBAPI = "http://thetvdb.com/api/" OPENSUBTITLESURL = "http://www.opensubtitles.org/nl" OPENSUBTITLESDL = 'http://dl.opensubtitles.org/nl/download/file/' MOBILEUSERAGENTS = [ "midp", "240x320", "blackberry", "netfront", "nokia", "panasonic", "portalmmm", "sharp", "sie-", "sonyericsson", "symbian", "windows ce", "benq", "mda", "mot-", "opera mini", "philips", "pocket pc", "sagem", "samsung", "sda", "sgh-", "vodafone", "xda", "palm", "iphone", "ipod", "ipad", "android", "windows phone" ] MOBILEAUTOSUB = True APICALLSLASTRESET_TVDB = time.time() APICALLSLASTRESET_SUBSEEKER = time.time() APICALLSRESETINT_TVDB = 86400 APICALLSRESETINT_SUBSEEKER = 86400 APICALLSMAX_TVDB = 2500 APICALLSMAX_SUBSEEKER = 1000 APICALLS_TVDB = APICALLSMAX_TVDB APICALLS_SUBSEEKER = APICALLSMAX_SUBSEEKER #Set the language paramater for the API query ENGLISH = 'English' DUTCH = 'Dutch' # Default value DOWNLOADS_A7MAX = 40
def Initialize(): global ROOTPATH, FALLBACKTOENG, DOWNLOADENG, DOWNLOADDUTCH, SUBENG, LOGFILE, SUBNL, LOGLEVEL, SKIPHIDDENDIRS, \ LOGLEVELCONSOLE, LOGSIZE, LOGNUM, SKIPSHOW, SKIPSHOWUPPER, SKIPSTRINGNL,SKIPSTRINGEN, \ USERNAMEMAPPING, USERNAMEMAPPINGUPPER, NAMEMAPPING, NAMEMAPPINGUPPER, USERADDIC7EDMAPPING, USERADDIC7EDMAPPINGUPPER, \ SHOWID_CACHE, POSTPROCESSCMD, CONFIGFILE, WORKDIR, NOTIFYEN, NOTIFYNL, ENGLISHSUBDELETE, \ MAILSRV, MAILFROMADDR, MAILTOADDR, MAILUSERNAME, CONFIGVERSION, CONFIGUPGRADED, HOMELAYOUTFIRST, \ MAILPASSWORD, MAILSUBJECT, MAILENCRYPTION, \ GROWLHOST, GROWLPORT, GROWLPASS, \ TWITTERKEY, TWITTERSECRET, NMAAPI, NOTIFYMAIL, NOTIFYGROWL, NOTIFYTWITTER, NOTIFYNMA, \ WANTEDQUEUE, ADDIC7EDAPI, \ APIKEY, API, IMDBAPI, TIMEOUT, \ APICALLSLASTRESET_TVDB, APICALLSLASTRESET_SUBSEEKER, APICALLSRESETINT_TVDB, APICALLSRESETINT_SUBSEEKER, \ APICALLSMAX_TVDB, APICALLSMAX_SUBSEEKER, APICALLS_TVDB, APICALLS_SUBSEEKER, \ SCHEDULERSCANDISK, SCHEDULERCHECKSUB, SCHEDULERDOWNLOADSUBS, DOWNLOADS_A7, DOWNLOADS_A7MAX, \ DAEMON, NOTIFYPROWL, PROWLAPI, PROWLPRIORITY, PUSHALOTAPI, NOTIFYPUSHALOT, NOTIFYPUSHOVER, PUSHOVERAPI, \ DBFILE, DBCONNECTION, DBIDCACHE, DBEPISODECACHE, MOBILEUSERAGENTS, MOBILEAUTOSUB, NMAPRIORITY, \ USERAGENT, VERSIONURL, TVDBURL, ZIPURL, UPDATECOUNT,\ ENGLISH, DUTCH, PODNAPISILANG, SUBSCENELANG, OPENSUBTITLESLANG, UNDERTEXTERLANG, \ ADDIC7EDLANG, ADDIC7EDUSER, ADDIC7EDPASSWD, NOTIFYBOXCAR2, BOXCAR2TOKEN, \ NOTIFYPLEX, PLEXSERVERHOST, PLEXSERVERPORT, OPENSUBTITLESDL,OPENSUBTITLESTIME,\ OPENSUBTITLESLOGGED_IN, OPENSUBTTITLESSESSION, CURRENTLANG, OPENSUBTITLESUSER, OPENSUBTITLESPASSWD, OPENSUBTITLESURL, OPENSUBTITLESAPI DBFILE = 'database.db' release = autosubversion.split(' ')[0] versionnumber = autosubversion.split(' ')[1] VERSIONURL = 'https://raw.githubusercontent.com/BenjV/autosub/master/autosub/version.py' ZIPURL = 'https://github.com/BenjV/autosub/archive/master.zip' USERAGENT = 'AutoSub/' + versionnumber + release.lower()[0] WANTEDQUEUE = [] APIKEY = "24430affe80bea1edf0e8413c3abf372a64afff2" TIMEOUT = 300 #default http timeout if CONFIGFILE==None: CONFIGFILE = "config.properties" Config.ReadConfig(CONFIGFILE) if CONFIGUPGRADED: print "AutoSub: Config seems to be upgraded. Writing config" Config.WriteConfig() print "AutoSub: Writing config done" API = "http://api.subtitleseeker.com/get/title_subtitles/?api_key=%s" %APIKEY IMDBAPI = "http://thetvdb.com/api/" OPENSUBTITLESURL = "http://www.opensubtitles.org/nl" OPENSUBTITLESDL = 'http://dl.opensubtitles.org/nl/download/file/' MOBILEUSERAGENTS = ["midp", "240x320", "blackberry", "netfront", "nokia", "panasonic", "portalmmm", "sharp", "sie-", "sonyericsson", "symbian", "windows ce", "benq", "mda", "mot-", "opera mini", "philips", "pocket pc", "sagem", "samsung", "sda", "sgh-", "vodafone", "xda", "palm", "iphone", "ipod", "ipad", "android", "windows phone"] MOBILEAUTOSUB = True APICALLSLASTRESET_TVDB = time.time() APICALLSLASTRESET_SUBSEEKER = time.time() APICALLSRESETINT_TVDB = 86400 APICALLSRESETINT_SUBSEEKER = 86400 APICALLSMAX_TVDB = 2500 APICALLSMAX_SUBSEEKER = 1000 APICALLS_TVDB = APICALLSMAX_TVDB APICALLS_SUBSEEKER = APICALLSMAX_SUBSEEKER #Set the language paramater for the API query ENGLISH = 'English' DUTCH = 'Dutch' # Default value DOWNLOADS_A7MAX = 40