Browse Source

#483-#326 Add option for Propagation Delay

pull/548/merge
Safihre 9 years ago
committed by shypike
parent
commit
1b384e8d70
  1. 6
      interfaces/Config/templates/config_switches.tmpl
  2. 1
      interfaces/Glitter/templates/main.tmpl
  3. 4
      interfaces/Glitter/templates/static/javascripts/glitter.queue.js
  4. 9
      sabnzbd/api.py
  5. 1
      sabnzbd/cfg.py
  6. 2
      sabnzbd/constants.py
  7. 2
      sabnzbd/interface.py
  8. 42
      sabnzbd/nzbqueue.py
  9. 2
      sabnzbd/nzbstuff.py
  10. 3
      sabnzbd/skintext.py

6
interfaces/Config/templates/config_switches.tmpl

@ -147,13 +147,17 @@
<input type="text" name="unwanted_extensions" id="unwanted_extensions" value="$unwanted_extensions"/>
<span class="desc">$T('explain-unwanted_extensions')</span>
</div>
<div class="field-pair">
<label class="config" for="auto_sort">$T('opt-auto_sort')</label>
<input type="checkbox" name="auto_sort" id="auto_sort" value="1" <!--#if int($auto_sort) > 0 then 'checked="checked"' else ""#--> />
<span class="desc">$T('explain-auto_sort')</span>
</div>
<div class="field-pair">
<label class="config" for="propagation_delay">$T('opt-propagation_delay')</label>
<input type="number" name="propagation_delay" id="propagation_delay" value="$propagation_delay" min="2" max="2000" /> <i>$T('minutes')</i>
<span class="desc">$T('explain-propagation_delay')</span>
</div>
<div class="field-pair">
<button class="btn btn-default saveButton"><span class="glyphicon glyphicon-ok"></span> $T('button-saveChanges')</button>
</div>
</fieldset>

1
interfaces/Glitter/templates/main.tmpl

@ -61,6 +61,7 @@
glitterTranslate.repair = "$T('explain-Repair')".replace(/<br \/>/g, "\n");
glitterTranslate.removeDown = "$T('Glitter-confirmClearDownloads')";
glitterTranslate.removeDow1 = "$T('Glitter-confirmClear1Download')";
glitterTranslate.propagating = "$T('Glitter-propagating')";
glitterTranslate.encrypted = "$T('Glitter-encrypted')";
glitterTranslate.duplicate = "$T('Glitter-duplicate')";
glitterTranslate.tooLarge = "$T('Glitter-tooLarge')";

4
interfaces/Glitter/templates/static/javascripts/glitter.queue.js

@ -526,6 +526,10 @@ function QueueModel(parent, data) {
if((self.parent.parent.downloadsPaused() && self.priority() != 2) || self.pausedStatus()) {
return glitterTranslate.paused;
}
// Propagating
if(self.status() == 'Propagating') {
return glitterTranslate.propagating
}
// Just the time
return rewriteTime(self.timeLeft());
});

9
sabnzbd/api.py

