You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 18, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 18, 2022. It is now read-only.
I am using Linuxserver.ios docker image for NZBGet, and they recently dropped support for Python2 (completely removed it), and running the VideoSort plugin on Python3 gives the following error
VideoSort requires Python 2. The script description clearly states that.
If anyone can port it to Python 3 (and preferably keep it compatible with Python 2), please submit a pull request.
Yes, it does, but Python2 was EOLed in january. (Which you probably knew)
Personally I rolled back the docker container I was using to an older version, and have got the script running again, but it would be really nice to get the script ported to Python3.
I'm not a Python dev, so I don't think I can be of much help, unfortunately .. But just for fun, is there an easy way to run the script standalone with the testdata in the repo?
My fork has Python 3 support. As the most recent commit implies, it's not pretty. I just wanted to get something working for personal use. The tests haven't been updated and it probably doesn't run on Python 2 but if anyone wants to use it as a starting point for a real port/PR then feel free.
I started to work on porting this to python 3 too, and managed to get to a reasonable state using shiv to produce a .pyz file out of this, but then I realized that nzbget itself can't read the extension script metadata out of a pyz file. I think my code would be usable with some tweaking though, and I can submit it as a PR once I have more time to work on it. A few of the unit tests no longer pass due to underlying changes in the latest version of the guessit library.
Ive also managed to install an older version of BZBGet that gets thigns working agian but guess going forwarded there will need to be an update of some sort to videosort
VideoSort requires Python 2. The script description clearly states that.
If anyone can port it to Python 3 (and preferably keep it compatible with Python 2), please submit a pull request.
Just out of curiosity: you have not planned to port the script to a more recent Python version yourself? Is the project abandoned?
Thanks @hugbug. When I try to just run the python3 branch (from a git checkout) I get these errors. This is via the linuxserver docker image, but I also see the same errors just trying to run VideoSort.py locally on my Mac with python 3.8.5:
info | Thu Aug 06 2020 12:56:37 | VideoSort: AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
info | Thu Aug 06 2020 12:56:37 | VideoSort: register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
info | Thu Aug 06 2020 12:56:37 | VideoSort: File "/downloads/scripts/VideoSort/lib/pkg_resources.py", line 1341, in <module>
info | Thu Aug 06 2020 12:56:37 | VideoSort: from pkg_resources import iter_entry_points, EntryPoint
info | Thu Aug 06 2020 12:56:37 | VideoSort: File "/downloads/scripts/VideoSort/lib/babelfish/converters/__init__.py", line 6, in <module>
info | Thu Aug 06 2020 12:56:37 | VideoSort: from .converters import (LanguageConverter, LanguageReverseConverter, LanguageEquivalenceConverter, CountryConverter,
info | Thu Aug 06 2020 12:56:37 | VideoSort: File "/downloads/scripts/VideoSort/lib/babelfish/__init__.py", line 20, in <module>
info | Thu Aug 06 2020 12:56:37 | VideoSort: import babelfish
I didn't see an obvious way to create a release bundle / zip file from the git repo, is there anything I should be doing besides just checking it out in my ScriptDir directory?
Following up, I'm guessing you may want to upgrade the guessit dependency from 2.1.4 to the most recent version, 3.1.1. I did this in my branch and it seemed to work but it broke some unit tests. The root of the problem, though, is probably that all of the script's dependencies are packaged along with it in the git repo, versus using a requirements.txt / pyproject.toml / etc to manage dependencies.
@hugbug is it possible to create a new release? For now, I use your master branch with homebrew Python 3.8 on my Mac:
$ brew install python
$ pip3 --no-cache-dir install guessit
$ pip3 show guessit
Name: guessit
Version: 3.1.1
Summary: GuessIt - a library for guessing information from video filenames.
Home-page: http://guessit.readthedocs.org/
Author: Rémi Alvergnat
Author-email: toilal.dev@gmail.com
License: LGPLv3
Location: /usr/local/lib/python3.8/site-packages
Requires: python-dateutil, rebulk, six, babelfish
$ git clone git@github.com:nzbget/VideoSort.git \
~/Library/Application\ Support/NZBGet/scripts/VideoSort
I noticed this warning:
VideoSort: /Users/me/Library/Application Support/NZBGet/scripts/VideoSort/lib/babelfish/converters/__init__.py:6: UserWarning: Module six was already imported from /Users/me/Library/Application Support/NZBGet/scripts/VideoSort/lib/six.py, but /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python is being added to sys.path
Are there any specific version requirements for this script with Python 2? I have the script working perfectly on a machine at home, but I can't get it to work on my seedbox. I'm getting the same exact error as in the first post of this issue, but I'm not using Python 3.
I've been over the setup with my seedbox's support, and they are kind of stumped. The only difference we determined is that my home system has Python 2.7.16, but the seedbox has 2.7.13. Could this be causing a problem?
We've checked all dependencies (guessit, etc) and everything else is installed correctly. The only difference is the Python version.
I didn't see a release so I just copied your master branch. It seems to work mostly in a fresh freebsd jail with py3, however during the renaming process there is this error:
INFO 2020-12-29 01:37:23 VideoSort: Traceback (most recent call last):
INFO 2020-12-29 01:37:23 VideoSort: File "/downloads/scripts/videosort/VideoSort.py", line 1301, in <module>
INFO 2020-12-29 01:37:23 VideoSort: move_satellites(old_path, new_path)
INFO 2020-12-29 01:37:23 VideoSort: File "/downloads/scripts/videosort/VideoSort.py", line 478, in move_satellites
INFO 2020-12-29 01:37:23 VideoSort: subpart = '.' + guess['subtitle_language'][0].alpha2
INFO 2020-12-29 01:37:23 VideoSort: TypeError: 'Language' object is not subscriptable
Besides the main file that was extracted, this file was also present and I believe the culprit for this code running: 2_English.srt
I'm not a python dev so I'm not entirely sure where to start on this one. Let me know if I can provide more information. Great work updating to py3 so far, very appreciated 👍
Other than this error, it appeared that it had moved the file and renamed it properly, it just failed to cleanup.
Needed this fixed sooner rather than later, so I dug into the code a bit, but it's been 25 years since I've done any python, so 🤷 ...
I think the array of arrays that is returned elsewhere where guessit runs, is being coerced or flattened for the `subtitle_language' property. Removing that array subscript reference and using the property directly works fine.
Also, there appeared to be an issue with the particular comparison of the base and fbase names. That code hasn't changed in years, so I don't know that I understand why it works now that I've inverted that expression - perhaps I don't understand it - it looks to me like it will never move the satellite files if they don't match the base name already.
Using Ubuntu 20.04, nzbget 21.0, python3 and python3-guessit. VideoSort fails with the syntax error below:
Seems to be a syntax problem with the octal directory permissions in pkg_resources.py causing the pp-failure but I can't figure out what?
info Sat Apr 03 2021 22:17:29 Collection QI.S18E16.Rock.n.Roll.EXTENDED.1080p.HEVC.x265-MeGusta added to history
error Sat Apr 03 2021 22:17:29 Post-process-script videosort/VideoSort.py for QI.S18E16.Rock.n.Roll.EXTENDED.1080p.HEVC.x265-MeGusta failed (terminated with unknown status)
info Sat Apr 03 2021 22:17:29 VideoSort: SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
info Sat Apr 03 2021 22:17:29 VideoSort: ^
info Sat Apr 03 2021 22:17:29 VideoSort: def _bypass_ensure_directory(name, mode=0777):
info Sat Apr 03 2021 22:17:29 VideoSort: File "/home/kramer/nzbget/scripts/videosort/lib/pkg_resources.py", line 51
info Sat Apr 03 2021 22:17:29 VideoSort: from pkg_resources import iter_entry_points, EntryPoint
info Sat Apr 03 2021 22:17:29 VideoSort: File "/home/kramer/nzbget/scripts/videosort/lib/babelfish/converters/__init__.py", line 6, in <module>
info Sat Apr 03 2021 22:17:29 VideoSort: from .converters import (LanguageConverter, LanguageReverseConverter, LanguageEquivalenceConverter, CountryConverter,
info Sat Apr 03 2021 22:17:29 VideoSort: File "/home/kramer/nzbget/scripts/videosort/lib/babelfish/__init__.py", line 20, in <module>
On my Qnap TS-431p nas i have Python 3.10 running (cannot downgrade it) and not sure if this is the issue but videosort does not work correctly. I get following error on post process:
VideoSort: Traceback (most recent call last):
VideoSort: File "/share/Download/scripts/videosort/VideoSort.py", line 273, in
VideoSort: import guessit
VideoSort: File "/share/Download/scripts/videosort/lib/guessit/init.py", line 6, in
VideoSort: from .api import guessit, GuessItApi
VideoSort: File "/share/Download/scripts/videosort/lib/guessit/api.py", line 15, in
VideoSort: from rebulk.introspector import introspect
VideoSort: File "/share/Download/scripts/videosort/lib/rebulk/init.py", line 7, in
VideoSort: from .rebulk import Rebulk
VideoSort: File "/share/Download/scripts/videosort/lib/rebulk/rebulk.py", line 8, in
VideoSort: from .match import Matches
VideoSort: File "/share/Download/scripts/videosort/lib/rebulk/match.py", line 8, in
VideoSort: from collections import defaultdict, MutableSequence
VideoSort: ImportError: cannot import name 'MutableSequence' from 'collections' (/opt/lib/python3.10/collections/init.pyc)
I'm guessing python 3.10 fucked something up (but as mentioned i cannot downgrade). Would appreciate if someone could take a look what would fix this issue.
...
VideoSort: from collections import defaultdict, MutableSequence VideoSort: ImportError: cannot import name 'MutableSequence' from 'collections' (/opt/lib/python3.10/collections/init.pyc)
...
I'm guessing python 3.10 fucked something up (but as mentioned i cannot downgrade). Would appreciate if someone could take a look what would fix this issue.
Hi, @Freakadude: while waiting for the next release from the real devs (I'm just some random schmo), you can fix this locally by changing:
from collections import defaultdict, MutableSequence
to
from collections import defaultdict
from collections.abc import MutableSequence
If you're curious, MutaableSequence is an abstract base class, all of which were actually moved to collections.abc in Python 3.3. It's been in a deprecation period (i.e. still usable from the old location, but it caused a deprecation warning) for about nine years, but as of 3.10, that old location was fully removed.
Activity
ohyeahsure commentedon Jun 15, 2020
I'm seeing a similar error, just the line number being different (851 in my case)
shibuyastarbucks commentedon Jun 15, 2020
Also got syntax error on line 851.
hugbug commentedon Jun 15, 2020
VideoSort requires Python 2. The script description clearly states that.
If anyone can port it to Python 3 (and preferably keep it compatible with Python 2), please submit a pull request.
FlyveHest commentedon Jun 15, 2020
Yes, it does, but Python2 was EOLed in january. (Which you probably knew)
Personally I rolled back the docker container I was using to an older version, and have got the script running again, but it would be really nice to get the script ported to Python3.
I'm not a Python dev, so I don't think I can be of much help, unfortunately .. But just for fun, is there an easy way to run the script standalone with the testdata in the repo?
hugbug commentedon Jun 15, 2020
Yes, just run
testsort.pyfrom terminal.shibuyastarbucks commentedon Jun 16, 2020
linuxserver.io provided a workaround to use customized script inside the container: https://blog.linuxserver.io/2019/09/14/customizing-our-containers/
For the time being, a temporary fix is to log into the NZBGet container terminal, and run script below.
And then restart the container.
djl commentedon Jun 18, 2020
My fork has Python 3 support. As the most recent commit implies, it's not pretty. I just wanted to get something working for personal use. The tests haven't been updated and it probably doesn't run on Python 2 but if anyone wants to use it as a starting point for a real port/PR then feel free.
timgilbert commentedon Jun 19, 2020
I started to work on porting this to python 3 too, and managed to get to a reasonable state using shiv to produce a
.pyzfile out of this, but then I realized that nzbget itself can't read the extension script metadata out of a pyz file. I think my code would be usable with some tweaking though, and I can submit it as a PR once I have more time to work on it. A few of the unit tests no longer pass due to underlying changes in the latest version of the guessit library.jouster1974 commentedon Jul 29, 2020
Ive also managed to install an older version of BZBGet that gets thigns working agian but guess going forwarded there will need to be an update of some sort to videosort
taalas commentedon Aug 2, 2020
Just out of curiosity: you have not planned to port the script to a more recent Python version yourself? Is the project abandoned?
#61: python 3 compatibility
hugbug commentedon Aug 6, 2020
I've made some changes for python 3 compatibility. In my limited tests it worked fine with both python 3 and 2. All built-in tests pass.
Please try this version from branch python3.
After a positive feedback I can publish it as a new release.
timgilbert commentedon Aug 6, 2020
Thanks @hugbug. When I try to just run the python3 branch (from a git checkout) I get these errors. This is via the linuxserver docker image, but I also see the same errors just trying to run
VideoSort.pylocally on my Mac with python 3.8.5:I didn't see an obvious way to create a release bundle / zip file from the git repo, is there anything I should be doing besides just checking it out in my
ScriptDirdirectory?timgilbert commentedon Aug 6, 2020
Following up, I'm guessing you may want to upgrade the
guessitdependency from 2.1.4 to the most recent version, 3.1.1. I did this in my branch and it seemed to work but it broke some unit tests. The root of the problem, though, is probably that all of the script's dependencies are packaged along with it in the git repo, versus using arequirements.txt/pyproject.toml/ etc to manage dependencies.5 remaining items
#61: python 3 compatibility
hugbug commentedon Aug 6, 2020
Merged into master. Please use the version from master-branch. It turned out the python3-branch had a few last commits missing.
taalas commentedon Aug 9, 2020
@hugbug Awesome. Thanks for taking the time to look into this.
brettinternet commentedon Sep 5, 2020
Thank you for making the changes in 79604c9. Should we create a new GitHub release to indicate the version increment?
fmunteanu commentedon Sep 12, 2020
@hugbug is it possible to create a new release? For now, I use your master branch with homebrew Python 3.8 on my Mac:
I noticed this warning:
BEisem commentedon Sep 16, 2020
Are there any specific version requirements for this script with Python 2? I have the script working perfectly on a machine at home, but I can't get it to work on my seedbox. I'm getting the same exact error as in the first post of this issue, but I'm not using Python 3.
I've been over the setup with my seedbox's support, and they are kind of stumped. The only difference we determined is that my home system has Python 2.7.16, but the seedbox has 2.7.13. Could this be causing a problem?
We've checked all dependencies (guessit, etc) and everything else is installed correctly. The only difference is the Python version.
hugbug commentedon Sep 16, 2020
@BEisem This topic is about Python 3 support.
For general issues please use forum https://forum.nzbget.net/viewtopic.php?f=8&t=840 or create a separate issue.
tmm1 commentedon Dec 10, 2020
👍 for a new release with py3 support
polizz commentedon Dec 29, 2020
I didn't see a release so I just copied your master branch. It seems to work mostly in a fresh freebsd jail with py3, however during the renaming process there is this error:
Besides the main file that was extracted, this file was also present and I believe the culprit for this code running:
2_English.srtI'm not a python dev so I'm not entirely sure where to start on this one. Let me know if I can provide more information. Great work updating to py3 so far, very appreciated 👍
Other than this error, it appeared that it had moved the file and renamed it properly, it just failed to cleanup.
polizz commentedon Dec 29, 2020
Needed this fixed sooner rather than later, so I dug into the code a bit, but it's been 25 years since I've done any python, so 🤷 ...
I think the array of arrays that is returned elsewhere where guessit runs, is being coerced or flattened for the `subtitle_language' property. Removing that array subscript reference and using the property directly works fine.
Also, there appeared to be an issue with the particular comparison of the base and fbase names. That code hasn't changed in years, so I don't know that I understand why it works now that I've inverted that expression - perhaps I don't understand it - it looks to me like it will never move the satellite files if they don't match the base name already.
I submitted a PR you could refer to here
outtahere commentedon Apr 3, 2021
Using Ubuntu 20.04, nzbget 21.0, python3 and python3-guessit. VideoSort fails with the syntax error below:
Seems to be a syntax problem with the octal directory permissions in pkg_resources.py causing the pp-failure but I can't figure out what?
neutralvibes commentedon Jun 10, 2021
Any chance to get a new release, as the last one was 2018, but python3 support was added 10months ago. Thanks for the work done.
Freakadude commentedon Jan 6, 2022
Hi,
On my Qnap TS-431p nas i have Python 3.10 running (cannot downgrade it) and not sure if this is the issue but videosort does not work correctly. I get following error on post process:
VideoSort: Traceback (most recent call last):
VideoSort: File "/share/Download/scripts/videosort/VideoSort.py", line 273, in
VideoSort: import guessit
VideoSort: File "/share/Download/scripts/videosort/lib/guessit/init.py", line 6, in
VideoSort: from .api import guessit, GuessItApi
VideoSort: File "/share/Download/scripts/videosort/lib/guessit/api.py", line 15, in
VideoSort: from rebulk.introspector import introspect
VideoSort: File "/share/Download/scripts/videosort/lib/rebulk/init.py", line 7, in
VideoSort: from .rebulk import Rebulk
VideoSort: File "/share/Download/scripts/videosort/lib/rebulk/rebulk.py", line 8, in
VideoSort: from .match import Matches
VideoSort: File "/share/Download/scripts/videosort/lib/rebulk/match.py", line 8, in
VideoSort: from collections import defaultdict, MutableSequence
VideoSort: ImportError: cannot import name 'MutableSequence' from 'collections' (/opt/lib/python3.10/collections/init.pyc)
I'm guessing python 3.10 fucked something up (but as mentioned i cannot downgrade). Would appreciate if someone could take a look what would fix this issue.
Thanks!
mikenerone commentedon Jan 18, 2022
Hi, @Freakadude: while waiting for the next release from the real devs (I'm just some random schmo), you can fix this locally by changing:
to
If you're curious,
MutaableSequenceis an abstract base class, all of which were actually moved tocollections.abcin Python 3.3. It's been in a deprecation period (i.e. still usable from the old location, but it caused a deprecation warning) for about nine years, but as of 3.10, that old location was fully removed.Freakadude commentedon Jan 22, 2022
@mikenerone Thx for the suggestion!