Compare commits

...

167 Commits

Author SHA1 Message Date
Safihre
e7527c45cd Set version to 3.4.0 2021-09-17 22:01:19 +02:00
Safihre
7d5207aa67 Merge branch 'develop' 2021-09-17 20:46:31 +02:00
Safihre
d89b6f814b Update text files for 3.4.0 2021-09-17 20:41:13 +02:00
SABnzbd Automation
fad69356c1 Update translatable texts 2021-09-17 18:38:28 +00:00
Safihre
2285c6e430 Small refactor of the new content-disposition parsing 2021-09-17 20:36:34 +02:00
p0ps
c1b9b727e6 Correctly parse the filename in content-disposition header. (#1946)
* Implement regex to match the filename in the content-disposition header.

The following srings will match:
filename=Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb; filename*=UTF-8''Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb
filename=Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb;
filename*=UTF-8''Zombie.Land.Saga.Revenge.S02E12.480p.x264-mSD.nzb

* Missed quote

* Implement the mailbox/Message solution
* Add basic tests

* Add `attachment;`

* Add example with attachment.

* Fix some linting.
* Added edge case tests.

* Added comment.

* Added test to include path elements.

* Only try the content-disposition header when it has `filename` in it

* Project uses double quotes.

* Update test.
* Add `attachment;`

* black formatter

* remove release names.

* trailing commas

* quote enclosures
2021-09-11 22:56:17 +02:00
Safihre
a95714710b Un-pin version of PyInstaller 2021-09-08 09:12:18 +02:00
Safihre
82268b58e2 Update Python build version to 3.9.7 2021-09-01 23:45:30 +02:00
Safihre
0dd7e71fd1 Update text files for 3.4.0 RC 1 2021-09-01 23:35:26 +02:00
Safihre
63f1d2905f Correct reference to Sorter vs BaseSorter
Closes #1941
2021-08-14 09:35:50 +02:00
SABnzbd Automation
ea9b409a04 Update translatable texts 2021-08-13 10:11:22 +00:00
Safihre
8957a8421d Update text files for 3.4.0 Beta 2 2021-08-13 12:10:42 +02:00
SABnzbd Automation
7c171081c6 Update translatable texts 2021-08-13 07:50:29 +00:00
Safihre
e4520e9e16 Prevent crashing Assembler from missing saved_articles
Closes #1933
2021-08-13 09:49:41 +02:00
SABnzbd Automation
336c373dd0 Update translatable texts 2021-08-02 13:05:22 +00:00
Safihre
fc721f31c5 Only run recover_par2_names if all_ok 2021-08-02 15:04:31 +02:00
Safihre
062ed9f7b8 decode_par2 should return a list
Yeah Typing
2021-08-01 17:10:18 +02:00
SABnzbd Automation
59a915cdac Update translatable texts 2021-08-01 14:43:07 +00:00
Safihre
191f7d2152 Warning instead of Info when we restart due to crashed threads
Closes #1936
2021-08-01 16:42:09 +02:00
puzzledsab
a76e9c2c1f Always deobfuscate names from par2 (#1935)
* Always deobfuscate names from par2

* Different par2 test

* Different par2 test take 2

* Make par2 filename decoding optional and add some typing

* Rename variable
2021-07-30 16:01:30 +02:00
SABnzbd Automation
9d616459b7 Update translatable texts 2021-07-28 12:32:51 +00:00
Safihre
82fa42d182 Correct sorting test 2021-07-28 14:26:08 +02:00
Safihre
0c36aaa5ff nzo.correct_password was not always defined
Closes #1932
2021-07-25 17:35:44 +02:00
Safihre
a9761464a0 Only run Direct Unpack if enable_unrar=1 2021-07-25 10:28:55 +02:00
Safihre
355d02faa3 Sorting would always update final path even if disabled 2021-07-25 09:58:13 +02:00
jcfp
1052f37d02 create a record for the successful password (#1919)
* create a record for the successful password

* make get_all_passwords not return all, expand nzo.correct_password to directunpacker
2021-07-23 14:35:00 +02:00
Safihre
654302e691 Set version to 3.3.1 2021-06-18 13:52:58 +02:00
Safihre
ee673b57fd Merge branch '3.3.x' 2021-06-18 13:51:48 +02:00
Safihre
2be374b841 Update text files for 3.3.1 2021-06-18 13:51:33 +02:00
puzzledsab
906e1eda89 Keep password order 2021-06-13 16:21:41 +02:00
Safihre
ece02cc4fa Automatically publish release when all files are present 2021-06-11 17:39:30 +02:00
Safihre
876ad60ddf Update text files for 3.3.1RC1 2021-06-11 14:59:25 +02:00
Safihre
862da354ac Add direct opening of tabs by URL to Glitter tab-layout 2021-06-11 14:28:31 +02:00
Safihre
8fd477b979 Include wiki URL in Internal internet access denied message 2021-06-05 15:56:20 +02:00
Safihre
2d7005655c Clean timeline_total of BPSMeter
Received multiple reports that somehow it could get corrupt values in there
2021-06-05 15:56:16 +02:00
Safihre
7322f8348a Filtering active post-proc queue by category was broken 2021-06-05 15:56:09 +02:00
Safihre
e3e3a12e73 Correct example in test_name_extractor 2021-06-05 15:56:04 +02:00
Safihre
77cdd057a4 Filenames should end after the extension 2021-06-01 11:19:49 +02:00
Safihre
e8206fbdd9 Set version to 3.3.0 2021-06-01 07:35:13 +02:00
Jiri van Bergen
589f15a77b Merge branch '3.3.x' 2021-06-01 07:34:59 +02:00
Safihre
7bb443678a Build release when creating the tag 2021-06-01 07:18:41 +02:00
Safihre
6390415101 Update text files for 3.3.0 2021-06-01 07:16:42 +02:00
Sander
4abf192e11 deobfuscate: bugfix for collections if extension in CAPITALS (#1904) 2021-06-01 07:06:21 +02:00
Safihre
1fed37f9da Notify users that Plush will be removed in 3.4.0
Relates to #1902
2021-05-25 09:28:10 +02:00
Safihre
a9d86a7447 Set version to 3.2.1 2021-03-31 10:24:42 +02:00
Safihre
2abe4c3cef Merge branch '3.2.x' 2021-03-31 09:25:49 +02:00
Safihre
0542c25003 Update text files for 3.2.1
draft release
2021-03-31 09:24:31 +02:00
puzzledsab
1b8ee4e290 Show server expiration date in server summary (#1841) 2021-03-31 08:57:38 +02:00
Safihre
51128cba55 Do not notify warning/errors from same source twice
Closes #1842
2021-03-30 17:30:07 +02:00
Safihre
3612432581 Do not discard data for CrcError's
https://forums.sabnzbd.org/viewtopic.php?f=11&t=25278
2021-03-30 16:05:04 +02:00
Safihre
deca000a1b Revert some improvements to the encrypted RAR-detection
Closes #1840
2021-03-29 14:05:52 +02:00
Safihre
39cccb5653 Update text files for 3.2.1RC2
draft release
2021-03-24 10:13:43 +01:00
Safihre
f6838dc985 Improvements to the encrypted RAR-detection 2021-03-20 18:32:11 +01:00
Safihre
8cd4d92395 Make get_all_passwords return only unique passwords
If the filename and the NZB specified the same one it could occur 2 or 3 times.
2021-03-20 18:32:05 +01:00
Safihre
3bf9906f45 Update text files for 3.2.1RC1
draft release
2021-03-18 10:30:05 +01:00
Safihre
9f7daf96ef Update URL for Python 3 information 2021-03-18 09:10:39 +01:00
Sander
67de4df155 deobfuscate: no globber, but use given filelist (#1830) 2021-03-18 09:10:31 +01:00
Safihre
bc51a4bd1c Remove old compatibility code from BPSMeter that causes crash on startup
Closes #1827
2021-03-18 09:10:23 +01:00
Sander
bb54616018 deobfuscate: rename accompanying (smaller) files with same basename, and no renaming of collections with same extension (#1826)
* deobfuscate: rename accompanying (smaller) files with same basename

* deobfuscate: do not rename collections of same extension

* deobfuscate: collection ... much easier with one loop, thanks safihre.

* deobfuscate: globber_full, and cleanup

* deobfuscate: unittest test_deobfuscate_big_file_small_accompanying_files

* deobfuscate: unittest test_deobfuscate_collection_with_same_extension

* deobfuscate: unittest test_deobfuscate_collection_with_same_extension
2021-03-18 09:10:18 +01:00
Safihre
6bcff5e014 More space for the RSS table
Closes #1824
2021-03-18 09:10:09 +01:00
puzzledsab
8970a03a9a Use binary mode to make write test more accurate on Windows (#1815) 2021-03-10 22:23:10 +01:00
Safihre
3ad717ca35 Single indexer categories would be saved with "," between each letter 2021-03-10 22:23:10 +01:00
jcfp
b14f72c67a fix config auto_sort setting, broken by #1666 (#1813)
* fix config auto_sort setting, broken by #1666

* oops I did it again
2021-03-10 22:23:10 +01:00
Safihre
45d036804f Show name of item to be deleted from queue/history in confirm dialog 2021-03-10 22:23:10 +01:00
Safihre
8f606db233 Add traceback when failing to read the password file
Closes #1810
2021-03-10 22:23:10 +01:00
Safihre
3766ba5402 pre-create subdir if needed (POSIX, par2) (#1802)
* pre-create subdir it needed

* pre-create subdir it needed: check if already exists

* use os.makedirs() to handle subdir1/subdir2/blabla

* protect against malicous "..", and better naming

* check for Windows \ and POSIX /

* check again within path, typo and formatting

* regex: square brackets

* cleanup: only "/" can occur in par2

* cleanup: better logging

* unit test: testing of filesystem.renamer()

* if subdir specified in par2: let filesystem.renamer() do all the work

* if create_local_directories=True, then renamer() must stay within specified directory. Plus unittest for that.

* if create_local_directories=True, then renamer() must stay within specified directory. Plus unittest for that.

* more comments in code

* use filesystem.create_all_dirs(), less logging, clearer "..", and other feedback from Safihre

* make remote black happy too

* Small changes in wording of comments and error

Co-authored-by: Safihre <safihre@sabnzbd.org>
2021-03-10 22:23:10 +01:00
jxyzn
e851813cef Sanitize names possibly derived from X-DNZB-EpisodeName (#1806) 2021-03-10 22:15:23 +01:00
thezoggy
4d49ad9141 3.2.x cleanup (#1808)
* Update uni_config bootstrap css to same version of js (3.3.7).
* small accessibility change, removed thin dot border on focus

* Ignore VS Code settings folder

* cherry picked 'Fix disabled select for Glitter Night'

* glitter night - fix search border color
2021-02-27 14:47:44 +01:00
Safihre
16618b3af2 Set version to 3.2.0 2021-02-26 10:30:00 +01:00
Safihre
0e5c0f664f Merge branch '3.2.x' 2021-02-26 10:29:39 +01:00
Safihre
7be9281431 Update text files for 3.2.0
draft release
2021-02-26 09:56:47 +01:00
Safihre
ee0327fac1 Update macOS build Python to 3.9.2 2021-02-26 09:44:51 +01:00
Safihre
9930de3e7f Log all nzo_info when adding NZB's
Relates to #1806
2021-02-26 09:18:14 +01:00
Sander
e8503e89c6 handle gracefully if no malloc_trim() available (#1800) 2021-02-26 09:18:00 +01:00
puzzledsab
1d9ed419eb Remove some redundant ifs (#1791) 2021-02-26 09:17:29 +01:00
Safihre
0207652e3e Update text files for 3.2.0RC2
draft release
2021-02-08 21:02:38 +01:00
Safihre
0f1e99c5cb Update translatable texts 2021-02-08 13:29:16 +01:00
puzzledsab
f134bc7efb Right-to-Left support for Glitter and Config (#1776)
* Add rtl on main page

* Adjustments to rtl

* Forgot to add black check for this checkout

* Remove unnecessary style

* Remove more redundant attributes

* Some more reordering and alignment

* Align sorting and nzb drop downs

* Update NZB details and shutdown page

* Fix format

* Fix SABnzbd Config title tag

* Change file list header direction

* Set rtl variables in build_header instead and test dir="rtl" in config pages

* Revert some changes and handle styling using CSS

* Move more items to CSS

* Config RTL

* Move even more to CSS

* Small tweak

Co-authored-by: Safihre <safihre@sabnzbd.org>
2021-02-08 13:23:03 +01:00
puzzledsab
dcd7c7180e Do full server check when there are busy_threads (#1786)
* Do full server check when there are busy_threads

* Reduce next_article_search delay to 0.5s
2021-02-08 13:19:38 +01:00
jcfp
fbbfcd075b fix bonjour with localhost, retire LOCALHOSTS constant (#1782)
* fix bonjour with localhost, retire LOCALHOSTS constant

* rename probablyipv[46] functions to is_ipv[46]_addr

* refuse to send ssdp description_xml to outsiders
2021-02-08 13:19:30 +01:00
Safihre
f42d2e4140 Rename Glitter Default to Light and make Auto the new Default 2021-02-05 15:01:28 +01:00
Sam Edwards
88882cebbc Support for auto night mode switching in Glitter (#1783) 2021-02-05 15:01:13 +01:00
Safihre
17a979675c Do not re-release from GA when the release tag is pushed 2021-02-05 15:01:04 +01:00
Safihre
4642850c79 Set macOS Python installer target to "/" 2021-02-05 15:01:00 +01:00
Safihre
e8d6eebb04 Set version to 3.1.1 2020-11-11 22:04:44 +01:00
Safihre
864c5160c0 Merge branch '3.1.x' 2020-11-11 22:01:20 +01:00
Safihre
99b5a00c12 Update text files for 3.1.1 2020-11-11 21:56:15 +01:00
Safihre
85ee1f07d7 Do not crash if we cannot format the error message 2020-11-08 15:06:50 +01:00
exizak42
e58b4394e0 Separate email message lines are with CRLF (#1671)
SMTP protocol dictates that all lines are supposed to be separated
with CRLF and not LF (even on LF-based systems). This change ensures
that even if the original byte string message is using `\n` for line
separators, the SMTP protocol will still work properly.

This resolves sabnzbd#1669

Fix code formatting
2020-11-08 14:44:44 +01:00
Safihre
1e91a57bf1 It was not possible to set directory-settings to empty values 2020-11-06 16:14:53 +01:00
Safihre
39cee52a7e Update text files for 3.1.1RC1 2020-11-02 20:03:43 +01:00
Safihre
72068f939d Improve handling of binary restarts (macOS / Windows) 2020-11-02 19:57:57 +01:00
Safihre
096d0d3cad Deobfuscate-during-download did not work
https://forums.sabnzbd.org/viewtopic.php?f=3&t=25037
2020-11-01 15:35:09 +01:00
Safihre
2472ab0121 Python 3.5 does not know ssl.PROTOCOL_TLS_SERVER
Closes #1658
2020-10-27 15:52:28 +01:00
Safihre
00421717b8 Queue Repair would fail if Rating is enabled
Closes #1649
2020-10-24 11:10:03 +02:00
Safihre
ae96d93f94 Set version to 3.1.0 2020-10-16 17:02:28 +02:00
Safihre
8522c40c8f Merge branch '3.1.x' 2020-10-16 16:58:58 +02:00
Safihre
23f86e95f1 Update text files for 3.1.0 2020-10-16 16:42:35 +02:00
Safihre
eed2045189 After pre-check the job was not restored to the original spot 2020-10-16 16:27:51 +02:00
Safihre
217785bf0f Applying Filters to a feed would result in crash
Closes #1634
2020-10-15 18:07:06 +02:00
Safihre
6aef50dc5d Update text files for 3.1.0RC3 2020-10-02 11:34:21 +02:00
Safihre
16b6e3caa7 Notify users of Deobfuscate.py that it is now part of SABnzbd 2020-09-29 14:08:51 +02:00
Safihre
3de4c99a8a Only set the "Waiting" status when the job hits post-processing
https://forums.sabnzbd.org/viewtopic.php?f=11&t=24969
2020-09-29 13:51:15 +02:00
Safihre
980aa19a75 Only run Windows Service code when executed from the executables
Could be made to work with the from-sources code.. But seems like very small usecase.
Closes #1623
2020-09-29 10:42:23 +02:00
Safihre
fb4b57e056 Update text files for 3.1.0RC2 2020-09-27 17:19:34 +02:00
Safihre
03638365ea Set execute bit on Deobfuscate.py 2020-09-27 17:17:30 +02:00
Safihre
157cb1c83d Handle failing RSS-feeds for feedparser 6.0.0+
Closes #1621
Now throws warnings (that can be disabled, helpfull_warnings) if readout failed.
2020-09-27 13:32:38 +02:00
Safihre
e51f11c2b1 Do not crash if attributes file is not present 2020-09-25 10:50:19 +02:00
Safihre
1ad0961dd8 Existing files were not parsed when re-adding a job 2020-09-25 10:49:50 +02:00
Safihre
46ff7dd4e2 Do not crash if we can't save attributes, the job might be gone 2020-09-25 10:03:05 +02:00
Safihre
8b067df914 Correctly parse failed_only for Plush 2020-09-23 16:56:57 +02:00
Safihre
ef43b13272 Assume RarFile parses the correct filepaths for the RAR-volumes
Parsing UTF8 from command-line still fails.
https://forums.sabnzbd.org/viewtopic.php?p=122267#p122267
2020-09-21 22:12:43 +02:00
Safihre
e8e9974224 work_name would not be sanatized when adding NZB's
Closes #1615
Now with tests, yeah.
2020-09-21 22:12:34 +02:00
Safihre
feebbb9f04 Merge branch '3.0.x' 2020-09-13 16:40:43 +02:00
Safihre
bc4f06dd1d Limit feedparser<6.0.0 for 3.0.x 2020-09-13 16:40:14 +02:00
Safihre
971e4fc909 Merge branch '3.0.x' 2020-08-30 20:58:31 +02:00
Safihre
51cc765949 Update text files for 3.0.2 2020-08-30 20:50:45 +02:00
Safihre
19c6a4fffa Propagation delay label was shown even if no delay was activated 2020-08-29 16:46:16 +02:00
Safihre
105ac32d2f Reading RSS feed with no categories set could result in crash
Closes #1589
2020-08-28 10:16:49 +02:00
Safihre
57550675d2 Removed logging in macOS sabApp that resulted in double logging 2020-08-28 10:16:41 +02:00
Safihre
e674abc5c0 Update text files for 3.0.2RC2 2020-08-26 08:56:29 +02:00
Safihre
f965c96f51 Change the macOS power assertion to NoIdleSleep 2020-08-26 08:50:54 +02:00
Safihre
c76b8ed9e0 End-of-queue-script did not run on Windows due to long-path
https://forums.sabnzbd.org/viewtopic.php?f=3&t=24918

Will refactor this so they all call 1 function.
2020-08-24 11:28:14 +02:00
Safihre
4fbd0d8a7b Check if name is a string before switching to nzbfile in addfile
Closes #1584
2020-08-24 09:05:25 +02:00
Safihre
2186c0fff6 Update text files for 3.0.2 RC 1 2020-08-21 15:42:35 +02:00
Safihre
1adca9a9c1 Do not crash if certifi certificates are not available
This could happen on Windows, due to overactive virus scanners
2020-08-21 15:26:06 +02:00
Safihre
9408353f2b Priority was not parsed correctly if supplied as string 2020-08-21 15:12:09 +02:00
Safihre
84f4d453d2 Permissions would be set even if user didn't set any
Windows developers like me shouldn't do permissions stuff..
2020-08-21 15:12:01 +02:00
Safihre
d10209f2a1 Extend tests of create_all_dirs to cover apply_umask=False 2020-08-21 15:11:53 +02:00
Safihre
3ae149c72f Split the make_mo.py command for NSIS 2020-08-19 22:21:02 +02:00
Safihre
47385acc3b Make sure we force the final_name to string on legacy get_attrib_file 2020-08-19 16:21:13 +02:00
Safihre
814eeaa900 Redesigned the saving of attributes
Now uses pickle, so that the type of the property is preserved.
Made flexible, so that more properties can be easily added later.
Closes #1575
2020-08-19 16:21:07 +02:00
Safihre
5f2ea13aad NzbFile comparison could crash when comparing finished_files
https://forums.sabnzbd.org/viewtopic.php?f=3&t=24902&p=121748
2020-08-19 08:50:06 +02:00
Safihre
41ca217931 Merge branch '3.0.x' 2020-08-18 11:05:50 +02:00
Safihre
b57d36e8dd Set version information to 3.0.1 2020-08-18 11:05:36 +02:00
Safihre
9a4be70734 List Cheetah minimal version in requirements.txt 2020-08-18 08:21:20 +02:00
Safihre
a8443595a6 Generalize use of certifi module 2020-08-18 08:20:47 +02:00
Safihre
fd0a70ac58 Update text files for 3.0.1 2020-08-17 16:52:23 +02:00
Safihre
8a8685c968 Permissions should only be applied if requested
Corrects 050b925f7b
2020-08-16 18:28:39 +02:00
Safihre
9e6cb8da8e Temporarily set cheroot version due to it breaking our tests
cherrypy/cheroot/issues/312
2020-08-16 18:28:13 +02:00
Safihre
054ec54d51 Basic authentication option was broken
Closes #1571
2020-08-10 15:34:01 +02:00
Safihre
272ce773cb Update text files for 3.0.1RC1 2020-08-07 15:28:11 +02:00
Safihre
050b925f7b Permissions were not set correctly when creating directories (#1568)
Restores changes made in d2e0ebe
2020-08-07 15:22:53 +02:00
Safihre
0087940898 Merge branch '3.0.x' into master 2020-08-02 09:46:41 +02:00
Safihre
e323c014f9 Set version information to 3.0.0 2020-08-01 16:17:08 +02:00
Safihre
cc465c7554 Update text files for 3.0.0
🎉🎉
2020-08-01 15:59:30 +02:00
Safihre
14cb37564f Update translate-link in SABnzbd 2020-07-19 13:01:39 +02:00
Safihre
094db56c3b Default-text for Automatically sort queue 2020-07-16 22:29:02 +02:00
Safihre
aabb709b8b Update text files for 3.0.0 RC 2 2020-07-15 14:10:35 +02:00
Safihre
0833dd2db9 Update translatable texts in 3.0.x branch 2020-07-15 14:07:21 +02:00
Safihre
cd3f912be4 RAR-renamer should be run on badly named RAR-files
https://forums.sabnzbd.org/viewtopic.php?f=2&t=24514&p=121433
2020-07-15 14:01:48 +02:00
Safihre
665c516db6 Only really run pre-script when it is set 2020-07-12 14:20:18 +02:00
Safihre
b670da9fa0 Always use Default-priority when creating NZB-objects
Closes #1552
2020-07-12 14:03:07 +02:00
Safihre
80bee9bffe Search-icon would be shown on top of drop-downs
Closes #1545
2020-06-30 12:57:28 +02:00
Safihre
d85a70e8ad Always report API paused status as a boolean
Closes #1542
2020-06-30 10:26:34 +02:00
Safihre
8f21533e76 Set version to 2.3.9 2019-05-24 11:39:14 +02:00
Safihre
89996482a1 Merge branch '2.3.x' 2019-05-24 09:33:12 +02:00
Safihre
03c10dce91 Update text files for 2.3.9 2019-05-24 09:32:34 +02:00
Safihre
bd5331be05 Merge branch 'develop' into 2.3.x 2019-05-24 09:12:02 +02:00
Safihre
46e1645289 Correct typo in release notes 2019-05-18 10:56:39 +02:00
Safihre
4ce3965747 Update text files for 2.3.9RC2 2019-05-18 09:56:05 +02:00
Safihre
9d4af19db3 Merge branch 'develop' into 2.3.x 2019-05-18 09:45:20 +02:00
Safihre
48e034f4be Update text files for 2.3.9RC1 2019-05-07 13:50:20 +02:00
Safihre
f8959baa2f Revert "Notify develop-users that we will switch to Python 3"
This reverts commit fb238af7de.
2019-05-07 13:35:13 +02:00
Safihre
8ed5997eae Merge branch 'develop' into 2.3.x 2019-05-07 13:10:10 +02:00
Safihre
daf9f50ac8 Set version to 2.3.8 2019-03-18 11:10:56 +01:00
Safihre
6b11013c1a Merge branch '2.3.x' 2019-03-18 11:09:35 +01:00
41 changed files with 635 additions and 183 deletions

View File

@@ -73,7 +73,7 @@ jobs:
# We need the official Python, because the GA ones only support newer macOS versions
# The deployment target is picked up by the Python build tools automatically
# If updated, make sure to also set LSMinimumSystemVersion in SABnzbd.spec
PYTHON_VERSION: 3.9.5
PYTHON_VERSION: 3.9.7
MACOSX_DEPLOYMENT_TARGET: 10.9
steps:
- uses: actions/checkout@v2

View File

@@ -1,7 +1,7 @@
Metadata-Version: 1.0
Name: SABnzbd
Version: 3.4.0Beta1
Summary: SABnzbd-3.4.0Beta1
Version: 3.4.0
Summary: SABnzbd-3.4.0
Home-page: https://sabnzbd.org
Author: The SABnzbd Team
Author-email: team@sabnzbd.org

View File

@@ -1,4 +1,4 @@
Release Notes - SABnzbd 3.4.0 Beta 1
Release Notes - SABnzbd 3.4.0
=========================================================
## Changes since 3.3.1
@@ -7,13 +7,19 @@ Release Notes - SABnzbd 3.4.0 Beta 1
not present or meaningless.
- Added additional pattern keys that can be used in the `Sort String`
for Sorting, by using the `guessit` package internally for parsing.
- If unpacked files contain `.par2` files they will always be read and
used to rename any matching files.
- Regular expressions can be used to specify `Unwanted extensions`.
- Not all passwords will be tried if a matching one was found.
- Some interface-only options were added as API-call.
- The Plush skin has been removed.
## Bugfixes since 3.3.1
- Duplicate check based on `.nzb` MD5 was performed before it was calculated.
- Enforce `local_ranges` for broadcasts (Bonjour/SSDP).
- Correctly parse the filename in `Content-Disposition` header.
- `Warning` instead of `Info` when there is a restart due to crashed thread.
- Only run Direct Unpack if `enable_unrar` is enabled.
## Upgrade notices
- The download statistics file `totals10.sab` is updated in 3.2.x

View File

@@ -1,5 +1,5 @@
# Basic build requirements
pyinstaller==4.2
pyinstaller
setuptools
pkginfo
certifi

View File

@@ -153,6 +153,26 @@ msgstr ""
msgid "Loading %s failed"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -166,6 +166,26 @@ msgstr "Chyba v tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Načítání %s selhalo"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -169,6 +169,26 @@ msgstr "Fejl i tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Downloadning af %s mislykkedes"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -8,12 +8,13 @@
# reloxx13 <reloxx@interia.pl>, 2021
# Ben Hecht <benjamin.hecht@me.com>, 2021
# Safihre <safihre@sabnzbd.org>, 2021
# Manuel C. Senn, 2021
#
msgid ""
msgstr ""
"Project-Id-Version: SABnzbd-develop\n"
"PO-Revision-Date: 2020-06-27 15:49+0000\n"
"Last-Translator: Safihre <safihre@sabnzbd.org>, 2021\n"
"Last-Translator: Manuel C. Senn, 2021\n"
"Language-Team: German (https://www.transifex.com/sabnzbd/teams/111101/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -178,6 +179,26 @@ msgstr "Fehler in tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Fehler beim Laden von %s"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr "Neustart aufgrund eines abgestürzten Postprocessors"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr "Neustart aufgrund eines abgestürzten Downloaders"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr "Neustart aufgrund eines abgestürzten Dekoders"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr "Neustart aufgrund eines abgestürzten Assemblers"
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"
@@ -1667,7 +1688,7 @@ msgstr "RAR-Datei konnten nicht überprüft werden"
#: sabnzbd/postproc.py
msgid "Trying RAR renamer"
msgstr ""
msgstr "Versuche RAR Umbenenner"
#. Warning message
#: sabnzbd/postproc.py
@@ -3585,6 +3606,8 @@ msgid ""
"Select a mode and list all (un)wanted extensions. For example: <b>exe</b> or"
" <b>exe, com</b>"
msgstr ""
"Modus auswählen, und alle (nicht-)erwünschten Erweiterungen auflisten. Zum "
"Beispiel : <b>exe</b> oder <b>exe, com</b>"
#: sabnzbd/skintext.py
msgid "Enable SFV-based checks"
@@ -3780,6 +3803,9 @@ msgid ""
"Additionally, attempts to set the correct file extension based on the file "
"signature if the extension is not present or meaningless."
msgstr ""
"Zusätzlich wird versucht die korrekte Dateierweiterung mithilfe der "
"Dateisignatur zu ermitteln, falls noch keine Dateierweiterung vorhanden, "
"oder sie sinnlos sein sollte."
#: sabnzbd/skintext.py
msgid "HTTPS certificate verification"
@@ -3994,11 +4020,11 @@ msgstr "Zeitüberschreitung"
#: sabnzbd/skintext.py
msgid "Account expiration date"
msgstr ""
msgstr "Account Ablaufdatum"
#: sabnzbd/skintext.py
msgid "Warn 5 days in advance of account expiration date."
msgstr ""
msgstr "5 Tage vor dem Ablauf des Accounts warnen."
#: sabnzbd/skintext.py
msgid ""

View File

@@ -177,6 +177,26 @@ msgstr "Fallo en tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Cargar de %s no se pudo completar."
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -170,6 +170,26 @@ msgstr "Virhe tiedostossa tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Kohteen %s lataaminen epäonnistui"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -178,6 +178,26 @@ msgstr "Échec dans tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Echec du chargement de %s"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr "Redémarrage suite au plantage du postprocesseur"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr "Redémarrage suite au plantage du téléchargeur"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr "Redémarrage suite au plantage du décodeur"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr "Redémarrage suite au plantage de l'assembleur"
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -165,6 +165,26 @@ msgstr "כישלון ב־tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "טעינת %s נכשלה"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr "מפעיל מחדש בגלל בתר־מעבד שקרס"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr "מפעיל מחדש בגלל מורידן שקרס"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr "מפעיל מחדש בגלל מפענח קוד שקרס"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr "מפעיל מחדש בגלל אסמבלר שקרס"
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"
@@ -4604,23 +4624,23 @@ msgstr "תוצאה מעובדת"
#: sabnzbd/skintext.py
msgid "Any property"
msgstr ""
msgstr "קניין כלשהו"
#: sabnzbd/skintext.py
msgid "property"
msgstr ""
msgstr "קניין"
#: sabnzbd/skintext.py
msgid "GuessIt Property"
msgstr ""
msgstr "קניין GuessIt"
#: sabnzbd/skintext.py
msgid "GuessIt.Property"
msgstr ""
msgstr "GuessIt.Property"
#: sabnzbd/skintext.py
msgid "GuessIt_Property"
msgstr ""
msgstr "GuessIt_Property"
#: sabnzbd/skintext.py
msgid ""

View File

@@ -167,6 +167,26 @@ msgstr "Feil i tempfil.mkstemp"
msgid "Loading %s failed"
msgstr "Lasting av %s mislyktes"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -171,6 +171,26 @@ msgstr "Probleem met tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Inlezen van %s mislukt"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr "SABnzbd wordt herstart omdat de postprocessor is gecrasht"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr "SABnzbd wordt herstart omdat de downloader is gecrasht"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr "SABnzbd wordt herstart omdat de decoder is gecrasht"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr "SABnzbd wordt herstart omdat de assembler is gecrasht"
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"
@@ -671,7 +691,7 @@ msgstr "Inloggen mislukt, controleer gebruikersnaam en wachtwoord."
#. Warning message
#: sabnzbd/interface.py
msgid "Unsuccessful login attempt from %s"
msgstr "Mislukte login progin bij %s"
msgstr "Mislukte login poging van %s"
#: sabnzbd/interface.py
msgid ""
@@ -3736,6 +3756,9 @@ msgid ""
"Additionally, attempts to set the correct file extension based on the file "
"signature if the extension is not present or meaningless."
msgstr ""
"Als de bestandsextensie van een bestand ontbreekt of verhaspelt is, zal er "
"geprobeerd worden de correcte extensie te vinden op basis van de inhoud van "
"het bestand."
#: sabnzbd/skintext.py
msgid "HTTPS certificate verification"
@@ -4693,23 +4716,23 @@ msgstr "Bewerkt resultaat"
#: sabnzbd/skintext.py
msgid "Any property"
msgstr ""
msgstr "Alle eigenschappen"
#: sabnzbd/skintext.py
msgid "property"
msgstr ""
msgstr "eigenschap"
#: sabnzbd/skintext.py
msgid "GuessIt Property"
msgstr ""
msgstr "GuessIt eigenschap"
#: sabnzbd/skintext.py
msgid "GuessIt.Property"
msgstr ""
msgstr "GuessIt.Eigenschap"
#: sabnzbd/skintext.py
msgid "GuessIt_Property"
msgstr ""
msgstr "GuessIt_Eigenschap"
#: sabnzbd/skintext.py
msgid ""

View File

@@ -162,6 +162,26 @@ msgstr "Błąd w tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Nie udało się wczytać %s"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -166,6 +166,26 @@ msgstr "Falha em tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Falha ao carregar %s"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -172,6 +172,26 @@ msgstr "Eroare în tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Încărcarea %s nereuşită"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -166,6 +166,26 @@ msgstr "Ошибка в tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Ошибка загрузки %s"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -164,6 +164,26 @@ msgstr "Грешка у tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Učitavanje %s neuspešno"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -164,6 +164,26 @@ msgstr "Fel i tempfile.mkstemp"
msgid "Loading %s failed"
msgstr "Laddning av %s misslyckades"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -162,6 +162,26 @@ msgstr "tempfile.mkstemp 出错"
msgid "Loading %s failed"
msgstr "加载 %s 失败"
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed postprocessor"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed downloader"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed decoder"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Restarting because of crashed assembler"
msgstr ""
#. Warning message
#: sabnzbd/__init__.py
msgid "Cannot access PID file %s"

View File

@@ -1000,16 +1000,16 @@ def check_all_tasks():
# Non-restartable threads, require program restart
if not sabnzbd.PostProcessor.is_alive():
logging.info("Restarting because of crashed postprocessor")
logging.warning(T("Restarting because of crashed postprocessor"))
return False
if not sabnzbd.Downloader.is_alive():
logging.info("Restarting because of crashed downloader")
logging.warning(T("Restarting because of crashed downloader"))
return False
if not sabnzbd.Decoder.is_alive():
logging.info("Restarting because of crashed decoder")
logging.warning(T("Restarting because of crashed decoder"))
return False
if not sabnzbd.Assembler.is_alive():
logging.info("Restarting because of crashed assembler")
logging.warning(T("Restarting because of crashed assembler"))
return False
# Kick the downloader, in case it missed the semaphore

View File

@@ -355,9 +355,8 @@ def check_encrypted_and_unwanted_files(nzo: NzbObject, filepath: str) -> Tuple[b
# Did any work?
if password_hit:
# We always trust the user's input
if not nzo.password:
nzo.password = password_hit
# Record the successful password
nzo.correct_password = password_hit
# Don't check other files
logging.info('Password "%s" matches for job "%s"', password_hit, nzo.final_name)
nzo.encrypted = -1

View File

@@ -190,6 +190,7 @@ replace_spaces = OptionBool("misc", "replace_spaces", False)
replace_dots = OptionBool("misc", "replace_dots", False)
safe_postproc = OptionBool("misc", "safe_postproc", True)
pause_on_post_processing = OptionBool("misc", "pause_on_post_processing", False)
enable_all_par = OptionBool("misc", "enable_all_par", False)
sanitize_safe = OptionBool("misc", "sanitize_safe", False)
cleanup_list = OptionList("misc", "cleanup_list")
unwanted_extensions = OptionList("misc", "unwanted_extensions")
@@ -199,6 +200,7 @@ new_nzb_on_failure = OptionBool("misc", "new_nzb_on_failure", False)
history_retention = OptionStr("misc", "history_retention", "0")
enable_meta = OptionBool("misc", "enable_meta", True)
quota_size = OptionStr("misc", "quota_size")
quota_day = OptionStr("misc", "quota_day")
quota_resume = OptionBool("misc", "quota_resume", False)
@@ -258,8 +260,8 @@ rss_rate = OptionNumber("misc", "rss_rate", 60, 15, 24 * 60)
ampm = OptionBool("misc", "ampm", False)
replace_illegal = OptionBool("misc", "replace_illegal", True)
start_paused = OptionBool("misc", "start_paused", False)
enable_all_par = OptionBool("misc", "enable_all_par", False)
enable_par_cleanup = OptionBool("misc", "enable_par_cleanup", True)
process_unpacked_par2 = OptionBool("misc", "process_unpacked_par2", True)
enable_unrar = OptionBool("misc", "enable_unrar", True)
enable_unzip = OptionBool("misc", "enable_unzip", True)
enable_7zip = OptionBool("misc", "enable_7zip", True)

View File

@@ -504,7 +504,7 @@ def build_history_info(nzo, workdir_complete="", postproc_time=0, script_output=
nzo.bytes_downloaded,
series,
nzo.md5sum,
nzo.password,
nzo.correct_password,
)

54
sabnzbd/deobfuscate_filenames.py Normal file → Executable file
View File

@@ -36,18 +36,19 @@ import re
from sabnzbd.filesystem import get_unique_filename, renamer, get_ext
from sabnzbd.par2file import is_parfile, parse_par2_file
import sabnzbd.utils.file_extension as file_extension
from typing import List
# Files to exclude and minimal file size for renaming
EXCLUDED_FILE_EXTS = (".vob", ".rar", ".par2", ".mts", ".m2ts", ".cpi", ".clpi", ".mpl", ".mpls", ".bdm", ".bdmv")
MIN_FILE_SIZE = 10 * 1024 * 1024
def decode_par2(parfile):
def decode_par2(parfile: str) -> List[str]:
"""Parse a par2 file and rename files listed in the par2 to their real name. Resturn list of generated files"""
# Check if really a par2 file
if not is_parfile(parfile):
logging.info("Par2 file %s was not really a par2 file")
return False
return []
# Parse the par2 file
md5of16k = {}
@@ -74,7 +75,31 @@ def decode_par2(parfile):
return new_files
def is_probably_obfuscated(myinputfilename):
def recover_par2_names(filelist: List[str]) -> List[str]:
"""Find par2 files and use them for renaming"""
# Check that files exists
filelist = [f for f in filelist if os.path.isfile(f)]
# Search for par2 files in the filelist
par2_files = [f for f in filelist if f.endswith(".par2")]
# Found any par2 files we can use?
if not par2_files:
logging.debug("No par2 files found to process, running renamer")
else:
# Run par2 from SABnzbd on them
for par2_file in par2_files:
# Analyse data and analyse result
logging.debug("Deobfuscate par2: handling %s", par2_file)
new_files = decode_par2(par2_file)
if new_files:
logging.debug("Deobfuscate par2 repair/verify finished")
filelist += new_files
filelist = [f for f in filelist if os.path.isfile(f)]
else:
logging.debug("Deobfuscate par2 repair/verify did not find anything to rename")
return filelist
def is_probably_obfuscated(myinputfilename: str) -> bool:
"""Returns boolean if filename is likely obfuscated. Default: True
myinputfilename (string) can be a plain file name, or a full path"""
@@ -92,7 +117,7 @@ def is_probably_obfuscated(myinputfilename):
return True
# 0675e29e9abfd2.f7d069dab0b853283cc1b069a25f82.6547
if re.findall(r"^[a-f0-9\.]{40,}$", filebasename):
if re.findall(r"^[a-f0-9.]{40,}$", filebasename):
logging.debug("Obfuscated: starting with 40+ lower case hex digits and/or dots")
return True
@@ -133,7 +158,7 @@ def is_probably_obfuscated(myinputfilename):
return True # default not obfuscated
def deobfuscate_list(filelist, usefulname):
def deobfuscate_list(filelist: List[str], usefulname: str):
"""Check all files in filelist, and if wanted, deobfuscate: rename to filename based on usefulname"""
# Methods
@@ -144,25 +169,6 @@ def deobfuscate_list(filelist, usefulname):
# to be sure, only keep really exsiting files:
filelist = [f for f in filelist if os.path.isfile(f)]
# Search for par2 files in the filelist
par2_files = [f for f in filelist if f.endswith(".par2")]
# Found any par2 files we can use?
par2_renaming_done = False
if not par2_files:
logging.debug("No par2 files found to process, running renamer")
else:
# Run par2 from SABnzbd on them
for par2_file in par2_files:
# Analyse data and analyse result
logging.debug("Deobfuscate par2: handling %s", par2_file)
new_files = decode_par2(par2_file)
if new_files:
logging.debug("Deobfuscate par2 repair/verify finished")
filelist += new_files
filelist = [f for f in filelist if os.path.isfile(f)]
else:
logging.debug("Deobfuscate par2 repair/verify did not find anything to rename")
# let's see if there are files with uncommon/unpopular (so: obfuscated) extensions
# if so, let's give them a better extension based on their internal content/info
# Example: if 'kjladsflkjadf.adsflkjads' is probably a PNG, rename to 'kjladsflkjadf.adsflkjads.png'

View File

@@ -95,7 +95,8 @@ class DirectUnpacker(threading.Thread):
def check_requirements(self):
if (
not cfg.direct_unpack()
not cfg.enable_unrar()
or not cfg.direct_unpack()
or self.killed
or self.nzo.first_articles
or not self.nzo.unpack
@@ -224,10 +225,14 @@ class DirectUnpacker(threading.Thread):
self.unpack_time += time.time() - start_time
ACTIVE_UNPACKERS.remove(self)
# Take note of the correct password
if self.nzo.password and not self.nzo.correct_password:
self.nzo.correct_password = self.nzo.password
# Add to success
rarfile_path = os.path.join(self.nzo.download_path, self.rarfile_nzf.filename)
self.success_sets[self.cur_setname] = (
rar_volumelist(rarfile_path, self.nzo.password, rarfiles),
rar_volumelist(rarfile_path, self.nzo.correct_password, rarfiles),
extracted,
)
logging.info("DirectUnpack completed for %s", self.cur_setname)
@@ -364,7 +369,9 @@ class DirectUnpacker(threading.Thread):
extraction_path, _, _, one_folder, _ = self.unpack_dir_info
# Set options
if self.nzo.password:
if self.nzo.correct_password:
password_command = "-p%s" % self.nzo.correct_password
elif self.nzo.password:
password_command = "-p%s" % self.nzo.password
else:
password_command = "-p-"

View File

@@ -852,7 +852,7 @@ def get_filepath(path: str, nzo, filename: str):
def renamer(old: str, new: str, create_local_directories: bool = False) -> str:
"""Rename file/folder with retries for Win32
Optionally alows the creation of local directories if they don't exist yet
Returns new filename (which could be changed due to sanitize_filenam) on success"""
Returns new filename (which could be changed due to sanitize_filename) on success"""
# Sanitize last part of new name
path, name = os.path.split(new)
new = os.path.join(path, sanitize_filename(name))

View File

@@ -880,6 +880,7 @@ SPECIAL_BOOL_LIST = (
"fast_fail",
"overwrite_files",
"enable_par_cleanup",
"process_unpacked_par2",
"queue_complete_pers",
"api_warnings",
"helpfull_warnings",

View File

@@ -750,8 +750,12 @@ def create_https_certificates(ssl_cert, ssl_key):
return True
def get_all_passwords(nzo):
"""Get all passwords, from the NZB, meta and password file"""
def get_all_passwords(nzo) -> List[str]:
"""Get all passwords, from the NZB, meta and password file. In case the correct password is
already known, only that password is returned."""
if nzo.correct_password:
return [nzo.correct_password]
if nzo.password:
logging.info("Found a password that was set by the user: %s", nzo.password)
passwords = [nzo.password.strip()]
@@ -1067,7 +1071,7 @@ def build_and_run_command(command: List[str], flatten_command=False, **kwargs):
command.insert(0, "python.exe")
if flatten_command:
command = list2cmdline(command)
# On some Windows platforms we need to supress a quick pop-up of the command window
# On some Windows platforms we need to suppress a quick pop-up of the command window
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags = win32process.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = win32con.SW_HIDE

View File

@@ -148,6 +148,7 @@ ENV_NZO_FIELDS = [
"bytes_downloaded",
"bytes_tried",
"cat",
"correct_password",
"duplicate",
"encrypted",
"fail_msg",

View File

@@ -556,6 +556,7 @@ NzbObjectSaver = (
"nzo_info",
"custom_name",
"password",
"correct_password",
"next_save",
"save_timeout",
"encrypted",
@@ -651,6 +652,7 @@ class NzbObject(TryList):
self.groups = []
self.avg_date = datetime.datetime(1970, 1, 1, 1, 0)
self.avg_stamp = 0.0 # Avg age in seconds (calculated from avg_age)
self.correct_password: Optional[str] = None
# Bookkeeping values
self.meta = {}
@@ -1216,13 +1218,16 @@ class NzbObject(TryList):
# Check if there are any files left here, so the check is inside the NZO_LOCK
return articles_left, file_done, not self.files
@synchronized(NZO_LOCK)
def add_saved_article(self, article: Article):
self.saved_articles.append(article)
@synchronized(NZO_LOCK)
def remove_saved_article(self, article: Article):
self.saved_articles.remove(article)
try:
self.saved_articles.remove(article)
except ValueError:
# Due to racing conditions, it could already be removed
logging.debug("Failed to remove %s from saved articles, probably already deleted", article)
pass
def check_existing_files(self, wdir: str):
"""Check if downloaded files already exits, for these set NZF to complete"""

View File

@@ -26,7 +26,7 @@ import time
import re
import gc
import queue
from typing import List, Optional
from typing import List, Optional, Tuple
import sabnzbd
from sabnzbd.newsunpack import (
@@ -65,7 +65,7 @@ from sabnzbd.filesystem import (
get_filename,
)
from sabnzbd.nzbstuff import NzbObject
from sabnzbd.sorting import Sorter, is_sample, move_to_parent_directory
from sabnzbd.sorting import Sorter, is_sample
from sabnzbd.constants import (
REPAIR_PRIORITY,
FORCE_PRIORITY,
@@ -80,7 +80,6 @@ import sabnzbd.emailer as emailer
import sabnzbd.downloader
import sabnzbd.config as config
import sabnzbd.cfg as cfg
import sabnzbd.encoding as encoding
import sabnzbd.nzbqueue
import sabnzbd.database as database
import sabnzbd.notifier as notifier
@@ -317,6 +316,8 @@ def process_job(nzo: NzbObject):
# Signal empty download, for when 'empty_postproc' is enabled
empty = False
nzb_list = []
one_folder = False
newfiles = []
# These need to be initialized in case of a crash
workdir_complete = ""
script_log = ""
@@ -419,7 +420,6 @@ def process_job(nzo: NzbObject):
nzo
)
newfiles = []
# Run Stage 2: Unpack
if flag_unpack:
# Set the current nzo status to "Extracting...". Used in History
@@ -480,6 +480,7 @@ def process_job(nzo: NzbObject):
script_output = ""
script_ret = 0
script_error = False
if not nzb_list:
# Give destination its final name
if cfg.folder_rename() and tmp_workdir_complete and not one_folder:
@@ -511,51 +512,49 @@ def process_job(nzo: NzbObject):
# TV/Movie/Date Renaming code part 2 - rename and move files to parent folder
if all_ok and file_sorter.sort_file:
if newfiles:
workdir_complete, ok = file_sorter.rename(newfiles, workdir_complete)
if not ok:
workdir_complete, ok = move_to_parent_directory(workdir_complete)
workdir_complete, ok = file_sorter.sorter.rename(newfiles, workdir_complete)
if not ok:
nzo.set_unpack_info("Unpack", T("Failed to move files"))
all_ok = False
if cfg.deobfuscate_final_filenames() and all_ok and not nzb_list:
# Deobfuscate the filenames
logging.info("Running deobfuscate")
deobfuscate.deobfuscate_list(newfiles, nzo.final_name)
# Run further post-processing
if (all_ok or not cfg.safe_postproc()) and not nzb_list:
# Use par2 files to deobfuscate unpacked file names
if cfg.process_unpacked_par2():
newfiles = deobfuscate.recover_par2_names(newfiles)
# Run the user script
script_path = make_script_path(script)
if (all_ok or not cfg.safe_postproc()) and (not nzb_list) and script_path:
# Set the current nzo status to "Ext Script...". Used in History
nzo.status = Status.RUNNING
nzo.set_action_line(T("Running script"), script)
nzo.set_unpack_info("Script", T("Running user script %s") % script, unique=True)
script_log, script_ret = external_processing(
script_path, nzo, clip_path(workdir_complete), nzo.final_name, job_result
)
script_line = get_last_line(script_log)
if script_log:
script_output = nzo.nzo_id
if script_line:
nzo.set_unpack_info("Script", script_line, unique=True)
else:
nzo.set_unpack_info("Script", T("Ran %s") % script, unique=True)
else:
script = ""
script_line = ""
script_ret = 0
if cfg.deobfuscate_final_filenames():
# Deobfuscate the filenames
logging.info("Running deobfuscate")
deobfuscate.deobfuscate_list(newfiles, nzo.final_name)
# Maybe bad script result should fail job
if script_ret and cfg.script_can_fail():
script_error = True
all_ok = False
nzo.fail_msg = T("Script exit code is %s") % script_ret
else:
script_error = False
# Run the user script
script_path = make_script_path(script)
if script_path:
# Set the current nzo status to "Ext Script...". Used in History
nzo.status = Status.RUNNING
nzo.set_action_line(T("Running script"), script)
nzo.set_unpack_info("Script", T("Running user script %s") % script, unique=True)
script_log, script_ret = external_processing(
script_path, nzo, clip_path(workdir_complete), nzo.final_name, job_result
)
script_line = get_last_line(script_log)
if script_log:
script_output = nzo.nzo_id
if script_line:
nzo.set_unpack_info("Script", script_line, unique=True)
else:
nzo.set_unpack_info("Script", T("Ran %s") % script, unique=True)
# Maybe bad script result should fail job
if script_ret and cfg.script_can_fail():
script_error = True
all_ok = False
nzo.fail_msg = T("Script exit code is %s") % script_ret
# Email the results
if (not nzb_list) and cfg.email_endjob():
if (cfg.email_endjob() == 1) or (cfg.email_endjob() == 2 and (unpack_error or par_error or script_error)):
if not nzb_list and cfg.email_endjob():
if cfg.email_endjob() == 1 or (cfg.email_endjob() == 2 and (unpack_error or par_error or script_error)):
emailer.endjob(
nzo.final_name,
nzo.cat,
@@ -578,8 +577,7 @@ def process_job(nzo: NzbObject):
if len(script_log.rstrip().split("\n")) > 1:
nzo.set_unpack_info(
"Script",
'%s%s <a href="./scriptlog?name=%s">(%s)</a>'
% (script_ret, script_line, encoding.xml_name(script_output), T("More")),
'%s%s <a href="./scriptlog?name=%s">(%s)</a>' % (script_ret, script_line, script_output, T("More")),
unique=True,
)
else:
@@ -672,7 +670,7 @@ def process_job(nzo: NzbObject):
return True
def prepare_extraction_path(nzo: NzbObject):
def prepare_extraction_path(nzo: NzbObject) -> Tuple[str, str, Sorter, bool, Optional[str]]:
"""Based on the information that we have, generate
the extraction path and create the directory.
Separated so it can be called from DirectUnpacker
@@ -1193,7 +1191,7 @@ def rename_and_collapse_folder(oldpath, newpath, files):
return files
def set_marker(folder):
def set_marker(folder: str) -> Optional[str]:
"""Set marker file and return name"""
name = cfg.marker_file()
if name:
@@ -1209,7 +1207,7 @@ def set_marker(folder):
return name
def del_marker(path):
def del_marker(path: str):
"""Remove marker file"""
if path and os.path.exists(path):
logging.debug("Removing marker file %s", path)

View File

@@ -41,7 +41,6 @@ import sabnzbd.cfg as cfg
from sabnzbd.constants import EXCLUDED_GUESSIT_PROPERTIES
from sabnzbd.nzbstuff import NzbObject, scan_password
# Do not rename .vob files as they are usually DVD's
EXCLUDED_FILE_EXTS = (".vob", ".bin")
@@ -69,7 +68,7 @@ class BaseSorter:
cats: str,
guess: Optional[MatchesDict],
force: Optional[bool] = False,
) -> None:
):
self.matched = False
self.original_job_name = job_name
self.original_path = path
@@ -88,6 +87,14 @@ class BaseSorter:
# Check categories and do the guessing work, if necessary
self.match()
def match(self):
"""Implemented by child classes"""
pass
def get_values(self):
"""Implemented by child classes"""
pass
def get_final_path(self) -> str:
if self.matched:
# Construct the final path
@@ -97,7 +104,7 @@ class BaseSorter:
# Error Sorting
return os.path.join(self.original_path, self.original_job_name)
def get_names(self) -> None:
def get_names(self):
"""Get the show or movie name from the guess and format it"""
# Get the formatted title and alternate title formats
self.info["ttitle"], self.info["ttitle_two"], self.info["ttitle_three"] = get_titles(
@@ -107,16 +114,16 @@ class BaseSorter:
self.nzo, self.guess, self.original_job_name
)
def get_resolution(self) -> None:
def get_resolution(self):
self.info["resolution"] = self.guess.get("screen_size", "")
def get_showdescriptions(self) -> None:
def get_showdescriptions(self):
"""Get the show descriptions based on metadata, guessit and jobname"""
self.info["ep_name"], self.info["ep_name_two"], self.info["ep_name_three"] = get_descriptions(
self.nzo, self.guess, self.original_job_name
)
def get_year(self) -> None:
def get_year(self):
"""Get the year and the corresponding two and four digit decade values"""
year = ""
if self.nzo:
@@ -308,8 +315,8 @@ class BaseSorter:
class Sorter:
"""Generic Sorter"""
def __init__(self, nzo: Optional[NzbObject], cat: str) -> None:
self.sorter = None
def __init__(self, nzo: Optional[NzbObject], cat: str):
self.sorter: Optional[BaseSorter] = None
self.sort_file = False
self.nzo = nzo
self.cat = cat
@@ -319,20 +326,17 @@ class Sorter:
guess = guess_what(job_name)
if guess["type"] == "episode":
self.sort_file = True
if "date" in guess:
self.sorter = DateSorter(self.nzo, job_name, complete_dir, self.cat, guess)
else:
self.sorter = SeriesSorter(self.nzo, job_name, complete_dir, self.cat, guess)
elif guess["type"] == "movie":
self.sort_file = True
self.sorter = MovieSorter(self.nzo, job_name, complete_dir, self.cat, guess)
return self.sorter.get_final_path() if self.sort_file else complete_dir
if self.sorter and self.sorter.matched:
self.sort_file = True
def rename(self, newfiles, workdir_complete) -> None:
"""Rename files of the job"""
return self.sorter.rename(newfiles, workdir_complete)
return self.sorter.get_final_path() if self.sort_file else complete_dir
class SeriesSorter(BaseSorter):
@@ -346,27 +350,20 @@ class SeriesSorter(BaseSorter):
cat: str,
guess: Optional[MatchesDict] = None,
force: Optional[bool] = False,
) -> None:
):
super().__init__(nzo, job_name, path, cat, cfg.tv_sort_string(), cfg.tv_categories(), guess, force)
def match(self) -> None:
def match(self):
"""Try to guess series info if config and category sort out or force is set"""
if self.force or (cfg.enable_tv_sorting() and cfg.tv_sort_string()):
if (
self.force
or (not self.cats)
or (self.cat and self.cat.lower() in self.cats)
or (not self.cat and "None" in self.cats)
):
if not self.guess:
self.guess = guess_what(self.original_job_name, sort_type="episode")
if self.guess.get("type") == "episode" and not "date" in self.guess:
logging.debug("Using tv sorter for %s", self.original_job_name)
self.matched = True
self.type = "tv"
if self.force or (cfg.enable_tv_sorting() and cfg.tv_sort_string() and self.cat.lower() in self.cats):
self.guess = guess_what(self.original_job_name, sort_type="episode")
if self.guess.get("type") == "episode" and "date" not in self.guess:
logging.debug("Using tv sorter for %s", self.original_job_name)
self.matched = True
self.type = "tv"
def get_values(self) -> None:
def get_values(self):
"""Collect all values needed for path replacement"""
self.get_year()
self.get_names()
@@ -375,7 +372,7 @@ class SeriesSorter(BaseSorter):
self.get_showdescriptions()
self.get_resolution()
def format_series_numbers(self, numbers: Union[int, List[int]], info_name: str) -> None:
def format_series_numbers(self, numbers: Union[int, List[int]], info_name: str):
"""Format the numbers in both plain and alternative (zero-padded) format and set as showinfo"""
# Guessit returns multiple episodes or seasons as a list of integers, single values as int
if isinstance(numbers, int):
@@ -385,11 +382,11 @@ class SeriesSorter(BaseSorter):
self.info[info_name] = "-".join([str(num) for num in numbers]) # 1-2-3
self.info[info_name + "_alt"] = "-".join([str(num).rjust(2, "0") for num in numbers]) # 01-02-03
def get_seasons(self) -> None:
def get_seasons(self):
"""Fetch the guessed season number(s)"""
self.format_series_numbers(self.guess.get("season", ""), "season_num")
def get_episodes(self) -> None:
def get_episodes(self):
"""Fetch the guessed episode number(s)"""
self.format_series_numbers(self.guess.get("episode", ""), "episode_num")
@@ -415,23 +412,21 @@ class MovieSorter(BaseSorter):
cat: str,
guess: Optional[MatchesDict] = None,
force: Optional[bool] = False,
) -> None:
):
self.extra = cfg.movie_sort_extra()
super().__init__(nzo, job_name, path, cat, cfg.movie_sort_string(), cfg.movie_categories(), guess, force)
def match(self) -> None:
def match(self):
"""Try to guess movie info if config and category sort out or force is set"""
if self.force or (cfg.enable_movie_sorting() and self.sort_string):
if self.force or (self.cat and self.cat.lower() in self.cats) or (not self.cat and "None" in self.cats):
if not self.guess:
self.guess = guess_what(self.original_job_name, sort_type="movie")
if self.guess.get("type") == "movie":
logging.debug("Using movie sorter for %s", self.original_job_name)
self.matched = True
self.type = "movie"
if self.force or (cfg.enable_movie_sorting() and self.sort_string and self.cat.lower() in self.cats):
self.guess = guess_what(self.original_job_name, sort_type="movie")
if self.guess.get("type") == "movie":
logging.debug("Using movie sorter for %s", self.original_job_name)
self.matched = True
self.type = "movie"
def get_values(self) -> None:
def get_values(self):
"""Collect all values needed for path replacement"""
self.get_year()
self.get_resolution()
@@ -498,22 +493,20 @@ class DateSorter(BaseSorter):
cat: str,
guess: Optional[MatchesDict] = None,
force: Optional[bool] = False,
) -> None:
):
super().__init__(nzo, job_name, path, cat, cfg.date_sort_string(), cfg.date_categories(), guess, force)
def match(self) -> None:
def match(self):
"""Checks the category for a match, if so set self.matched to true"""
if self.force or (cfg.enable_date_sorting() and self.sort_string):
if self.force or (self.cat and self.cat.lower() in self.cats) or (not self.cat and "None" in self.cats):
if not self.guess:
self.guess = guess_what(self.original_job_name, sort_type="episode")
if self.guess.get("type") == "episode" and "date" in self.guess:
logging.debug("Using date sorter for %s", self.original_job_name)
self.matched = True
self.type = "date"
if self.force or (cfg.enable_date_sorting() and self.sort_string and self.cat.lower() in self.cats):
self.guess = guess_what(self.original_job_name, sort_type="episode")
if self.guess.get("type") == "episode" and "date" in self.guess:
logging.debug("Using date sorter for %s", self.original_job_name)
self.matched = True
self.type = "date"
def get_date(self) -> None:
def get_date(self):
"""Get month and day"""
self.info["month"] = str(self.guess.get("date").month)
self.info["day"] = str(self.guess.get("date").day)
@@ -521,7 +514,7 @@ class DateSorter(BaseSorter):
self.info["month_two"] = self.info["month"].rjust(2, "0")
self.info["day_two"] = self.info["day"].rjust(2, "0")
def get_values(self) -> None:
def get_values(self):
"""Collect all values needed for path replacement"""
self.get_year()
self.get_date()
@@ -602,7 +595,7 @@ def guess_what(name: str, sort_type: Optional[str] = None) -> MatchesDict:
guess["title"] = guess.get("title", "")[len(digit_fix) :]
# Force season to 1 for seasonless episodes with no date
if guess.get("type") == "episode" and not "date" in guess:
if guess.get("type") == "episode" and "date" not in guess:
guess.setdefault("season", 1)
# Try to avoid setting the type to movie on arbitrary jobs (e.g. 'Setup.exe') just because guessit defaults to that
@@ -801,7 +794,7 @@ def strip_path_elements(path: str) -> str:
return "\\\\" + path if is_unc else path
def rename_similar(folder: str, skip_ext: str, name: str, skipped_files: List[str]) -> None:
def rename_similar(folder: str, skip_ext: str, name: str, skipped_files: List[str]):
"""Rename all other files in the 'folder' hierarchy after 'name'
and move them to the root of 'folder'.
Files having extension 'skip_ext' will be moved, but not renamed.

View File

@@ -28,6 +28,7 @@ import urllib.request
import urllib.error
import urllib.parse
from http.client import IncompleteRead, HTTPResponse
from mailbox import Message
from threading import Thread
import base64
from typing import Tuple, Optional
@@ -190,8 +191,8 @@ class URLGrabber(Thread):
nzo_info[item] = value
# Get filename from Content-Disposition header
if not filename and "filename=" in value:
filename = value[value.index("filename=") + 9 :].strip(";").strip('"')
if not filename and "filename" in value:
filename = filename_from_content_disposition(value)
if wait:
# For sites that have a rate-limiting attribute
@@ -369,3 +370,23 @@ def _analyse(fetch_request: HTTPResponse, future_nzo: NzbObject):
return None, msg, True, when, data
return fetch_request, fetch_request.msg, False, 0, data
def filename_from_content_disposition(content_disposition: str) -> Optional[str]:
"""
Extract and validate filename from a Content-Disposition header.
Origin: https://github.com/httpie/httpie/blob/4c8633c6e51f388523ab4fa649040934402a4fc9/httpie/downloads.py#L98
:param content_disposition: Content-Disposition value
:type content_disposition: str
:return: the filename if present and valid, otherwise `None`
:example:
filename_from_content_disposition('attachment; filename=jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz')
should return: 'jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz'
"""
filename = Message(f"Content-Disposition: attachment; {content_disposition}").get_filename()
if filename:
# Basic sanitation
filename = os.path.basename(filename).lstrip(".").strip()
if filename:
return filename

View File

@@ -5,5 +5,5 @@
# You MUST use double quotes (so " and not ')
__version__ = "develop"
__baseline__ = "unknown"
__version__ = "3.4.0"
__baseline__ = "7d5207aa67c7d558d2490595ed03aa7809fe9f70"

View File

@@ -316,7 +316,7 @@ class TestDeobfuscateFinalResult:
for (dirpath, dirnames, filenames) in os.walk(test_dir):
list_of_files += [os.path.join(dirpath, file) for file in filenames]
# Run deobfuscate
deobfuscate_list(list_of_files, "doesnt_matter")
recover_par2_names(list_of_files)
# Should now be renamed to the filename in the par2 file
assert not os.path.exists(test_input)
@@ -344,9 +344,11 @@ class TestDeobfuscateFinalResult:
# deobfuscate will do:
# first par2 based renaming aaaaaaaaaaa to twentymb.bin,
# then deobfuscate twentymb.bin to the job name (with same extension)
deobfuscate_list(list_of_files, "My Great Download")
list_of_files = recover_par2_names(list_of_files)
assert os.path.isfile(os.path.join(work_dir, "twentymb.bin")) # should exist
deobfuscate_list(list_of_files, "My Great Download")
assert os.path.isfile(os.path.join(work_dir, "My Great Download.bin")) # the twentymb.bin should be renamed
assert not os.path.isfile(os.path.join(work_dir, "twentymb.bin")) # should be gone
assert not os.path.isfile(os.path.join(work_dir, "twentymb.bin")) # should now be gone
shutil.rmtree(work_dir)

View File

@@ -72,7 +72,7 @@ class TestBasicPages(SABnzbdBaseTest):
self.no_page_crash()
else:
# For others if all is fine, button will be back to normal in 1 second
time.sleep(1.0)
time.sleep(1.5)
assert submit_btn.text == "Save Changes"

View File

@@ -681,15 +681,32 @@ class TestSortingSorters:
)
def test_sorter_generic(self, job_name, result_sort_file, result_class):
"""Check if the generic sorter makes the right choices"""
generic = sorting.Sorter(None, None)
generic.detect(job_name, SAB_CACHE_DIR)
assert generic.sort_file is result_sort_file
if result_sort_file:
assert generic.sorter
assert generic.sorter.__class__ is result_class
else:
assert not generic.sorter
@set_config(
{
"tv_sort_string": "test", # TV
"tv_categories": "test_cat",
"enable_tv_sorting": 1,
"movie_sort_string": "test", # Movie
"movie_categories": "test_cat",
"enable_movie_sorting": 1,
"date_sort_string": "test", # Date
"date_categories": "test_cat",
"enable_date_sorting": 1,
}
)
def _func():
generic = sorting.Sorter(None, "test_cat")
generic.detect(job_name, SAB_CACHE_DIR)
assert generic.sort_file is result_sort_file
if result_sort_file:
assert generic.sorter
assert generic.sorter.__class__ is result_class
else:
assert not generic.sorter
_func()
@pytest.mark.parametrize(
"name, result",

View File

@@ -158,3 +158,43 @@ class TestBuildRequest:
self._runner(self.httpbin.url + "/status/404", 404)
with pytest.raises(urllib.error.HTTPError):
self._runner(self.httpbin.url + "/no/such/file", 404)
class TestFilenameFromDispositionHeader:
@pytest.mark.parametrize(
"header, result",
[
(
# In this case the first filename (not the UTF-8 encoded) is parsed.
"attachment; filename=jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz; filename*=UTF-8''jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
"jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
),
(
"filename=jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz;",
"jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
),
(
"filename*=UTF-8''jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
"jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
),
(
"attachment; filename=jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
"jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
),
(
'attachment; filename="jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz"',
"jakubroztocil-httpie-0.4.1-20-g40bd8f6.tar.gz",
),
(
"attachment; filename=/what/ever/filename.tar.gz",
"filename.tar.gz",
),
(
"attachment; filename=",
None,
),
],
)
def test_filename_from_disposition_header(self, header, result):
"""Test the parsing of different disposition-headers."""
assert urlgrabber.filename_from_content_disposition(header) == result

View File

@@ -193,6 +193,7 @@ class FakeHistoryDB(db.HistoryDB):
distro_choice = choice(self.distro_names)
distro_random = random_name()
nzo.password = choice(["secret", ""])
nzo.correct_password = "secret"
nzo.final_name = "%s.%s.Linux.ISO-Usenet" % (distro_choice, distro_random)
nzo.filename = "%s.%s.Linux-Usenet%s.nzb" % (
(distro_choice, distro_random, "{{" + nzo.password + "}}")