Browse Source

Require at least 1 category to be set for Sorting and warn if not set

Before 3.4.0, only for TV sorting we allowed to set 0 categories. But for Movies and Date Sorting we did require at least 1 category to be set. This was harmonized in 3.4.0, breaking existing setups. Added warning for those users.
The Sorting behavior is different from Notifications: in Notifications selecting Default only(!) means to apply it to all categories.
However, that has never been the case for Sorting. So for now added a bit more help texts to the Affected categories box on both pages.
tags/3.4.2RC2
Safihre 4 years ago
parent
commit
a0ab6d35c7
  1. 2
      interfaces/Config/templates/config_notify.tmpl
  2. 9
      interfaces/Config/templates/config_sorting.tmpl
  3. 2
      sabnzbd/cfg.py
  4. 4
      sabnzbd/skintext.py
  5. 12
      sabnzbd/sorting.py

2
interfaces/Config/templates/config_notify.tmpl

@ -22,6 +22,7 @@
<option value="$ct" <!--#if $ct in $getVar($section_label + '_cats') then 'selected="selected"' else ""#-->>$Tspec($ct)</option>
<!--#end for#-->
</select>
<p>$T('defaultNotifiesAll')</p>
</div>
<!--#end def#-->
@ -40,6 +41,7 @@
<option value="$ct" <!--#if $ct in $email_cats then 'selected="selected"' else ""#-->>$Tspec($ct)</option>
<!--#end for#-->
</select>
<p>$T('defaultNotifiesAll')</p>
</div>
</div>
<div class="col1">

9
interfaces/Config/templates/config_sorting.tmpl

@ -11,12 +11,13 @@
<h3>$T('seriesSorting') <a href="$helpuri$help_uri#toc0" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
<p>
<b>$T('affectedCat')</b><br/>
<select name="tv_categories" multiple="multiple" class="multiple_cats">
<select name="tv_categories" multiple="multiple" class="multiple_cats" required="required">
<!--#for $ct in $categories#-->
<option value="$ct" <!--#if $ct in $tv_categories then 'selected="selected"' else ""#--> >$Tspec($ct)</option>
<!--#end for#-->
</select>
</p>
<p>$T('selectOneCat')</p>
</div>
<!-- /col2 -->
<div class="col1">
@ -223,12 +224,13 @@
<h3>$T('movieSort') <a href="$helpuri$help_uri#toc6" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
<p>
<b>$T('affectedCat')</b><br/>
<select name="movie_categories" multiple="multiple" class="multiple_cats">
<select name="movie_categories" multiple="multiple" class="multiple_cats" required="required">
<!--#for $ct in $categories#-->
<option value="$ct" <!--#if $ct in $movie_categories then 'selected="selected"' else ""#--> >$Tspec($ct)</option>
<!--#end for#-->
</select>
</p>
<p>$T('selectOneCat')</p>
</div>
<!-- /col2 -->
<div class="col1">
@ -419,12 +421,13 @@
<h3>$T('dateSorting') <a href="$helpuri$help_uri#toc9" target="_blank"><span class="glyphicon glyphicon-question-sign"></span></a></h3>
<p>
<b>$T('affectedCat')</b><br/>
<select name="date_categories" multiple="multiple" class="multiple_cats">
<select name="date_categories" multiple="multiple" class="multiple_cats" required="required">
<!--#for $ct in $categories#-->
<option value="$ct" <!--#if $ct in $date_categories then 'selected="selected"' else ""#--> >$Tspec($ct)</option>
<!--#end for#-->
</select>
</p>
<p>$T('selectOneCat')</p>
</div>
<!-- /col2 -->
<div class="col1">

2
sabnzbd/cfg.py

@ -233,7 +233,7 @@ rating_filter_pause_keywords = OptionStr("misc", "rating_filter_pause_keywords")
##############################################################################
enable_tv_sorting = OptionBool("misc", "enable_tv_sorting", False)
tv_sort_string = OptionStr("misc", "tv_sort_string")
tv_categories = OptionList("misc", "tv_categories", "")
tv_categories = OptionList("misc", "tv_categories", ["tv"])
enable_movie_sorting = OptionBool("misc", "enable_movie_sorting", False)
movie_sort_string = OptionStr("misc", "movie_sort_string")

4
sabnzbd/skintext.py

@ -701,6 +701,9 @@ SKIN_TEXT = {
"link-download": TT("Download"), #: Config->RSS button "download item"
"button-rssNow": TT("Read All Feeds Now"), #: Config->RSS button
# Config->Notifications
"defaultNotifiesAll": TT(
"If only the <em>Default</em> category is selected, notifications are enabled for jobs in all categories."
),
"opt-email_endjob": TT("Email Notification On Job Completion"),
"email-never": TT("Never"), #: When to send email
"email-always": TT("Always"), #: When to send email
@ -773,6 +776,7 @@ SKIN_TEXT = {
"catTags": TT("Indexer Categories / Groups"),
"button-delCat": TT("X"), #: Small delete button
# Config->Sorting
"selectOneCat": TT("Select at least 1 category."),
"seriesSorting": TT("Series Sorting"),
"opt-tvsort": TT("Enable TV Sorting"),
"sort-legenda": TT("Pattern Key"),

12
sabnzbd/sorting.py

@ -363,6 +363,10 @@ class SeriesSorter(BaseSorter):
self.matched = True
self.type = "tv"
# Require at least 1 category, this was not enforced before 3.4.0
if cfg.enable_tv_sorting() and not self.cats:
logging.warning("%s: %s", T("Series Sorting"), T("Select at least 1 category."))
def get_values(self):
"""Collect all values needed for path replacement"""
self.get_year()
@ -426,6 +430,10 @@ class MovieSorter(BaseSorter):
self.matched = True
self.type = "movie"
# Require at least 1 category, this was not enforced before 3.4.0
if cfg.enable_movie_sorting() and not self.cats:
logging.warning("%s: %s", T("Movie Sorting"), T("Select at least 1 category."))
def get_values(self):
"""Collect all values needed for path replacement"""
self.get_year()
@ -506,6 +514,10 @@ class DateSorter(BaseSorter):
self.matched = True
self.type = "date"
# Require at least 1 category, this was not enforced before 3.4.0
if cfg.enable_date_sorting() and not self.cats:
logging.warning("%s: %s", T("Date Sorting"), T("Select at least 1 category."))
def get_date(self):
"""Get month and day"""
self.info["month"] = str(self.guess.get("date").month)

Loading…
Cancel
Save