mirror of
https://github.com/evilhero/mylar
synced 2024-12-26 01:26:50 +00:00
FIX: When selecting muliple series of the same title and year, would cause error when performing any action on Manage Comics tab
This commit is contained in:
parent
2638a3c0e8
commit
1f0013281f
1 changed files with 26 additions and 14 deletions
|
@ -2275,6 +2275,7 @@ class WebInterface(object):
|
||||||
def markComics(self, action=None, **args):
|
def markComics(self, action=None, **args):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
comicsToAdd = []
|
comicsToAdd = []
|
||||||
|
clist = []
|
||||||
for k,v in args.items():
|
for k,v in args.items():
|
||||||
if k == 'manage_comic_length':
|
if k == 'manage_comic_length':
|
||||||
continue
|
continue
|
||||||
|
@ -2283,30 +2284,41 @@ class WebInterface(object):
|
||||||
comyr = k.find('[')
|
comyr = k.find('[')
|
||||||
ComicYear = re.sub('[\[\]]', '', k[comyr:]).strip()
|
ComicYear = re.sub('[\[\]]', '', k[comyr:]).strip()
|
||||||
ComicName = k[:comyr].strip()
|
ComicName = k[:comyr].strip()
|
||||||
ComicID = v
|
if len(v) > 1:
|
||||||
#cid = ComicName.decode('utf-8', 'replace')
|
#because multiple items can have the same comicname & year, we need to make sure they're all unique entries
|
||||||
|
for x in v:
|
||||||
|
clist.append({'ComicName': ComicName,
|
||||||
|
'ComicYear': ComicYear,
|
||||||
|
'ComicID': x})
|
||||||
|
else:
|
||||||
|
clist.append({'ComicName': ComicName,
|
||||||
|
'ComicYear': ComicYear,
|
||||||
|
'ComicID': v})
|
||||||
|
|
||||||
|
for cl in clist:
|
||||||
if action == 'delete':
|
if action == 'delete':
|
||||||
logger.info('[MANAGE COMICS][DELETION] Now deleting ' + ComicName + ' (' + str(ComicYear) + ') [' + str(ComicID) + '] form the DB.')
|
logger.info('[MANAGE COMICS][DELETION] Now deleting ' + cl['ComicName'] + ' (' + str(cl['ComicYear']) + ') [' + str(cl['ComicID']) + '] form the DB.')
|
||||||
myDB.action('DELETE from comics WHERE ComicID=?', [ComicID])
|
myDB.action('DELETE from comics WHERE ComicID=?', [cl['ComicID']])
|
||||||
myDB.action('DELETE from issues WHERE ComicID=?', [ComicID])
|
myDB.action('DELETE from issues WHERE ComicID=?', [cl['ComicID']])
|
||||||
logger.info('[MANAGE COMICS][DELETION] Successfully deleted ' + ComicName + '(' + str(ComicYear) + ')')
|
if mylar.ANNUALS_ON:
|
||||||
|
myDB.action('DELETE from annuals WHERE ComicID=?', [cl['ComicID']])
|
||||||
|
logger.info('[MANAGE COMICS][DELETION] Successfully deleted ' + cl['ComicName'] + '(' + str(cl['ComicYear']) + ')')
|
||||||
elif action == 'pause':
|
elif action == 'pause':
|
||||||
controlValueDict = {'ComicID': ComicID}
|
controlValueDict = {'ComicID': cl['ComicID']}
|
||||||
newValueDict = {'Status': 'Paused'}
|
newValueDict = {'Status': 'Paused'}
|
||||||
myDB.upsert("comics", newValueDict, controlValueDict)
|
myDB.upsert("comics", newValueDict, controlValueDict)
|
||||||
logger.info('[MANAGE COMICS][PAUSE] ' + ComicName + ' has now been put into a Paused State.')
|
logger.info('[MANAGE COMICS][PAUSE] ' + cl['ComicName'] + ' has now been put into a Paused State.')
|
||||||
elif action == 'resume':
|
elif action == 'resume':
|
||||||
controlValueDict = {'ComicID': ComicID}
|
controlValueDict = {'ComicID': cl['ComicID']}
|
||||||
newValueDict = {'Status': 'Active'}
|
newValueDict = {'Status': 'Active'}
|
||||||
myDB.upsert("comics", newValueDict, controlValueDict)
|
myDB.upsert("comics", newValueDict, controlValueDict)
|
||||||
logger.info('[MANAGE COMICS][RESUME] ' + ComicName + ' has now been put into a Resumed State.')
|
logger.info('[MANAGE COMICS][RESUME] ' + cl['ComicName'] + ' has now been put into a Resumed State.')
|
||||||
elif action == 'recheck' or action == 'metatag':
|
elif action == 'recheck' or action == 'metatag':
|
||||||
comicsToAdd.append({'ComicID': ComicID,
|
comicsToAdd.append({'ComicID': cl['ComicID'],
|
||||||
'ComicName': ComicName,
|
'ComicName': cl['ComicName'],
|
||||||
'ComicYear': ComicYear})
|
'ComicYear': cl['ComicYear']})
|
||||||
else:
|
else:
|
||||||
comicsToAdd.append(ComicID)
|
comicsToAdd.append(cl['ComicID'])
|
||||||
|
|
||||||
if len(comicsToAdd) > 0:
|
if len(comicsToAdd) > 0:
|
||||||
if action == 'recheck':
|
if action == 'recheck':
|
||||||
|
|
Loading…
Reference in a new issue