Page 2 of 2

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 22nd, 2023, 3:40 pm
by safihre
Have you verified that the script is still executed? Any errors?

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 22nd, 2023, 3:46 pm
by gohakn

Code: Select all

2023-05-22 22:41:09,275::INFO::[misc:1169] [sabnzbd.newsunpack.pre_queue] Running external command: ['/volume1/@appstore/sabnzbd/bin/nice', '-n15', '/volume1/@appstore/sabnzbd/bin/ionice', '-c2', '-n4', '/volume1/@appdata/sabnzbd/@script_dir@/fileprio', '22-05-2023 Bildzeitung / IDmZNQeou6TiEz1DEA4v7z', '', '', '', '', '18271818', 'alt.binaries.bloaf', '22-05', '', '', '', 'False', '', '20', '2023', '', '', 'movie']
I think that the script is executed but ended with the state "False" although the FIlesize is about 17MB

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 23rd, 2023, 4:51 am
by safihre
What is shown later on about the output?
If you enable Debug logging it should show what if does with the output.

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 23rd, 2023, 5:18 am
by gohakn
is that enough?

i was just looking for the word 'fileprio'

Code: Select all

2023-05-22 22:41:09,275::DEBUG::[misc:1170] Popen arguments: {'stdin': -1, 'stdout': -1, 'stderr': -2, 'startupinfo': None, 'creationflags': 0, 'env': {'SYNOPKG_PKGVAR': '/volume1/@appdata/sabnzbd', 'SYNOPKG_PKGPORT': '8080', 'SYNOPKG_USERNAME': 'admin', 'SYNOPKG_PKGNAME': 'sabnzbd', 'SYNOPKG_DSM_VERSION_MAJOR': '7', 'SYNOPKG_PKGHOME': '/volume1/@apphome/sabnzbd', 'SYNOPKG_DSM_VERSION_MINOR': '1', 'SYNOPKG_PKGTMP': '/volume1/@apptemp/sabnzbd', 'SYNOPKG_DSM_VERSION_BUILD': '42962', 'SELF': 'sabnzbd', 'PWD': '/', 'SYNOPKG_PKGVER': '4.0.1-61', 'SYNOPKG_DSM_LANGUAGE': 'ger', 'SYNOPKG_DSM_ARCH': 'avoton', 'SYNOPKG_PKGDEST_VOL': '/volume1', 'SHLVL': '2', 'PATH': '/volume1/@appstore/sabnzbd/env/bin:/volume1/@appstore/sabnzbd/bin:/var/packages/python311/target/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin', 'SYNOPKG_TEMP_LOGFILE': '/tmp/synopkgmgr.log-sabnzbd', 'SYNOPKG_PKGDEST': '/volume1/@appstore/sabnzbd', '_': '/bin/env', 'LANG': 'en_US.UTF-8', 'AVAHI_COMPAT_NOWARN': '1', 'SSL_CERT_FILE': '/var/packages/python311/target/lib/python3.11/site-packages/certifi/cacert.pem', 'SAB_BYTES': '18271818', 'SAB_BYTES_DOWNLOADED': '0', 'SAB_BYTES_TRIED': '0', 'SAB_CAT': '*', 'SAB_CORRECT_PASSWORD': '', 'SAB_DUPLICATE': '0', 'SAB_ENCRYPTED': '0', 'SAB_FAIL_MSG': '', 'SAB_FILENAME': '22-05-2023 Bildzeitung{{IDmZNQeou6TiEz1DEA4v7z}}.nzb', 'SAB_FINAL_NAME': '22-05-2023 Bildzeitung', 'SAB_GROUP': 'alt.binaries.bloaf', 'SAB_NZO_ID': '', 'SAB_OVERSIZED': '0', 'SAB_PASSWORD': 'IDmZNQeou6TiEz1DEA4v7z', 'SAB_PP': '3', 'SAB_PRIORITY': '0', 'SAB_REPAIR': '1', 'SAB_SCRIPT': 'None', 'SAB_STATUS': 'Queued', 'SAB_UNPACK': '1', 'SAB_UNWANTED_EXT': '0', 'SAB_URL': '', 'SAB_GROUPS': 'alt.binaries.bloaf', 'SAB_SHOW_NAME': '22-05', 'SAB_SHOW_SEASON': '', 'SAB_SHOW_EPISODE': '', 'SAB_SHOW_EPISODE_NAME': '', 'SAB_PROPER': 'False', 'SAB_RESOLUTION': '', 'SAB_DECADE': '20', 'SAB_YEAR': '2023', 'SAB_MONTH': '', 'SAB_DAY': '', 'SAB_TYPE': 'movie', 'SAB_PROGRAM_DIR': '/volume1/@appstore/sabnzbd/share/SABnzbd', 'SAB_PAR2_COMMAND': '/volume1/@appstore/sabnzbd/bin/par2', 'SAB_MULTIPAR_COMMAND': '', 'SAB_RAR_COMMAND': '/volume1/@appstore/sabnzbd/bin/unrar', 'SAB_ZIP_COMMAND': '', 'SAB_7ZIP_COMMAND': '/volume1/@appstore/sabnzbd/bin/7za', 'SAB_VERSION': '4.0.1'}}
2023-05-22 22:41:09,330::DEBUG::[directunpacker:149] DirectUnpack queued <HASH>pdiem.part051.rar for <HASH>pdiem
2023-05-22 22:41:09,331::DEBUG::[assembler:79] Decoding part of /volume1/UpDownload/Temp/LBJ.2016.German.DTS.DL.1080p.BluRay.x264-LeetHD/<HASH>pdiem.part052.rar
2023-05-22 22:41:09,349::DEBUG::[filesystem:912] [sabnzbd.filesystem.load_data] Deleting file /volume1/UpDownload/Temp/LBJ.2016.German.DTS.DL.1080p.BluRay.x264-LeetHD/__ADMIN__/SABnzbd_article_b8hd4v41
2023-05-22 22:41:09,435::INFO::[newsunpack:2339] Pre-queue script returned 1 and output=