@ -1351,6 +1351,7 @@ def build_queue(web_dir=None, root=None, verbose=False, prim=True, webdir='', ve
bytesleft = pnfo.bytes_left
bytes = pnfo.bytes
average_date = pnfo.avg_date
is_propagating = (pnfo.avg_stamp + float(cfg.propagation_delay() * 60)) > time.time()
status = pnfo.status
priority = pnfo.priority
mbleft = (bytesleft / MEBI)
@ -1382,7 +1383,9 @@ def build_queue(web_dir=None, root=None, verbose=False, prim=True, webdir='', ve
slot['size'] = format_bytes(bytes)
slot['sizeleft'] = format_bytes(bytesleft)
if not Downloader.do.paused and status not in (Status.PAUSED, Status.FETCHING, Status.GRABBING) and not found_active:
if status == Status.CHECKING:
if is_propagating:
slot['status'] = 'Propagating'
elif status == Status.CHECKING:
slot['status'] = Status.CHECKING
else:
slot['status'] = Status.DOWNLOADING
@ -1405,8 +1408,8 @@ def build_queue(web_dir=None, root=None, verbose=False, prim=True, webdir='', ve
slot['percentage'] = "%s" % (int(((mb - mbleft) / mb) * 100))
slot['missing'] = missing
if (Downloader.do.paused or Downloader.do.postproc or status not in (Status.DOWNLOADING, Status.QUEUED)) \
and priority != TOP_PRIORITY:
if (Downloader.do.paused or Downloader.do.postproc or is_propagating or \
status not in (Status.DOWNLOADING, Status.QUEUED)) and priority != TOP_PRIORITY:
slot['timeleft'] = '0:00:00'
slot['eta'] = 'unknown'
else:

1
sabnzbd/cfg.py

@ -145,6 +145,7 @@ backup_for_duplicates = OptionBool('misc', 'backup_for_duplicates', True)
ignore_samples = OptionNumber('misc', 'ignore_samples', 0, 0, 2)
create_group_folders = OptionBool('misc', 'create_group_folders', False)
auto_sort = OptionBool('misc', 'auto_sort', False)
propagation_delay = OptionNumber('misc', 'propagation_delay', 0)
folder_rename = OptionBool('misc', 'folder_rename', True)
folder_max_length = OptionNumber('misc', 'folder_max_length', DEF_FOLDER_MAX, 20, 65000)
pause_on_pwrar = OptionBool('misc', 'pause_on_pwrar', True)

2
sabnzbd/constants.py

@ -25,7 +25,7 @@ POSTPROC_QUEUE_VERSION = 2
REC_RAR_VERSION = 500
PNFO = namedtuple('PNFO', 'repair unpack delete script nzo_id filename password '
'unpackstrht msgid category url bytes_left bytes '
'unpackstrht msgid category url bytes_left bytes avg_stamp '
'avg_date finished_files active_files queued_files status priority missing')
QNFO = namedtuple('QNFO', 'bytes bytes_left list q_size_list q_fullsize')

2
sabnzbd/interface.py

@ -1433,7 +1433,7 @@ class ConfigFolders(object):
SWITCH_LIST = \
('par2_multicore', 'par_option', 'enable_unrar', 'enable_unzip', 'enable_filejoin',
'enable_tsjoin', 'overwrite_files', 'top_only',
'auto_sort', 'check_new_rel', 'auto_disconnect', 'flat_unpack',
'auto_sort', 'propagation_delay', 'check_new_rel', 'auto_disconnect', 'flat_unpack',
'safe_postproc', 'no_dupes', 'replace_spaces', 'replace_dots', 'replace_illegal', 'auto_browser',
'ignore_samples', 'pause_on_post_processing', 'quick_check', 'nice', 'ionice',
'pre_script', 'pause_on_pwrar', 'ampm', 'sfv_check', 'folder_rename',

42
sabnzbd/nzbqueue.py

@ -750,18 +750,14 @@ class NzbQueue(TryList):
""" Check whether there are any pending articles for the downloader """
if not self.__nzo_list:
return False
if self.__top_only:
for nzo in self.__nzo_list:
# Ignore any items that are in a paused or grabbing state
if nzo.status not in (Status.PAUSED, Status.GRABBING):
return not nzo.server_in_try_list(server)
else:
# Check if this server is allowed for any object, then return if we've tried this server.
for nzo in self.__nzo_list:
if nzo.status not in (Status.PAUSED, Status.GRABBING):
if nzo.server_allowed(server):
# Check if this server is allowed for any object, then return if we've tried this server.
for nzo in self.__nzo_list:
if nzo.status not in (Status.PAUSED, Status.GRABBING):
# Check if past propagation delay
if not cfg.propagation_delay() or (nzo.avg_stamp + float(cfg.propagation_delay() * 60)) < time.time():
if nzo.server_allowed(server) or self.__top_only:
return not self.server_in_try_list(server)
return False
return False
@synchronized(NZBQUEUE_LOCK)
def has_forced_items(self):
@ -775,27 +771,19 @@ class NzbQueue(TryList):
@synchronized(NZBQUEUE_LOCK)
def get_article(self, server, servers):
if self.__top_only:
if self.__nzo_list:
for nzo in self.__nzo_list:
# Not when queue paused and not a forced item
if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused) or nzo.priority == TOP_PRIORITY:
if nzo.server_allowed(server):
article = nzo.get_article(server, servers)
if article:
return article
else:
for nzo in self.__nzo_list:
# Not when queue paused and not a forced item
if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused) or nzo.priority == TOP_PRIORITY:
for nzo in self.__nzo_list:
# Not when queue paused and not a forced item
if (nzo.status not in (Status.PAUSED, Status.GRABBING) and not sabnzbd.downloader.Downloader.do.paused) or nzo.priority == TOP_PRIORITY:
# Check if past propagation delay
if not cfg.propagation_delay() or (nzo.avg_stamp + float(cfg.propagation_delay() * 60)) < time.time():
# Don't try to get an article if server is in try_list of nzo
if not nzo.server_in_try_list(server) and nzo.server_allowed(server):
if (not nzo.server_in_try_list(server) or self.__top_only) and nzo.server_allowed(server):
article = nzo.get_article(server, servers)
if article:
return article
# No articles for this server, block server (until reset issued)
# No articles for this server, block server (until reset issued)
if not self.__top_only:
self.add_to_try_list(server)
@synchronized(NZBQUEUE_LOCK)

2
sabnzbd/nzbstuff.py

@ -1487,7 +1487,7 @@ class NzbObject(TryList):
return PNFO(self.repair, self.unpack, self.delete, self.script,
self.nzo_id, self.final_name, self.password, {},
'', self.cat, self.url,
bytes_left_all, self.bytes, avg_date,
bytes_left_all, self.bytes, self.avg_stamp, avg_date,
finished_files, active_files, queued_files, self.status, self.priority,
len(self.nzo_info.get('missing_art_log', []))
)

3
sabnzbd/skintext.py

@ -44,6 +44,7 @@ SKIN_TEXT = {
'post-QuickCheck' : TT('Quick Check...'), #: PP status
'post-Verifying' : TT('Verifying...'), #: PP status
'post-Downloading' : TT('Downloading'), #: Pseudo-PP status, in reality used for Queue-status
'post-Propagating' : TT('Propagation delay'),
'post-Checking' : TT('Checking'), #: PP status
'sch-frequency' : TT('Frequency'), #: #: Config->Scheduler
@ -465,6 +466,8 @@ SKIN_TEXT = {
'explain-auto_disconnect' : TT('Disconnect from Usenet server(s) when queue is empty or paused.'),
'opt-auto_sort' : TT('Sort by Age'),
'explain-auto_sort' : TT('Automatically sort items by (average) age.'),
'opt-propagation_delay' : TT('Propagation delay'),
'explain-propagation_delay' : TT('Posts will be paused untill they are at least this age.'),
'opt-check_new_rel' : TT('Check for New Release'),
'explain-check_new_rel' : TT('Weekly check for new SABnzbd release.'),
'also-test' : TT('Also test releases'), #: Pick list for weekly test for new releases

Loading…
Cancel
Save