Add "Archive on first match" to Manage, Mass Update, Edit Selected page.

This commit is contained in:
JackDandy 2014-10-16 21:45:07 +01:00
parent d452f199b6
commit 85d022916f
2 changed files with 37 additions and 2 deletions

View File

@ -72,6 +72,23 @@
</div>
</div>
#if $anyQualities + $bestQualities:
#set $isSelected = ' selected="selected"'
#set $isEnabled = $isSelected
#set $isDisabled = $isSelected
#if $archive_firstmatch_value##set $isDisabled = ''##else##set $isEnabled = ''##end if#
<div class="optionWrapper clearfix">
<span class="selectTitle">Archive on first match</span>
<div class="selectChoices">
<select id="edit_archive_firstmatch" name="archive_firstmatch">
<option value="keep">&lt; keep &gt;</option>
<option value="enable"${isEnabled}>enable</option>
<option value="disable"${isDisabled}>disable</option>
</select>
</div>
</div>
#end if
<div class="optionWrapper clearfix">
<span class="selectTitle">Flatten Folders <span class="separator">*</span></span>
<div class="selectChoices">

View File

@ -948,6 +948,9 @@ class Manage(MainHandler):
if showObj:
showList.append(showObj)
archive_firstmatch_all_same = True
last_archive_firstmatch = None
flatten_folders_all_same = True
last_flatten_folders = None
@ -980,6 +983,13 @@ class Manage(MainHandler):
if cur_root_dir not in root_dir_list:
root_dir_list.append(cur_root_dir)
if archive_firstmatch_all_same:
# if we had a value already and this value is different then they're not all the same
if last_archive_firstmatch not in (None, curShow.archive_firstmatch):
archive_firstmatch_all_same = False
else:
last_archive_firstmatch = curShow.archive_firstmatch
# if we know they're not all the same then no point even bothering
if paused_all_same:
# if we had a value already and this value is different then they're not all the same
@ -1032,6 +1042,7 @@ class Manage(MainHandler):
last_air_by_date = curShow.air_by_date
t.showList = toEdit
t.archive_firstmatch_value = last_archive_firstmatch if archive_firstmatch_all_same else None
t.paused_value = last_paused if paused_all_same else None
t.anime_value = last_anime if anime_all_same else None
t.flatten_folders_value = last_flatten_folders if flatten_folders_all_same else None
@ -1045,7 +1056,7 @@ class Manage(MainHandler):
return _munge(t)
def massEditSubmit(self, paused=None, anime=None, sports=None, scene=None, flatten_folders=None,
def massEditSubmit(self, archive_firstmatch=None, paused=None, anime=None, sports=None, scene=None, flatten_folders=None,
quality_preset=False,
subtitles=None, air_by_date=None, anyQualities=[], bestQualities=[], toEdit=None, *args,
**kwargs):
@ -1075,6 +1086,12 @@ class Manage(MainHandler):
else:
new_show_dir = showObj._location
if archive_firstmatch == 'keep':
new_archive_firstmatch = showObj.archive_firstmatch
else:
new_archive_firstmatch = True if archive_firstmatch == 'enable' else False
new_archive_firstmatch = 'on' if new_archive_firstmatch else 'off'
if paused == 'keep':
new_paused = showObj.paused
else:
@ -1125,6 +1142,7 @@ class Manage(MainHandler):
curErrors += Home(self.application, self.request).editShow(curShow, new_show_dir, anyQualities,
bestQualities, exceptions_list,
archive_firstmatch=new_archive_firstmatch,
flatten_folders=new_flatten_folders,
paused=new_paused, sports=new_sports,
subtitles=new_subtitles, anime=new_anime,
@ -3933,6 +3951,7 @@ class Home(MainHandler):
with showObj.lock:
newQuality = Quality.combineQualities(map(int, anyQualities), map(int, bestQualities))
showObj.quality = newQuality
showObj.archive_firstmatch = archive_firstmatch
# reversed for now
if bool(showObj.flatten_folders) != bool(flatten_folders):
@ -3952,7 +3971,6 @@ class Home(MainHandler):
if not directCall:
showObj.lang = indexer_lang
showObj.dvdorder = dvdorder
showObj.archive_firstmatch = archive_firstmatch
showObj.rls_ignore_words = rls_ignore_words.strip()
showObj.rls_require_words = rls_require_words.strip()