2023-05-22 22:41:09,435::INFO::[newsunpack:2364] Pre-Q accepts 22-05-2023 Bildzeitung
2023-05-22 22:41:09,436::DEBUG::[nzbstuff:1902] Saving attributes {'cat': '*', 'pp': 3, 'script': 'None', 'priority': 0, 'final_name': '22-05-2023 Bildzeitung', 'password': 'IDmZNQeou6TiEz1DEA4v7z', 'url': None} for 22-05-2023 Bildzeitung
2023-05-22 22:41:09,437::DEBUG::[misc:222] Parsing category * to attributes: pp=3 script=None prio=0
2023-05-22 22:41:09,438::DEBUG::[nzbstuff:959] NZB nzo-info = {'password': 'ID***'}
2023-05-22 22:41:09,438::INFO::[nzbqueue:233] Saving queue
2023-05-22 22:41:09,439::DEBUG::[nzbstuff:1902] Saving attributes {'cat': '*', 'pp': 3, 'script': 'None', 'priority': 0, 'final_name': '22-05-2023 Bildzeitung', 'password': 'IDmZNQeou6TiEz1DEA4v7z', 'url': None} for 22-05-2023 Bildzeitung
2023-05-22 22:41:09,441::DEBUG::[filesystem:1118] [sabnzbd.nzbstuff.save_to_disk] Saving data for SABnzbd_nzo_vccwb6an in /volume1/UpDownload/Temp/22-05-2023 Bildzeitung/__ADMIN__
2023-05-22 22:41:09,443::DEBUG::[filesystem:1186] [sabnzbd.nzbqueue.save] Saving data for queue10.sab
2023-05-22 22:41:09,444::DEBUG::[filesystem:1118] [sabnzbd.filesystem.save_admin] Saving data for queue10.sab in /volume1/@appdata/sabnzbd/admin
2023-05-22 22:41:09,493::INFO::[notifier:123] Sending notification: NZB zur Warteschlange hinzugefügt - 22-05-2023 Bildzeitung{{IDmZNQeou6TiEz1DEA4v7z}}.nzb (type=download, job_cat=*)

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 23rd, 2023, 11:02 am
by safihre
That's strange.. Seems almost like the script isn't run.
You still use the exact same script?

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 23rd, 2023, 3:34 pm
by gohakn
Yes the script wasn`t changed since August 2022.

The directories are the same and the file is executable...
Just made a restart of the Synology, but the Problem still resists.

Same with some new testfiles...

Code: Select all

2023-05-23 22:22:28,817::INFO::[misc:1169] [sabnzbd.newsunpack.pre_queue] Running external command: ['/volume1/@appstore/sabnzbd/bin/nice', '-n15', '/volume1/@appstore/sabnzbd/bin/ionice', '-c2', '-n4', '/volume1/@appdata/sabnzbd/@script_dir@/fileprio', '01-04-2023 Bildzeitung / FgIlML3ilZijeDFXnBNc2I', '', '', '', '', '11904846', 'alt.binaries.bloaf', '01-04', '', '', '', 'False', '', '20', '2023', '', '', 'movie']
2023-05-23 22:22:28,818::DEBUG::[misc:1170] Popen arguments: {'stdin': -1, 'stdout': -1, 'stderr': -2, 'startupinfo': None, 'creationflags': 0, 'env': {'SYNOPKG_PKGVAR': '/volume1/@appdata/sabnzbd', 'SYNOPKG_PKGPORT': '8080', 'SYNOPKG_USERNAME': '', 'SYNOPKG_PKGNAME': 'sabnzbd', 'SYNOPKG_DSM_VERSION_MAJOR': '7', 'SYNOPKG_PKGHOME': '/volume1/@apphome/sabnzbd', 'SYNOPKG_DSM_VERSION_MINOR': '1', 'SYNOPKG_PKGTMP': '/volume1/@apptemp/sabnzbd', 'SYNOPKG_DSM_VERSION_BUILD': '42962', 'SELF': 'sabnzbd', 'PWD': '/', 'SYNOPKG_PKGVER': '4.0.1-61', 'SYNOPKG_DSM_LANGUAGE': '', 'SYNOPKG_DSM_ARCH': 'avoton', 'SYNOPKG_PKGDEST_VOL': '/volume1', 'SHLVL': '2', 'PATH': '/volume1/@appstore/sabnzbd/env/bin:/volume1/@appstore/sabnzbd/bin:/var/packages/python311/target/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin', 'SYNOPKG_TEMP_LOGFILE': '/tmp/synopkgmgr.log-sabnzbd', 'SYNOPKG_PKGDEST': '/volume1/@appstore/sabnzbd', '_': '/bin/env', 'LANG': 'en_US.UTF-8', 'AVAHI_COMPAT_NOWARN': '1', 'SSL_CERT_FILE': '/var/packages/python311/target/lib/python3.11/site-packages/certifi/cacert.pem', 'SAB_BYTES': '11904846', 'SAB_BYTES_DOWNLOADED': '0', 'SAB_BYTES_TRIED': '0', 'SAB_CAT': '*', 'SAB_CORRECT_PASSWORD': '', 'SAB_DUPLICATE': '0', 'SAB_ENCRYPTED': '0', 'SAB_FAIL_MSG': '', 'SAB_FILENAME': '01-04-2023 Bildzeitung{{FgIlML3ilZijeDFXnBNc2I}}.nzb', 'SAB_FINAL_NAME': '01-04-2023 Bildzeitung', 'SAB_GROUP': 'alt.binaries.bloaf', 'SAB_NZO_ID': '', 'SAB_OVERSIZED': '0', 'SAB_PASSWORD': 'FgIlML3ilZijeDFXnBNc2I', 'SAB_PP': '3', 'SAB_PRIORITY': '0', 'SAB_REPAIR': '1', 'SAB_SCRIPT': 'None', 'SAB_STATUS': 'Queued', 'SAB_UNPACK': '1', 'SAB_UNWANTED_EXT': '0', 'SAB_URL': '', 'SAB_GROUPS': 'alt.binaries.bloaf', 'SAB_SHOW_NAME': '01-04', 'SAB_SHOW_SEASON': '', 'SAB_SHOW_EPISODE': '', 'SAB_SHOW_EPISODE_NAME': '', 'SAB_PROPER': 'False', 'SAB_RESOLUTION': '', 'SAB_DECADE': '20', 'SAB_YEAR': '2023', 'SAB_MONTH': '', 'SAB_DAY': '', 'SAB_TYPE': 'movie', 'SAB_PROGRAM_DIR': '/volume1/@appstore/sabnzbd/share/SABnzbd', 'SAB_PAR2_COMMAND': '/volume1/@appstore/sabnzbd/bin/par2', 'SAB_MULTIPAR_COMMAND': '', 'SAB_RAR_COMMAND': '/volume1/@appstore/sabnzbd/bin/unrar', 'SAB_ZIP_COMMAND': '', 'SAB_7ZIP_COMMAND': '/volume1/@appstore/sabnzbd/bin/7za', 'SAB_VERSION': '4.0.1'}}
2023-05-23 22:22:28,907::INFO::[newsunpack:2339] Pre-queue script returned 1 and output=

2023-05-23 22:22:28,908::INFO::[newsunpack:2364] Pre-Q accepts 01-04-2023 Bildzeitung
2023-05-23 22:22:28,908::DEBUG::[nzbstuff:1902] Saving attributes {'cat': '*', 'pp': 3, 'script': 'None', 'priority': 0, 'final_name': '01-04-2023 Bildzeitung', 'password': 'FgIlML3ilZijeDFXnBNc2I', 'url': None} for 01-04-2023 Bildzeitung
2023-05-23 22:22:28,909::DEBUG::[misc:222] Parsing category * to attributes: pp=3 script=None prio=0
2023-05-23 22:22:28,910::DEBUG::[nzbstuff:959] NZB nzo-info = {'password': '***'}
2023-05-23 22:22:28,911::INFO::[nzbqueue:233] Saving queue
2023-05-23 22:22:28,911::DEBUG::[nzbstuff:1902] Saving attributes {'cat': '*', 'pp': 3, 'script': 'None', 'priority': 0, 'final_name': '01-04-2023 Bildzeitung', 'password': 'FgIlML3ilZijeDFXnBNc2I', 'url': None} for 01-04-2023 Bildzeitung
2023-05-23 22:22:28,912::DEBUG::[filesystem:1118] [sabnzbd.nzbstuff.save_to_disk] Saving data for SABnzbd_nzo_h6q00x15 in /volume1/UpDownload/Temp/01-04-2023 Bildzeitung/__ADMIN__
2023-05-23 22:22:28,914::DEBUG::[filesystem:1186] [sabnzbd.nzbqueue.save] Saving data for queue10.sab
2023-05-23 22:22:28,914::DEBUG::[filesystem:1118] [sabnzbd.filesystem.save_admin] Saving data for queue10.sab in /volume1/@appdata/sabnzbd/admin
2023-05-23 22:22:28,937::INFO::[notifier:123] Sending notification: NZB zur Warteschlange hinzugefügt - 01-04-2023 Bildzeitung{{FgIlML3ilZijeDFXnBNc2I}}.nzb (type=download, job_cat=*)
Checking my DSM Paketzentrum showed me that I have severall Versions of Python 3.x installed and there is one more Version 2.7 in the
Community section ( supplied by you )

Image

Should I install that Version also??

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 23rd, 2023, 3:38 pm
by gohakn
Here`s the unchanged script

