mirror of https://github.com/evilhero/mylar
Whitespace cleanup
This commit is contained in:
parent
d21cc0d80e
commit
9a4a6b4bc5
3
Mylar.py
3
Mylar.py
|
@ -32,9 +32,11 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import lib.argparse as argparse
|
import lib.argparse as argparse
|
||||||
|
|
||||||
|
|
||||||
def handler_sigterm(signum, frame):
|
def handler_sigterm(signum, frame):
|
||||||
mylar.SIGNAL = 'shutdown'
|
mylar.SIGNAL = 'shutdown'
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
# Fixed paths to mylar
|
# Fixed paths to mylar
|
||||||
|
@ -112,7 +114,6 @@ def main():
|
||||||
else:
|
else:
|
||||||
logger.warn("Not running in daemon mode. PID file creation disabled.")
|
logger.warn("Not running in daemon mode. PID file creation disabled.")
|
||||||
|
|
||||||
|
|
||||||
if args.datadir:
|
if args.datadir:
|
||||||
mylar.DATA_DIR = args.datadir
|
mylar.DATA_DIR = args.datadir
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
from mylar import db
|
from mylar import db
|
||||||
|
|
||||||
|
|
||||||
def getCachedArt(albumid):
|
def getCachedArt(albumid):
|
||||||
|
|
||||||
from mylar import cache
|
from mylar import cache
|
||||||
|
|
|
@ -46,7 +46,6 @@ class Api(object):
|
||||||
self.data = None
|
self.data = None
|
||||||
self.callback = None
|
self.callback = None
|
||||||
|
|
||||||
|
|
||||||
def checkParams(self, *args, **kwargs):
|
def checkParams(self, *args, **kwargs):
|
||||||
|
|
||||||
if not mylar.API_ENABLED:
|
if not mylar.API_ENABLED:
|
||||||
|
|
|
@ -5,6 +5,7 @@ from bs4 import BeautifulSoup
|
||||||
import mylar
|
import mylar
|
||||||
from mylar import logger
|
from mylar import logger
|
||||||
|
|
||||||
|
|
||||||
class info32p(object):
|
class info32p(object):
|
||||||
|
|
||||||
def __init__(self, reauthenticate=False, searchterm=None):
|
def __init__(self, reauthenticate=False, searchterm=None):
|
||||||
|
|
|
@ -21,6 +21,7 @@ import lib.simplejson as simplejson
|
||||||
import mylar
|
import mylar
|
||||||
from mylar import db, helpers, logger
|
from mylar import db, helpers, logger
|
||||||
|
|
||||||
|
|
||||||
class Cache(object):
|
class Cache(object):
|
||||||
"""
|
"""
|
||||||
This class deals with getting, storing and serving up artwork (album
|
This class deals with getting, storing and serving up artwork (album
|
||||||
|
@ -155,7 +156,6 @@ class Cache(object):
|
||||||
self.artwork_url = image_url
|
self.artwork_url = image_url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getArtwork(ComicID=None, imageURL=None):
|
def getArtwork(ComicID=None, imageURL=None):
|
||||||
|
|
||||||
c = Cache()
|
c = Cache()
|
||||||
|
@ -169,4 +169,3 @@ def getArtwork(ComicID=None, imageURL=None):
|
||||||
else:
|
else:
|
||||||
artwork_file = os.path.basename(artwork_path)
|
artwork_file = os.path.basename(artwork_path)
|
||||||
return "cache/artwork/" + artwork_file
|
return "cache/artwork/" + artwork_file
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import mylar
|
||||||
from mylar import logger
|
from mylar import logger
|
||||||
from mylar.helpers import cvapi_check
|
from mylar.helpers import cvapi_check
|
||||||
|
|
||||||
|
|
||||||
def run(dirName, nzbName=None, issueid=None, comversion=None, manual=None, filename=None, module=None):
|
def run(dirName, nzbName=None, issueid=None, comversion=None, manual=None, filename=None, module=None):
|
||||||
if module is None:
|
if module is None:
|
||||||
module = ''
|
module = ''
|
||||||
|
@ -28,7 +29,6 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
## Set the directory in which comictagger and other external commands are located - IMPORTANT - ##
|
## Set the directory in which comictagger and other external commands are located - IMPORTANT - ##
|
||||||
# ( User may have to modify, depending on their setup, but these are some guesses for now )
|
# ( User may have to modify, depending on their setup, but these are some guesses for now )
|
||||||
|
|
||||||
|
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
#if it's a source install.
|
#if it's a source install.
|
||||||
sys_type = 'windows'
|
sys_type = 'windows'
|
||||||
|
@ -57,7 +57,6 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
|
|
||||||
logger.fdebug(module + ' UNRAR path set to : ' + unrar_cmd)
|
logger.fdebug(module + ' UNRAR path set to : ' + unrar_cmd)
|
||||||
|
|
||||||
|
|
||||||
elif platform.system() == "Darwin":
|
elif platform.system() == "Darwin":
|
||||||
#Mac OS X
|
#Mac OS X
|
||||||
sys_type = 'mac'
|
sys_type = 'mac'
|
||||||
|
@ -108,7 +107,6 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
#file_conversion = False
|
#file_conversion = False
|
||||||
#file_extension_fixing = False
|
#file_extension_fixing = False
|
||||||
|
|
||||||
|
|
||||||
## Sets up other directories ##
|
## Sets up other directories ##
|
||||||
scriptname = os.path.basename(sys.argv[0])
|
scriptname = os.path.basename(sys.argv[0])
|
||||||
downloadpath = os.path.abspath(dirName)
|
downloadpath = os.path.abspath(dirName)
|
||||||
|
@ -210,7 +208,6 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
logger.warn(module + ' No zip file present')
|
logger.warn(module + ' No zip file present')
|
||||||
return "fail"
|
return "fail"
|
||||||
|
|
||||||
|
|
||||||
#if the temp directory is the LAST directory in the path, it's part of the CT logic path above
|
#if the temp directory is the LAST directory in the path, it's part of the CT logic path above
|
||||||
#and can be removed to allow a copy back to the original path to work.
|
#and can be removed to allow a copy back to the original path to work.
|
||||||
if 'temp' in os.path.basename(os.path.normpath(comicpath)):
|
if 'temp' in os.path.basename(os.path.normpath(comicpath)):
|
||||||
|
@ -326,6 +323,7 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
|
|
||||||
## check comictagger version - less than 1.15.beta - take your chances.
|
## check comictagger version - less than 1.15.beta - take your chances.
|
||||||
if sys_type == 'windows':
|
if sys_type == 'windows':
|
||||||
|
|
||||||
ctversion = subprocess.check_output([comictagger_cmd, "--version"])
|
ctversion = subprocess.check_output([comictagger_cmd, "--version"])
|
||||||
else:
|
else:
|
||||||
ctversion = subprocess.check_output([sys.executable, comictagger_cmd, "--version"])
|
ctversion = subprocess.check_output([sys.executable, comictagger_cmd, "--version"])
|
||||||
|
@ -385,7 +383,6 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
tagtype = 'cbl' # Cbl meta-tagging cycle
|
tagtype = 'cbl' # Cbl meta-tagging cycle
|
||||||
tagdisp = 'Comicbooklover tagging'
|
tagdisp = 'Comicbooklover tagging'
|
||||||
|
|
||||||
|
|
||||||
f_tagoptions = original_tagoptions
|
f_tagoptions = original_tagoptions
|
||||||
|
|
||||||
if og_tagtype is not None:
|
if og_tagtype is not None:
|
||||||
|
@ -421,7 +418,6 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
logger.warn(module + '[COMIC-TAGGER] Unable to run comictagger with the options provided: ' + str(script_cmd))
|
logger.warn(module + '[COMIC-TAGGER] Unable to run comictagger with the options provided: ' + str(script_cmd))
|
||||||
|
|
||||||
|
|
||||||
#increment CV API counter.
|
#increment CV API counter.
|
||||||
mylar.CVAPI_COUNT += 1
|
mylar.CVAPI_COUNT += 1
|
||||||
|
|
||||||
|
@ -473,4 +469,3 @@ def run (dirName, nzbName=None, issueid=None, comversion=None, manual=None, file
|
||||||
logger.fdebug(module + ' Failed to remove temporary path : ' + str(comicpath))
|
logger.fdebug(module + ' Failed to remove temporary path : ' + str(comicpath))
|
||||||
|
|
||||||
return os.path.join(os.path.abspath(file_dir), file_n) # dirName),file_n)
|
return os.path.join(os.path.abspath(file_dir), file_n) # dirName),file_n)
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ from decimal import Decimal
|
||||||
from HTMLParser import HTMLParseError
|
from HTMLParser import HTMLParseError
|
||||||
from time import strptime
|
from time import strptime
|
||||||
|
|
||||||
|
|
||||||
def cbdb(comicnm, ComicYear):
|
def cbdb(comicnm, ComicYear):
|
||||||
#comicnm = 'Animal Man'
|
#comicnm = 'Animal Man'
|
||||||
#print ( "comicname: " + str(comicnm) )
|
#print ( "comicname: " + str(comicnm) )
|
||||||
|
@ -54,7 +55,6 @@ def cbdb(comicnm, ComicYear):
|
||||||
|
|
||||||
print "CBDB ID: " + resultID
|
print "CBDB ID: " + resultID
|
||||||
|
|
||||||
|
|
||||||
print ("resultname: " + resultName)
|
print ("resultname: " + resultName)
|
||||||
CleanComicName = re.sub('[\,\.\:\;\'\[\]\(\)\!\@\#\$\%\^\&\*\-\_\+\=\?\/]', '', comicnm)
|
CleanComicName = re.sub('[\,\.\:\;\'\[\]\(\)\!\@\#\$\%\^\&\*\-\_\+\=\?\/]', '', comicnm)
|
||||||
CleanComicName = re.sub(' ', '', CleanComicName).lower()
|
CleanComicName = re.sub(' ', '', CleanComicName).lower()
|
||||||
|
|
|
@ -27,6 +27,7 @@ from mylar.helpers import cvapi_check
|
||||||
from bs4 import BeautifulSoup as Soup
|
from bs4 import BeautifulSoup as Soup
|
||||||
import httplib
|
import httplib
|
||||||
|
|
||||||
|
|
||||||
def patch_http_response_read(func):
|
def patch_http_response_read(func):
|
||||||
def inner(*args):
|
def inner(*args):
|
||||||
try:
|
try:
|
||||||
|
@ -41,6 +42,7 @@ if platform.python_version() == '2.7.6':
|
||||||
httplib.HTTPConnection._http_vsn = 10
|
httplib.HTTPConnection._http_vsn = 10
|
||||||
httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0'
|
httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0'
|
||||||
|
|
||||||
|
|
||||||
def pulldetails(comicid, type, issueid=None, offset=1, arclist=None, comicidlist=None):
|
def pulldetails(comicid, type, issueid=None, offset=1, arclist=None, comicidlist=None):
|
||||||
#import easy to use xml parser called minidom:
|
#import easy to use xml parser called minidom:
|
||||||
from xml.dom.minidom import parseString
|
from xml.dom.minidom import parseString
|
||||||
|
@ -492,7 +494,6 @@ def GetSeriesYears(dom):
|
||||||
logger.warn('There was a problem retrieving the start year for a particular series within the story arc.')
|
logger.warn('There was a problem retrieving the start year for a particular series within the story arc.')
|
||||||
tempseries['SeriesYear'] = '0000'
|
tempseries['SeriesYear'] = '0000'
|
||||||
|
|
||||||
|
|
||||||
serieslist.append({"ComicID": tempseries['ComicID'],
|
serieslist.append({"ComicID": tempseries['ComicID'],
|
||||||
"ComicName": tempseries['Series'],
|
"ComicName": tempseries['Series'],
|
||||||
"SeriesYear": tempseries['SeriesYear'],
|
"SeriesYear": tempseries['SeriesYear'],
|
||||||
|
@ -500,6 +501,7 @@ def GetSeriesYears(dom):
|
||||||
|
|
||||||
return serieslist
|
return serieslist
|
||||||
|
|
||||||
|
|
||||||
def drophtml(html):
|
def drophtml(html):
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
soup = BeautifulSoup(html)
|
soup = BeautifulSoup(html)
|
||||||
|
|
|
@ -202,7 +202,8 @@ def torrents(pickfeed=None,seriesname=None,issue=None,feedinfo=None):
|
||||||
link = feedme.entries[i].link
|
link = feedme.entries[i].link
|
||||||
linkst = link.find('&id')
|
linkst = link.find('&id')
|
||||||
linken = link.find('&', linkst +1)
|
linken = link.find('&', linkst +1)
|
||||||
if linken == -1: linken = len(link)
|
if linken == -1:
|
||||||
|
linken = len(link)
|
||||||
newlink = re.sub('&id=', '', link[linkst:linken]).strip()
|
newlink = re.sub('&id=', '', link[linkst:linken]).strip()
|
||||||
feeddata.append({
|
feeddata.append({
|
||||||
'site': picksite,
|
'site': picksite,
|
||||||
|
@ -224,7 +225,6 @@ def torrents(pickfeed=None,seriesname=None,issue=None,feedinfo=None):
|
||||||
totalcount += i
|
totalcount += i
|
||||||
lp += 1
|
lp += 1
|
||||||
|
|
||||||
|
|
||||||
if not seriesname:
|
if not seriesname:
|
||||||
rssdbupdate(feeddata, totalcount, 'torrent')
|
rssdbupdate(feeddata, totalcount, 'torrent')
|
||||||
else:
|
else:
|
||||||
|
@ -361,6 +361,7 @@ def rssdbupdate(feeddata,i,type):
|
||||||
logger.fdebug('Completed adding new data to RSS DB. Next add in ' + str(mylar.RSS_CHECKINTERVAL) + ' minutes')
|
logger.fdebug('Completed adding new data to RSS DB. Next add in ' + str(mylar.RSS_CHECKINTERVAL) + ' minutes')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def torrentdbsearch(seriesname, issue, comicid=None, nzbprov=None):
|
def torrentdbsearch(seriesname, issue, comicid=None, nzbprov=None):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
seriesname_alt = None
|
seriesname_alt = None
|
||||||
|
@ -376,7 +377,6 @@ def torrentdbsearch(seriesname,issue,comicid=None,nzbprov=None):
|
||||||
seriesname = snm['ComicName']
|
seriesname = snm['ComicName']
|
||||||
seriesname_alt = snm['AlternateSearch']
|
seriesname_alt = snm['AlternateSearch']
|
||||||
|
|
||||||
|
|
||||||
#remove 'and' and 'the':
|
#remove 'and' and 'the':
|
||||||
tsearch_rem1 = re.sub("\\band\\b", "%", seriesname.lower())
|
tsearch_rem1 = re.sub("\\band\\b", "%", seriesname.lower())
|
||||||
tsearch_rem2 = re.sub("\\bthe\\b", "%", tsearch_rem1.lower())
|
tsearch_rem2 = re.sub("\\bthe\\b", "%", tsearch_rem1.lower())
|
||||||
|
|
Loading…
Reference in New Issue