Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
FIX:(#500) Can't start Mylar after update - failed newznab migration,…
Browse files Browse the repository at this point in the history
… IMP:(#499) Annuals will now filecheck, Alphanumeric Issues should work now, IMP:Added nzblog wipe button to History page - will Wipe the nzblog table for those having problems with post-processing and the .1 folders.
  • Loading branch information
evilhero committed Aug 6, 2013
1 parent 13ec156 commit e4e1bcc
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 38 deletions.
3 changes: 3 additions & 0 deletions data/interfaces/default/config.html
Expand Up @@ -378,6 +378,7 @@ <h1 class="clearfix"><img src="interfaces/default/images/icon_gear.png" alt="set
<div class="row">
<label>NZB.SU UID</label>
<input type="text" name="nzbsu_uid" value="${config['nzbsu_uid']}" size="15" >
<small>( only needed for RSS feed )</small>
</div>
<div class="row">
<label>NZB.SU API</label>
Expand All @@ -394,6 +395,7 @@ <h1 class="clearfix"><img src="interfaces/default/images/icon_gear.png" alt="set
<div class="row">
<label>DOGNZB UID</label>
<input type="text" name="dognzb_uid" value="${config['dognzb_uid']}" size="15">
<small>( only needed for RSS feed )</small>
</div>
<div class="row">
<label>DOGNZB API</label>
Expand Down Expand Up @@ -466,6 +468,7 @@ <h1 class="clearfix"><img src="interfaces/default/images/icon_gear.png" alt="set
<div class="row">
<label>Newznab UID</label>
<input type="text" name="newznab_uid${newznab_number}" value="${newznab[3]}" size="15">
<small>( only needed for RSS feed )</small>
</div>
<div class="row checkbox">
<input id="newznab_enabled" type="checkbox" name="newznab_enabled${newznab_number}" value="1" ${newznab_enabled} /><label>Enabled</label>
Expand Down
1 change: 1 addition & 0 deletions data/interfaces/default/history.html
Expand Up @@ -10,6 +10,7 @@
<a id="menu_link_delete" href="#" onclick="doAjaxCall('clearhistory?type=Processed',$(this),'table')" data-success="All Processed cleared">Clear Processed</a>
<a id="menu_link_delete" href="#" onclick="doAjaxCall('clearhistory?type=Unprocessed',$(this),'table')" data-success="All Unprocessed cleared">Clear Unprocessed</a>
<a id="menu_link_delete" href="#" onclick="doAjaxCall('clearhistory?type=Snatched',$(this),'table')" data-success="All Snatched cleared">Clear Snatched</a>
<a id="menu_link_delete" href="#" onclick="doAjaxCall('wipenzblog',$(this),'table')" data-success="Wiped entire NZB DB">Wipe NZBLOG</a>
</div>
</div>
</%def>
Expand Down
4 changes: 2 additions & 2 deletions mylar/__init__.py
Expand Up @@ -549,9 +549,9 @@ def initialize():
for en in EXTRA_NEWZNABS:
#set newznabname to newznab address initially so doesn't bomb.
if CONFIG_VERSION == '4':
ENABS.append((en[0], en[1], en[2], '1', en[3]))
ENABS.append((en[0], en[1], en[2], '1', en[3])) #0=name,1=host,2=api,3=enabled/disabled
else:
ENABS.append((en[0], en[0], en[2], en[3]))
ENABS.append((en[0], en[0], en[1], '1', en[2])) #0=host,1=api,2=enabled/disabled
#now we hammer the EXTRA_NEWZNABS with the corrected version
EXTRA_NEWZNABS = ENABS
#update the configV and write the config.
Expand Down
25 changes: 17 additions & 8 deletions mylar/filechecker.py
Expand Up @@ -271,14 +271,23 @@ def listFiles(dir,watchcomic,AlternateSearch=None):
justthedigits = justthedigits.split(' ', 1)[0]

#if the issue has an alphanumeric (issue_exceptions, join it and push it through)
try:
if tmpthedigits.split(' ', 1)[1] is not None:
for issexcept in issue_exceptions:
if issexcept in tmpthedigits.split(' ', 1)[1]:
justthedigits += tmpthedigits.split(' ', 1)[1]
break
except:
pass
logger.fdebug("JUSTTHEDIGITS [" + justthedigits + "]" )
if justthedigits.lower() == 'annual':
logger.fdebug("ANNUAL [" + tmpthedigits.split(' ', 1)[1] + "]")
justthedigits += ' ' + tmpthedigits.split(' ', 1)[1]

else:

try:
if tmpthedigits.split(' ', 1)[1] is not None:
poss_alpha = tmpthedigits.split(' ', 1)[1]
for issexcept in issue_exceptions:
if issexcept.lower() in poss_alpha.lower() and len(poss_alpha) <= len(issexcept):
justthedigits += poss_alpha
logger.fdebug("ALPHANUMERIC EXCEPTION. COMBINING : [" + justthedigits + "]")
break
except:
pass

logger.fdebug("final justthedigits [" + justthedigits + "]")

Expand Down
107 changes: 79 additions & 28 deletions mylar/updater.py
Expand Up @@ -398,6 +398,8 @@ def forceRescan(ComicID,archive=None):
annualdupechk = []
issueexceptdupechk = []
reissues = myDB.action('SELECT * FROM issues WHERE ComicID=?', [ComicID]).fetchall()
issID_to_ignore = []

while (fn < fccnt):
haveissue = "no"
issuedupe = "no"
Expand Down Expand Up @@ -587,7 +589,7 @@ def forceRescan(ComicID,archive=None):
if fcnew[som+1].isdigit():
ann_iss = fcnew[som+1]
logger.fdebug("Annual # " + str(ann_iss) + " detected.")
fcdigit = int(ann_iss) * 1000
fcdigit = helpers.issuedigits(ann_iss)
logger.fdebug("fcdigit:" + str(fcdigit))
logger.fdebug("int_iss:" + str(int_iss))
if int(fcdigit) == int_iss:
Expand Down Expand Up @@ -618,51 +620,100 @@ def forceRescan(ComicID,archive=None):
#we have the # of comics, now let's update the db.
#even if we couldn't find the physical issue, check the status.
if 'annual' in temploc.lower():
logger.fdebug("issueID to write to db:" + str(reann['IssueID']))
controlValueDict = {"IssueID": str(reann['IssueID'])}
iss_id = reann['IssueID']
else:
logger.fdebug("issueID to write to db:" + str(reiss['IssueID']))
controlValueDict = {"IssueID": reiss['IssueID']}
iss_id = reiss['IssueID']

logger.fdebug("issueID to write to db:" + str(iss_id))
controlValueDict = {"IssueID": iss_id}

#if Archived, increase the 'Have' count.
if archive:
issStatus = "Archived"
if haveissue == "no" and issuedupe == "no":
isslocation = "None"
if old_status == "Skipped":
if mylar.AUTOWANT_ALL:
issStatus = "Wanted"
else:
issStatus = "Skipped"
elif old_status == "Archived":
havefiles+=1
issStatus = "Archived"
elif old_status == "Downloaded":
issStatus = "Archived"
havefiles+=1
elif old_status == "Wanted":
issStatus = "Wanted"
elif old_status == "Ignored":
issStatus = "Ignored"
elif old_status == "Snatched": #this is needed for torrents, or else it'll keep on queuing..
issStatus = "Snatched"
else:
issStatus = "Skipped"

newValueDict = {"Status": issStatus }
# if haveissue == "no" and issuedupe == "no":
# isslocation = "None"
# if old_status == "Skipped":
# if mylar.AUTOWANT_ALL:
# issStatus = "Wanted"
# else:
# issStatus = "Skipped"
# elif old_status == "Archived":
# havefiles+=1
# issStatus = "Archived"
# elif old_status == "Downloaded":
# issStatus = "Archived"
# havefiles+=1
# elif old_status == "Wanted":
# issStatus = "Wanted"
# elif old_status == "Ignored":
# issStatus = "Ignored"
# elif old_status == "Snatched": #this is needed for torrents, or else it'll keep on queuing..
# issStatus = "Snatched"
# else:
# issStatus = "Skipped"
#
# newValueDict = {"Status": issStatus }

elif haveissue == "yes":
issStatus = "Downloaded"
newValueDict = {"Location": isslocation,
"ComicSize": issSize,
"Status": issStatus
}
issID_to_ignore.append(iss_id)

if 'annual' in temploc.lower():
myDB.upsert("annuals", newValueDict, controlValueDict)
else:
myDB.upsert("issues", newValueDict, controlValueDict)
fn+=1

logger.fdebug("IssueID's to ignore: " + str(issID_to_ignore))
#here we need to change the status of the ones we DIDN'T FIND above since the loop only hits on FOUND issues.
update_iss = []
tmpsql = "SELECT * FROM issues WHERE ComicID=? AND IssueID not in ({seq})".format(seq=','.join(['?']*len(issID_to_ignore)))
args = [ComicID, issID_to_ignore]

# chkthis = myDB.action(tmpsql, args).fetchall()
chkthis = None
if chkthis is None:
pass
else:
for chk in chkthis:
old_status = chk['Status']
logger.fdebug("old_status:" + str(old_status))
if old_status == "Skipped":
if mylar.AUTOWANT_ALL:
issStatus = "Wanted"
else:
issStatus = "Skipped"
elif old_status == "Archived":
issStatus = "Archived"
elif old_status == "Downloaded":
issStatus = "Archived"
elif old_status == "Wanted":
issStatus = "Wanted"
elif old_status == "Ignored":
issStatus = "Ignored"
elif old_status == "Snatched": #this is needed for torrents, or else it'll keep on queuing..
issStatus = "Snatched"
else:
issStatus = "Skipped"

logger.fdebug("new status: " + str(issStatus))

update_iss.append({"IssueID": chk['IssueID'],
"Status": issStatus})

if len(update_iss) > 0:
i = 0
#do it like this to avoid DB locks...
for ui in update_iss:
controlValueDict = {"IssueID": ui['IssueID']}
newStatusValue = {"Status": ui['Status']}
myDB.upsert("issues", newStatusValue, controlValueDict)
i+=1
logger.info("updated " + str(i) + " issues that weren't found.")

logger.info("Total files located: " + str(havefiles))
foundcount = havefiles
Expand Down
10 changes: 10 additions & 0 deletions mylar/webserve.py
Expand Up @@ -407,6 +407,16 @@ def deleteArtist(self, ComicID):
raise cherrypy.HTTPRedirect("home")
deleteArtist.exposed = True

def wipenzblog(self, ComicID=None):
logger.fdebug("Wiping NZBLOG in it's entirety. You should NOT be downloading while doing this or else you'll lose the log for the download.")
myDB = db.DBConnection()
if ComicID is None:
myDB.action('DROP table nzblog')
logger.fdebug("Deleted nzblog table.")
myDB.action('CREATE TABLE IF NOT EXISTS nzblog (IssueID TEXT, NZBName TEXT, SARC TEXT)')
logger.fdebug("Re-created nzblog table.")
wipenzblog.exposed = True

def refreshArtist(self, ComicID):
myDB = db.DBConnection()
mismatch = "no"
Expand Down

0 comments on commit e4e1bcc

Please sign in to comment.