Code: Select all

#!/usr/bin/python3
import sys

try:
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
	
    downloadsize = int(downloadsize)
except:
    sys.exit(1)    # exit with 1 causes SABnzbd to ignore the output of this script

prio = -100    # Default
if downloadsize < 50111222:
    prio = 2

print("1")    # Accept
print()
print()
print()
print()
print(prio)
print()

# 0 means OK
sys.exit(0)
Image

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 24th, 2023, 2:27 am
by jcfp
Pre-queue scripts receive additional arguments since v4.0.0, so your script needs to handle that. See the second example script at https://sabnzbd.org/wiki/scripts/pre-queue-scripts

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 24th, 2023, 2:45 am
by gohakn
see next posting....

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 24th, 2023, 2:38 pm
by gohakn
jcfp wrote: May 24th, 2023, 2:27 am Pre-queue scripts receive additional arguments since v4.0.0, so your script needs to handle that. See the second example script at https://sabnzbd.org/wiki/scripts/pre-queue-scripts
You were pointing me into the right direction.


Just had to ad the leading line

Code: Select all

 #!/usr/bin/python3
, and same like August 5th in 2022th WIKI the filesize > must be replaced by <


For a Synology NAS running SABnzbd 4.0 and higher that's the working code

Code: Select all

#!/usr/bin/python3
import sys

try:
    # Parse the 18 input variables for SABnzbd version >= 4.0.0
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename, is_proper, resolution, decade, year, month, day, job_type) = sys.argv
except ValueError:
    # ...or 11 variables for earlier versions
    (scriptname, nzbname, postprocflags, category, script, prio, downloadsize, grouplist, showname, season, episodenumber, episodename) = sys.argv
except Exception:
    sys.exit(1)  # a non-zero exit status causes SABnzbd to ignore the output of this script

prio = -100  # Default
if int(downloadsize) < 50111222:
    prio = 2

print("1")  # Accept the job
print()
print()
print()
print()
print(prio)
print()

# 0 means OK
sys.exit(0)
             
Thanx to both of you for helping. :) :)

Re: Sort queue according to file size when nzb is added (The 2nd)

Posted: May 25th, 2023, 2:00 am
by jcfp
Great!
gohakn wrote: May 24th, 2023, 2:38 pmand same like August 5th in 2022th WIKI the filesize > must be replaced by <
Fixed in https://github.com/sabnzbd/sabnzbd.gith ... a5ba19e921