Page 1 of 1

SABnzbd Python3 - 3.0.0-develop: Multicore Par2

Posted: May 1st, 2019, 12:44 pm
by thegreatnorth
Does anyone know if the Python3 - 3.0.0-develop can use Multicore Par2 yet?

I am using Ubuntu 19.04 and just testing git clone version of SABnzbd (python3) from command line
I have Multicore version of Par2 (par2-tbb) installed and working perfectly with SABnzbd 2.3.8
Python3 3.0.0 finds par2 binary but then on main config page it says Mulitcore Par2 "Not available"

Being a new user it will not let me insert my log...

Re: SABnzbd Python3 - 3.0.0-develop

Posted: May 1st, 2019, 12:52 pm
by sander
Great that you're testing it.

I use Ubuntu too, so here we go:

$ par2 -V
par2cmdline version 0.8.0


after install par2-tbb:

$ par2 -V | head -4
Not enough command line arguments.
par2cmdline version 0.4, Copyright (C) 2003 Peter Brian Clements.
Modifications for concurrent processing, Unicode support, and hierarchial
directory support are Copyright (c) 2007-2015 Vincent Tan.
Concurrent processing utilises Intel Thread Building Blocks 4.3 Update 1,

OK, installed


With SAB-py2: on the main config page "Multicore Par2" has a check mark.
With SAB-py3: ... it says "Not available Speed up repairs by installing multicore Par2, it is available for many platforms." ...

Ouch.

Relevant code

Code: Select all

sabnzbd.newsunpack.PAR2_MT = par2_mt_check(sabnzbd.newsunpack.PAR2_COMMAND)


ah, an exception;

'in <string>' requires string as left operand, not bytes

Code: Select all

2019-05-01 20:17:22,752::DEBUG::[newsunpack:2221] SJ0:
'in <string>' requires string as left operand, not bytes
2019-05-01 20:17:22,752::INFO::[SABnzbd:378] SABYenc module (v4.0.0)... found!

Code: Select all

def par2_mt_check(par2_path):
    """ Detect if we have multicore par2 variants """
    try:
        par2_version = run_simple([par2_path, '-h'])
        logging.debug("SJ: %s", par2_version)
        # Look for a threads option
        logging.debug("SJ0:")
        found = b'-t<' in par2_version
        logging.debug("SJ2: %s:", found)
        found = '-t<' in par2_version
        logging.debug("SJ3: %s:", found)
        logging.debug("SJ4")
        if b'-t<' in par2_version:
            return True

    except Exception as ex:
        print(ex)
        pass
    return False

Re: SABnzbd Python3 - 3.0.0-develop: Multicore Par2

Posted: May 1st, 2019, 1:24 pm
by sander
OK,

It's this line:

https://github.com/sabnzbd/sabnzbd/blob ... k.py#L2220

If I remove the "b", it works for me.

BUT: @shypike has introduced that "b" in the python3 version (it's not there in the python2 version), so I wonder why? Or was it introduced by an overactive automatic 2to3 mechanism?

Re: SABnzbd Python3 - 3.0.0-develop: Multicore Par2

Posted: May 1st, 2019, 1:32 pm
by thegreatnorth
Ok great thanks!
I've removed the "b" and it's now giving me the big checkmark. I will continue to test and report back if anything strange occurs

Re: SABnzbd Python3 - 3.0.0-develop: Multicore Par2

Posted: May 1st, 2019, 1:36 pm
by sander
thegreatnorth wrote: May 1st, 2019, 1:32 pm Ok great thanks!
I've removed the "b" and it's now giving me the big checkmark. I will continue to test and report back if anything strange occurs
Cool & cool. Best place for bug reports is https://github.com/sabnzbd/sabnzbd/issues , with [py3] in the subject.

Please continue testing!

Re: SABnzbd Python3 - 3.0.0-develop: Multicore Par2

Posted: May 1st, 2019, 2:17 pm
by safihre
Thanks for testing! Good find and indeed a bug :)

Re: SABnzbd Python3 - 3.0.0-develop: Multicore Par2

Posted: May 1st, 2019, 3:00 pm
by sander

Re: SABnzbd Python3 - 3.0.0-develop: Multicore Par2

Posted: May 2nd, 2019, 1:44 am
by safihre
Merged, should now work again if you do a `git pull`.