mirror of https://github.com/evilhero/mylar
FIX: Substitutes.csv wouldn't replace characters ocassionally due to improper comparisons, IMP:(#619) addbyid is now url callable (http://mylaraddress/addbyid?4050-X or X), IMP: some matching improvements for future pull list
This commit is contained in:
parent
7831984096
commit
125d92dc3a
|
@ -515,6 +515,15 @@ def initialize():
|
|||
PR_NUM = 0 # provider counter here (used for provider orders)
|
||||
PR = []
|
||||
|
||||
#add torrents to provider counter.
|
||||
if ENABLE_CBT:
|
||||
PR.append('cbt')
|
||||
PR_NUM +=1
|
||||
if ENABLE_KAT:
|
||||
PR.append('kat')
|
||||
PR_NUM +=1
|
||||
|
||||
|
||||
NZBSU = bool(check_setting_int(CFG, 'NZBsu', 'nzbsu', 0))
|
||||
NZBSU_UID = check_setting_str(CFG, 'NZBsu', 'nzbsu_uid', '')
|
||||
NZBSU_APIKEY = check_setting_str(CFG, 'NZBsu', 'nzbsu_apikey', '')
|
||||
|
@ -546,7 +555,7 @@ def initialize():
|
|||
PR.append('Experimental')
|
||||
PR_NUM +=1
|
||||
|
||||
#print 'PR_NUM::' + str(PR_NUM)
|
||||
print 'PR_NUM::' + str(PR_NUM)
|
||||
|
||||
NEWZNAB = bool(check_setting_int(CFG, 'Newznab', 'newznab', 0))
|
||||
|
||||
|
@ -625,7 +634,8 @@ def initialize():
|
|||
TMPPR_NUM +=1
|
||||
PROVIDER_ORDER = PROV_ORDER
|
||||
|
||||
#print 'Provider Order is:' + str(PROVIDER_ORDER)
|
||||
#this isn't ready for primetime just yet...
|
||||
#logger.info('Provider Order is:' + str(PROVIDER_ORDER))
|
||||
config_write()
|
||||
|
||||
# update folder formats in the config & bump up config version
|
||||
|
@ -1085,7 +1095,7 @@ def dbcheck():
|
|||
c=conn.cursor()
|
||||
|
||||
c.execute('CREATE TABLE IF NOT EXISTS comics (ComicID TEXT UNIQUE, ComicName TEXT, ComicSortName TEXT, ComicYear TEXT, DateAdded TEXT, Status TEXT, IncludeExtras INTEGER, Have INTEGER, Total INTEGER, ComicImage TEXT, ComicPublisher TEXT, ComicLocation TEXT, ComicPublished TEXT, LatestIssue TEXT, LatestDate TEXT, Description TEXT, QUALalt_vers TEXT, QUALtype TEXT, QUALscanner TEXT, QUALquality TEXT, LastUpdated TEXT, AlternateSearch TEXT, UseFuzzy TEXT, ComicVersion TEXT, SortOrder INTEGER, ForceContinuing INTEGER)')
|
||||
c.execute('CREATE TABLE IF NOT EXISTS issues (IssueID TEXT, ComicName TEXT, IssueName TEXT, Issue_Number TEXT, DateAdded TEXT, Status TEXT, Type TEXT, ComicID, ArtworkURL Text, ReleaseDate TEXT, Location TEXT, IssueDate TEXT, Int_IssueNumber INT, ComicSize TEXT)')
|
||||
c.execute('CREATE TABLE IF NOT EXISTS issues (IssueID TEXT, ComicName TEXT, IssueName TEXT, Issue_Number TEXT, DateAdded TEXT, Status TEXT, Type TEXT, ComicID, ArtworkURL Text, ReleaseDate TEXT, Location TEXT, IssueDate TEXT, Int_IssueNumber INT, ComicSize TEXT, AltIssueNumber TEXT)')
|
||||
c.execute('CREATE TABLE IF NOT EXISTS snatched (IssueID TEXT, ComicName TEXT, Issue_Number TEXT, Size INTEGER, DateAdded TEXT, Status TEXT, FolderName TEXT, ComicID TEXT, Provider TEXT)')
|
||||
c.execute('CREATE TABLE IF NOT EXISTS upcoming (ComicName TEXT, IssueNumber TEXT, ComicID TEXT, IssueID TEXT, IssueDate TEXT, Status TEXT, DisplayComicName TEXT)')
|
||||
c.execute('CREATE TABLE IF NOT EXISTS nzblog (IssueID TEXT, NZBName TEXT, SARC TEXT)')
|
||||
|
@ -1268,6 +1278,10 @@ def dbcheck():
|
|||
except:
|
||||
c.execute('ALTER TABLE comics ADD COLUMN ForceContinuing INTEGER')
|
||||
|
||||
try:
|
||||
c.execute('SELECT AltIssueNumber from issues')
|
||||
except:
|
||||
c.execute('ALTER TABLE issues ADD COLUMN AltIssueNumber TEXT')
|
||||
|
||||
|
||||
#if it's prior to Wednesday, the issue counts will be inflated by one as the online db's everywhere
|
||||
|
|
|
@ -275,6 +275,14 @@ class WebInterface(object):
|
|||
raise cherrypy.HTTPRedirect("comicDetails?ComicID=%s" % comicid)
|
||||
addComic.exposed = True
|
||||
|
||||
def addbyid(self,comicid):
|
||||
mismatch = "no"
|
||||
logger.info('Attempting to add directly by ComicVineID: ' + str(comicid))
|
||||
if comicid.startswith('4050-'): comicid = re.sub('4050-','', comicid)
|
||||
importer.addComictoDB(comicid,mismatch)
|
||||
raise cherrypy.HTTPRedirect("home")
|
||||
addbyid.exposed = True
|
||||
|
||||
def wanted_Export(self):
|
||||
import unicodedata
|
||||
myDB = db.DBConnection()
|
||||
|
@ -773,6 +781,21 @@ class WebInterface(object):
|
|||
def futurepulllist(self):
|
||||
myDB = db.DBConnection()
|
||||
futureresults = []
|
||||
watchresults = []
|
||||
popthis = myDB.select("SELECT * FROM sqlite_master WHERE name='futureupcoming' and type='table'")
|
||||
if popthis:
|
||||
l_results = myDB.select("SELECT * FROM futureupcoming WHERE Status='Wanted'")
|
||||
for lres in l_results:
|
||||
watchresults.append({
|
||||
"ComicName": lres['ComicName'],
|
||||
"IssueNumber": lres['IssueNumber'],
|
||||
"ComicID": lres['ComicID'],
|
||||
"IssueDate": lres['IssueDate'],
|
||||
"Publisher": lres['Publisher'],
|
||||
"Status": lres['Status']
|
||||
})
|
||||
logger.fdebug('There are ' + str(len(watchresults)) + ' issues that you are watching for but are not on your watchlist yet.')
|
||||
|
||||
popit = myDB.select("SELECT * FROM sqlite_master WHERE name='future' and type='table'")
|
||||
if popit:
|
||||
f_results = myDB.select("SELECT SHIPDATE, PUBLISHER, ISSUE, COMIC, EXTRA, STATUS, ComicID, FutureID from future")
|
||||
|
@ -793,13 +816,24 @@ class WebInterface(object):
|
|||
future_extra = re.sub('[\(\)]', '', future['EXTRA'])
|
||||
|
||||
if x is not None:
|
||||
#here we check the status to make sure it's ok since we loaded all the Watch For earlier.
|
||||
chkstatus = future['STATUS']
|
||||
|
||||
for wr in watchresults:
|
||||
if wr['ComicName'] == future['COMIC'] and wr['IssueNumber'] == future['ISSUE']:
|
||||
logger.info('matched on Name: ' + wr['ComicName'] + ' to ' + future['COMIC'])
|
||||
logger.info('matched on Issue: #' + wr['IssueNumber'] + ' to #' + future['ISSUE'])
|
||||
logger.info('matched on ID: ' + str(wr['ComicID']) + ' to ' + str(future['ComicID']))
|
||||
chkstatus = wr['Status']
|
||||
break
|
||||
|
||||
futureresults.append({
|
||||
"SHIPDATE" : future['SHIPDATE'],
|
||||
"PUBLISHER" : future['PUBLISHER'],
|
||||
"ISSUE" : future['ISSUE'],
|
||||
"COMIC" : future['COMIC'],
|
||||
"EXTRA" : future_extra,
|
||||
"STATUS" : future['STATUS'],
|
||||
"STATUS" : chkstatus,
|
||||
"COMICID" : future['ComicID'],
|
||||
"FUTUREID" : future['FutureID']
|
||||
})
|
||||
|
@ -812,12 +846,12 @@ class WebInterface(object):
|
|||
futurepulllist.exposed = True
|
||||
|
||||
def add2futurewatchlist(self, ComicName, Issue, Publisher, ShipDate, FutureID):
|
||||
logger.info('Adding ' + ComicName + ' # ' + str(Issue) + ' to future upcoming watchlist')
|
||||
myDB = db.DBConnection()
|
||||
chkfuture = myDB.action('SELECT * FROM futureupcoming WHERE ComicName=? AND IssueNumber=?', [ComicName, Issue]).fetchone()
|
||||
if chkfuture is not None:
|
||||
logger.info('Already on Future Upcoming list - not adding at this time.')
|
||||
return
|
||||
logger.info('Adding ' + ComicName + ' # ' + str(Issue) + ' to future upcoming watchlist')
|
||||
newCtrl = {"ComicName": ComicName,
|
||||
"IssueNumber": Issue,
|
||||
"Publisher": Publisher}
|
||||
|
@ -872,7 +906,7 @@ class WebInterface(object):
|
|||
findst = tmpdatethis.find('-') #find the '-'
|
||||
tmpdate = tmpdatethis[findst+1:] + tmpdatethis[:findst] #rebuild in format of yyyymm
|
||||
timenow = datetime.datetime.now().strftime('%Y%m')
|
||||
logger.fdebug('comparing pubdate of: ' + str(tmpdate) + ' to now date of: ' + str(timenow))
|
||||
#logger.fdebug('comparing pubdate of: ' + str(tmpdate) + ' to now date of: ' + str(timenow))
|
||||
if int(tmpdate) >= int(timenow):
|
||||
if upc['Status'] == 'Wanted':
|
||||
upcoming.append({"ComicName": upc['ComicName'],
|
||||
|
@ -922,9 +956,21 @@ class WebInterface(object):
|
|||
logger.fdebug("--Updating Status of issues table because of Upcoming status--")
|
||||
logger.fdebug("ComicName: " + str(myissue['ComicName']))
|
||||
logger.fdebug("Issue number : " + str(myissue['Issue_Number']) )
|
||||
|
||||
#sometimes the preview list has differeing issue#'s than comicvine
|
||||
#ie. preview list has 22.NOW, whereas comicvine has 22
|
||||
#this will never match, so we need to build in some exception catching to catch
|
||||
#these, store both values, and be able to search for both if need be.
|
||||
#this is a direct string compare, we may have to drop down to integer compare though at some point
|
||||
if myissue['Issue_Number'] == mvup['IssueNumber']:
|
||||
altissue = None
|
||||
else:
|
||||
# we store the upcoming db value, since we already have the comicvine issue
|
||||
altissue = mvup['IssueNumber']
|
||||
|
||||
mvcontroldict = {"IssueID": myissue['IssueID']}
|
||||
mvvalues = {"ComicID": myissue['ComicID'],
|
||||
"AltIssueNumber": altissue,
|
||||
"Status": "Wanted"}
|
||||
myDB.upsert("issues", mvvalues, mvcontroldict)
|
||||
|
||||
|
|
|
@ -70,11 +70,10 @@ def pullit(forcecheck=None):
|
|||
with open(substitutes) as f:
|
||||
reader = csv.reader(f, delimiter='|')
|
||||
for row in reader:
|
||||
if not row.startswith('#'):
|
||||
logger.debug ("Substitutes file read : "+str(row))
|
||||
if not row[0].startswith('#'):
|
||||
logger.fdebug("Substitutes file read : "+str(row))
|
||||
shortrep.append(row[0])
|
||||
longrep.append(row[1])
|
||||
|
||||
f.close()
|
||||
|
||||
not_these=['PREVIEWS',
|
||||
|
@ -326,7 +325,7 @@ def pullit(forcecheck=None):
|
|||
if substitute_check == True:
|
||||
#Step through the list - storing an index
|
||||
for repindex,repcheck in enumerate(shortrep):
|
||||
if len(comicnm)>= len(shortrep):
|
||||
if len(comicnm) >= len(repcheck):
|
||||
#if the leftmost chars match the short text then replace them with the long text
|
||||
if comicnm[:len(repcheck)]==repcheck:
|
||||
logger.info("Switch worked on "+comicnm + " replacing " + str(repcheck) + " with " + str(longrep[repindex]))
|
||||
|
|
Loading…
Reference in New Issue