From 0930f0dceee2a360d28f3dff45a9044f64f1bd6e Mon Sep 17 00:00:00 2001 From: Safihre Date: Sat, 15 Jul 2017 12:30:24 +0200 Subject: [PATCH] Test disk-speed first time DirectUnpack is called --- po/main/SABnzbd.pot | 51 ++++++++++++++++++++++++++++------------------- sabnzbd/cfg.py | 1 + sabnzbd/directunpacker.py | 13 ++++++++++++ sabnzbd/skintext.py | 2 +- 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/po/main/SABnzbd.pot b/po/main/SABnzbd.pot index 44694bf..45702dc 100644 --- a/po/main/SABnzbd.pot +++ b/po/main/SABnzbd.pot @@ -12,7 +12,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ASCII\n" "Content-Transfer-Encoding: 7bit\n" -"POT-Creation-Date: 2017-06-26 10:38+W. Europe Daylight Time\n" +"POT-Creation-Date: 2017-07-15 13:06+W. Europe Daylight Time\n" "Generated-By: pygettext.py 1.5\n" @@ -402,11 +402,29 @@ msgid "Unknown Error while decoding %s" msgstr "" #: sabnzbd/decoder.py -msgid "%s => missing from all servers, discarding" +msgid "UUencode detected, only yEnc encoding is supported [%s]" msgstr "" #: sabnzbd/decoder.py -msgid "UUencode detected, only yEnc encoding is supported [%s]" +msgid "%s => missing from all servers, discarding" +msgstr "" + +#: sabnzbd/directunpacker.py # sabnzbd/newsunpack.py +#: sabnzbd/newsunpack.py # sabnzbd/newsunpack.py +#: sabnzbd/newsunpack.py +msgid "Unpacking" +msgstr "" + +#: sabnzbd/directunpacker.py # sabnzbd/newsunpack.py +msgid "Unpacked %s files/folders in %s" +msgstr "" + +#: sabnzbd/directunpacker.py [Warning message] +msgid "Enabled Direct Unpack:" +msgstr "" + +#: sabnzbd/directunpacker.py [Warning message] # sabnzbd/skintext.py +msgid "Jobs will start unpacking during the download, reduces post-processing time but requires capable hard drive. Only works for jobs that do not need repair." msgstr "" #: sabnzbd/dirscanner.py [Error message] # sabnzbd/dirscanner.py [Error message] @@ -748,8 +766,6 @@ msgstr "" #: sabnzbd/newsunpack.py [Warning message] # sabnzbd/newsunpack.py [Warning message] #: sabnzbd/newsunpack.py [Warning message] # sabnzbd/newsunpack.py [Warning message] #: sabnzbd/newsunpack.py [Warning message] # sabnzbd/newsunpack.py [Warning message] -#: sabnzbd/newsunpack.py [Warning message] # sabnzbd/newsunpack.py [Warning message] -#: sabnzbd/newsunpack.py [Warning message] # sabnzbd/newsunpack.py [Warning message] #: sabnzbd/newsunpack.py [Warning message] msgid "Deleting %s failed!" msgstr "" @@ -763,11 +779,6 @@ msgstr "" msgid "Unpacking failed, archive requires a password" msgstr "" -#: sabnzbd/newsunpack.py # sabnzbd/newsunpack.py -#: sabnzbd/newsunpack.py # sabnzbd/newsunpack.py -msgid "Unpacking" -msgstr "" - #: sabnzbd/newsunpack.py # sabnzbd/skintext.py [PP phase "unpack"] msgid "Unpack" msgstr "" @@ -829,10 +840,6 @@ msgstr "" msgid "Corrupt RAR file" msgstr "" -#: sabnzbd/newsunpack.py -msgid "Unpacked %s files/folders in %s" -msgstr "" - #: sabnzbd/newsunpack.py # sabnzbd/newsunpack.py msgid "%s files in %s" msgstr "" @@ -1385,10 +1392,6 @@ msgid "Download failed - Not on your server(s)" msgstr "" #: sabnzbd/postproc.py -msgid "Cannot create final folder %s" -msgstr "" - -#: sabnzbd/postproc.py msgid "No post-processing because of failed verification" msgstr "" @@ -1453,6 +1456,10 @@ msgid "Download Completed" msgstr "" #: sabnzbd/postproc.py +msgid "Cannot create final folder %s" +msgstr "" + +#: sabnzbd/postproc.py msgid "Post-processing" msgstr "" @@ -2961,6 +2968,10 @@ msgid "Automatically sort items by (average) age." msgstr "" #: sabnzbd/skintext.py +msgid "Direct Unpack" +msgstr "" + +#: sabnzbd/skintext.py msgid "Posts will be paused untill they are at least this age. Setting job priority to Force will skip the delay." msgstr "" @@ -3856,7 +3867,7 @@ msgstr "" msgid "Delete" msgstr "" -#: sabnzbd/skintext.py [Job details page, move file to top] +#: sabnzbd/skintext.py [Job details page, move file to top] # sabnzbd/skintext.py msgid "Top" msgstr "" @@ -3868,7 +3879,7 @@ msgstr "" msgid "Down" msgstr "" -#: sabnzbd/skintext.py [Job details page, move file to bottom] +#: sabnzbd/skintext.py [Job details page, move file to bottom] # sabnzbd/skintext.py msgid "Bottom" msgstr "" diff --git a/sabnzbd/cfg.py b/sabnzbd/cfg.py index b7a5f95..7e3ac5c 100644 --- a/sabnzbd/cfg.py +++ b/sabnzbd/cfg.py @@ -143,6 +143,7 @@ backup_for_duplicates = OptionBool('misc', 'backup_for_duplicates', True) ignore_samples = OptionBool('misc', 'ignore_samples', False) auto_sort = OptionBool('misc', 'auto_sort', False) direct_unpack = OptionBool('misc', 'direct_unpack', False) +direct_unpack_tested = OptionBool('misc', 'direct_unpack_tested', 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) diff --git a/sabnzbd/directunpacker.py b/sabnzbd/directunpacker.py index 6c94e50..058a569 100644 --- a/sabnzbd/directunpacker.py +++ b/sabnzbd/directunpacker.py @@ -31,6 +31,7 @@ from sabnzbd.misc import int_conv, clip_path, remove_all, globber, format_time_s from sabnzbd.encoding import unicoder from sabnzbd.newsunpack import build_command from sabnzbd.postproc import prepare_extraction_path +from sabnzbd.utils.diskspeed import diskspeedmeasure if sabnzbd.WIN32: # Load the POpen from the fixed unicode-subprocess @@ -108,6 +109,9 @@ class DirectUnpacker(threading.Thread): def add(self, nzf): """ Add jobs and start instance of DirectUnpack """ + if not cfg.direct_unpack_tested(): + test_disk_performance() + # Stop if something is wrong if not self.check_requirements(): return @@ -352,3 +356,12 @@ def abort_all(): for direct_unpacker in ACTIVE_UNPACKERS: direct_unpacker.abort() + +def test_disk_performance(): + """ Test the incomplete-dir performance and enable + Direct Unpack if good enough (> 60MB/s) + """ + if diskspeedmeasure(sabnzbd.cfg.download_dir.get_path()) > 60: + cfg.direct_unpack.set(True) + logging.warning(T('Enabled Direct Unpack:') + ' ' + T('Jobs will start unpacking during the download, reduces post-processing time but requires capable hard drive. Only works for jobs that do not need repair.')) + cfg.direct_unpack_tested.set(True) diff --git a/sabnzbd/skintext.py b/sabnzbd/skintext.py index 6107910..9139c14 100644 --- a/sabnzbd/skintext.py +++ b/sabnzbd/skintext.py @@ -454,7 +454,7 @@ SKIN_TEXT = { 'opt-auto_sort' : TT('Sort by Age'), 'explain-auto_sort' : TT('Automatically sort items by (average) age.'), 'opt-direct_unpack' : TT('Direct Unpack'), - 'explain-direct_unpack' : TT('Start unpacking during download, reduces post-processing time. Requires fast hard drive. Only works for jobs that do not need repair.'), + 'explain-direct_unpack' : TT('Jobs will start unpacking during the download, reduces post-processing time but requires capable hard drive. Only works for jobs that do not need repair.'), 'opt-propagation_delay' : TT('Propagation delay'), 'explain-propagation_delay' : TT('Posts will be paused untill they are at least this age. Setting job priority to Force will skip the delay.'), 'opt-check_new_rel' : TT('Check for New Release'),