[PP-Script / Scan-Script] Automatically Fetch Subtitles

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
l2g
Posts: 185
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by l2g » 18 Mar 2016, 02:14

kramiz1 wrote: INFO Mon Mar 14 2016 22:33:57 Subliminal: ImportError: No module named unicodedata
kramiz1:
unicodedata like your previous error comes with Python (built into it). I'm not sure who's providing you with the python bundles your using, but they're cutting out a lot of libraries/packages in it (maybe to make it compact thus save disk space?).

According to this link, you can type pip install undecode which will download this. I'm not sure if you have shell access with your device. Worth a try though if you do.

kramiz1
Posts: 6
Joined: 10 Mar 2016, 19:43

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by kramiz1 » 19 Mar 2016, 17:37

l2g wrote:
kramiz1 wrote: INFO Mon Mar 14 2016 22:33:57 Subliminal: ImportError: No module named unicodedata
kramiz1:
unicodedata like your previous error comes with Python (built into it). I'm not sure who's providing you with the python bundles your using, but they're cutting out a lot of libraries/packages in it (maybe to make it compact thus save disk space?).

According to this link, you can type pip install undecode which will download this. I'm not sure if you have shell access with your device. Worth a try though if you do.
Changed the python build and downloaded unicode (the command was pip install unidecode, it was misspelled in your link). And it works perfectly! Big thanks for all your help! :D

ulTimaS
Posts: 1
Joined: 20 Mar 2016, 01:06

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by ulTimaS » 20 Mar 2016, 01:16

I don't know if it's just me, but I never get any hits from the opensubtitle provider although there are suitable subtitles found on the website itself. Other providers work fine btw.
For instance Lucifer s01e08 WEB-Dl dutch http://www.opensubtitles.org/en/search/ ... id-4952854 and this is the debug log from the search with the script:

Code: Select all

admin@NAS:/volume1/.@plugins/AppCentral/nzbget/nzbget/scripts $ ./Subliminal.py -f -l nl -k -p opensubtitles -D -S /volume1/Series/Lucifer/Season\ 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG\[rarbg\].mkv
[INFO] [DEBUG] Script mode forced off.
2016-03-20 02:10:49,653 - 27428 - DEBUG - set(config) SKIPEMBEDDED="True"
2016-03-20 02:10:49,653 - 27428 - DEBUG - set(environment) SKIPEMBEDDED="1"
2016-03-20 02:10:49,654 - 27428 - DEBUG - set(config) FORCE="True"
2016-03-20 02:10:49,654 - 27428 - DEBUG - set(environment) FORCE="1"
2016-03-20 02:10:49,655 - 27428 - DEBUG - set(config) PROVIDERS="opensubtitles"
2016-03-20 02:10:49,655 - 27428 - DEBUG - set(environment) PROVIDERS="opensubtitles"
2016-03-20 02:10:49,656 - 27428 - DEBUG - set(config) LANGUAGES="nl"
2016-03-20 02:10:49,656 - 27428 - DEBUG - set(environment) LANGUAGES="nl"
2016-03-20 02:10:49,657 - 27428 - DEBUG - get(default) SCANDIRECTORIES=None
2016-03-20 02:10:49,657 - 27428 - DEBUG - set(config) MAXAGE="24"
2016-03-20 02:10:49,657 - 27428 - DEBUG - set(environment) MAXAGE="24"
2016-03-20 02:10:49,658 - 27428 - DEBUG - set(config) MINSIZE="150"
2016-03-20 02:10:49,658 - 27428 - DEBUG - set(environment) MINSIZE="150"
2016-03-20 02:10:49,659 - 27428 - DEBUG - set(config) MINSCORE="20"
2016-03-20 02:10:49,659 - 27428 - DEBUG - set(environment) MINSCORE="20"
2016-03-20 02:10:49,660 - 27428 - DEBUG - set(config) SYSTEMENCODING="UTF-8"
2016-03-20 02:10:49,660 - 27428 - DEBUG - set(environment) SYSTEMENCODING="UTF-8"
2016-03-20 02:10:49,661 - 27428 - DEBUG - set(config) FETCHMODE="BestScore"
2016-03-20 02:10:49,661 - 27428 - DEBUG - set(environment) FETCHMODE="BestScore"
2016-03-20 02:10:49,662 - 27428 - DEBUG - set(config) VIDEOEXTENSIONS=".mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso"
2016-03-20 02:10:49,662 - 27428 - DEBUG - set(environment) VIDEOEXTENSIONS=".mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso"
2016-03-20 02:10:49,663 - 27428 - DEBUG - set(config) SCANDIRECTORIES="/volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv"
2016-03-20 02:10:49,663 - 27428 - DEBUG - set(environment) SCANDIRECTORIES="/volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv"
2016-03-20 02:10:49,664 - 27428 - DEBUG - get(config) SCANDIRECTORIES="/volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv"
2016-03-20 02:10:49,664 - 27428 - DEBUG - get(config) VIDEOEXTENSIONS=".mkv,.avi,.divx,.xvid,.mov,.wmv,.mp4,.mpg,.mpeg,.vob,.iso"
2016-03-20 02:10:49,665 - 27428 - DEBUG - get(config) MAXAGE="24"
2016-03-20 02:10:49,665 - 27428 - DEBUG - get(config) MINSIZE="150"
2016-03-20 02:10:49,666 - 27428 - DEBUG - get(config) FORCE="True"
2016-03-20 02:10:49,666 - 27428 - DEBUG - get(config) SCANDIRECTORIES="/volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv"
2016-03-20 02:10:49,675 - 27428 - DEBUG - get(default) XREFPATHS=None
2016-03-20 02:10:49,675 - 27428 - DEBUG - get(default) SINGLE="False"
2016-03-20 02:10:49,677 - 27428 - DEBUG - get_files('/volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv') with 11 filter(s)
2016-03-20 02:10:49,678 - 27428 - DEBUG - Allowed Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv (suffix)
2016-03-20 02:10:49,678 - 27428 - INFO - Found 1 matched file(s).
2016-03-20 02:10:49,679 - 27428 - DEBUG - Scanning "/volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv" (1684.88 MB)
2016-03-20 02:10:49,679 - 27428 - DEBUG - get(system) TEMPDIR="/tmp/nzbget-admin"
2016-03-20 02:10:49,680 - 27428 - DEBUG - get(default) CACHEDIR="/tmp/nzbget-admin"
2016-03-20 02:10:49,680 - 27428 - DEBUG - get(default) FORCEENCODING="None"
2016-03-20 02:10:49,681 - 27428 - DEBUG - get(config) MINSCORE="20"
2016-03-20 02:10:49,681 - 27428 - DEBUG - get(config) SKIPEMBEDDED="True"
2016-03-20 02:10:49,682 - 27428 - DEBUG - get(default) SEARCHMODE="advanced"
2016-03-20 02:10:49,682 - 27428 - INFO - Using advanced search mode
2016-03-20 02:10:49,683 - 27428 - DEBUG - get(default) MOVIEPROVIDERS=""
2016-03-20 02:10:49,683 - 27428 - DEBUG - get(config) PROVIDERS="opensubtitles"
2016-03-20 02:10:49,684 - 27428 - DEBUG - get(default) TVSHOWPROVIDERS=""
2016-03-20 02:10:49,684 - 27428 - DEBUG - get(config) PROVIDERS="opensubtitles"
2016-03-20 02:10:49,685 - 27428 - DEBUG - Using the following movie providers: opensubtitles
2016-03-20 02:10:49,685 - 27428 - DEBUG - Using the following tv show providers: opensubtitles
2016-03-20 02:10:49,686 - 27428 - DEBUG - get(config) LANGUAGES="nl"
2016-03-20 02:10:49,686 - 27428 - DEBUG - get(config) FETCHMODE="BestScore"
2016-03-20 02:10:49,687 - 27428 - DEBUG - Fetch Mode: BestScore
2016-03-20 02:10:49,763 - 27428 - DEBUG - get(config) SYSTEMENCODING="UTF-8"
2016-03-20 02:10:49,808 - 27428 - DEBUG - get_files('/volume1/Series/Lucifer/Season 1') with 1 filter(s)
2016-03-20 02:10:49,812 - 27428 - DEBUG - Scanning [advanced] using /volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv lang=nl
2016-03-20 02:10:49,813 - 27428 - DEBUG - get(default) TVCATEGORIES="[]"
2016-03-20 02:10:49,814 - 27428 - DEBUG - Guessing using: /volume1/Series/Lucifer/Season 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv
2016-03-20 02:10:51,320 - 27428 - DEBUG - Type: series
2016-03-20 02:10:51,321 - 27428 - INFO - Scanning video 'Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv' in '/volume1/Series/Lucifer/Season 1'
2016-03-20 02:10:51,322 - 27428 - DEBUG - Size is 1766728682
2016-03-20 02:10:51,455 - 27428 - DEBUG - Computed hashes {u'opensubtitles': u'8c049c7ee8922ffc', u'thesubdb': u'360d5d02b0c34b3b0dfb97b93995d469'}
2016-03-20 02:10:51,456 - 27428 - DEBUG - Found subtitles set([])
2016-03-20 02:10:51,588 - 27428 - DEBUG - Found video_codec h264 with enzyme
2016-03-20 02:10:51,589 - 27428 - DEBUG - Found audio_codec AC3 with enzyme
2016-03-20 02:10:51,825 - 27428 - DEBUG - Skipping provider 'thesubdb': not in the list
2016-03-20 02:10:51,827 - 27428 - DEBUG - Skipping provider 'podnapisi': not in the list
2016-03-20 02:10:51,828 - 27428 - DEBUG - Skipping provider 'addic7ed': not in the list
2016-03-20 02:10:51,830 - 27428 - DEBUG - Skipping provider 'tvsubtitles': not in the list
2016-03-20 02:10:51,831 - 27428 - INFO - Listing subtitles with provider 'opensubtitles' for video <Episode [u'Lucifer', 1x8]> with languages set([<Language [nl]>])
2016-03-20 02:10:51,833 - 27428 - DEBUG - Searching subtitles [{u'moviebytesize': '1766728682', u'sublanguageid': u'dut', u'moviehash': u'8c049c7ee8922ffc'}]
2016-03-20 02:10:51,890 - 27428 - DEBUG - No subtitle found
2016-03-20 02:10:51,891 - 27428 - INFO - Found 0 subtitle(s) on opensubtitles
2016-03-20 02:10:51,946 - 27428 - WARNING - No subtitles were found for Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv

edit: I came to the conclusion that in my case it is probably better to just use the subliminal package direcly on my NAS and use a cronjob for full automation instead of doing it through nzbget. Since I'm really a Linux novice I tried to find the easiest solution for subtitle automation, but after i saw that your script didn't work the way I wanted I had to find another solution. I got subliminal to work now on my asustor NAS and learned a lot more about Linux in the process so I thank you for that!

l2g
Posts: 185
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by l2g » 24 Mar 2016, 01:52

ulTimaS wrote:I don't know if it's just me, but I never get any hits from the opensubtitle provider although there are suitable subtitles found on the website itself. Other providers work fine btw.
For instance Lucifer s01e08 WEB-Dl dutch http://www.opensubtitles.org/en/search/ ... id-4952854
Unfortunately, the link you provided doesn't actually contain subtitles that match the video you're inquiring on; so this script isn't completely failing you at all.
Screenshot from 2016-03-23 21-29-35.png
First consider the filename you're using: Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG[rarbg].mkv

The matches (and we know there are only 2) are based on weighting system. In your search below, you're using the default options which are generally pretty good for eliminating false positives. Scoring is done by looking at the video being scanned and trying to find the best possible match. Now in your situation, lets consider the matches found (color identifying the keywords that would match against the original).
Lucifer.S01E08.Et Tu, Doctor.720p.HDTV.X264-DIMENSION.srt and Lucifer.S01E08.Et Tu, Doctor.1080p.WEB-DL.DD5.1.H.264.HKD.srt

Obviously the second is the closest match, but because the group (HDK) doesn't match (RARBG) and your scores are set for accuracy, there was no match. I applaud if other tools you use can have no problem pulling this sub for you and it works, but consider that there is always a chance that it won't. Subs posted by different groups could appear out of sync if they weren't meant for the video they were intended for. But if you want my script to pull it; just lower your scoring from 24 (default) to something like 18 and try again.
this is the debug log from the search with the script:

Code: Select all

admin@NAS:/volume1/.@plugins/AppCentral/nzbget/nzbget/scripts $ ./Subliminal.py -f -l nl -k -p opensubtitles -D -S /volume1/Series/Lucifer/Season\ 1/Lucifer.S01E08.1080p.WEB-DL.DD5.1.H264-RARBG\[rarbg\].mkv
...
...
edit: I came to the conclusion that in my case it is probably better to just use the subliminal package direcly on my NAS and use a cronjob for full automation instead of doing it through nzbget. Since I'm really a Linux novice I tried to find the easiest solution for subtitle automation, but after i saw that your script didn't work the way I wanted I had to find another solution.
Usually this site emails me when someone comments here. Then I come on and address the problem, but I never got an email so i never followed up with the issue. I sincerely apologize for not responding sooner, and I'm also sorry you gave up and never got it working for you. I am glad you found your own solution at the end of the day though!

John2
Posts: 6
Joined: 04 Aug 2016, 13:46

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by John2 » 09 Aug 2016, 17:27

Thank you very much for the script!!
Working great!

hang10z
Posts: 4
Joined: 27 Sep 2015, 16:26

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by hang10z » 25 Jun 2017, 23:35

I'm getting an error when using this, I assume it has something to do with the python packages that are installed on my ubuntu server. I have full root access, just not sure how to resolve it. Thanks for the assistance. BTW I replaced the download title name so don't mind the goofy movie name. :lol: 8-)

EDIT: I have Python 2.7.12 installed
python2.7 --version
Python 2.7.12

Code: Select all

ERROR	Sun Jun 25 2017 19:22:41	Post-process-script nzbget-subliminal-0.9.9/Subliminal.py for DOWNLOAD TITLE GOES HERE LOL failed (terminated with unknown status)
INFO	Sun Jun 25 2017 19:22:41	Subliminal: ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /usr/lib/python2.7/dist-packages
INFO	Sun Jun 25 2017 19:22:41	Subliminal: "with distribute. Found one at %s" % str(self.location))
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2278, in insert_on
INFO	Sun Jun 25 2017 19:22:41	Subliminal: self.insert_on(path)
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2177, in activate
INFO	Sun Jun 25 2017 19:22:41	Subliminal: add_activation_listener(lambda dist: dist.activate())
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2675, in <lambda>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: callback(dist)
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 662, in subscribe
INFO	Sun Jun 25 2017 19:22:41	Subliminal: add_activation_listener(lambda dist: dist.activate())
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2675, in <module>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: import pkg_resources
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/guessit/__init__.py", line 23, in <module>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: from guessit import matcher
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal.py", line 333, in <module>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: Traceback (most recent call last):
INFO	Sun Jun 25 2017 19:22:41	Executing post-process-script nzbget-subliminal-0.9.9/Subliminal.py for DOWNLOAD TITLE GOES HERE LOL

ronajon
Posts: 1
Joined: 26 Jun 2017, 13:54

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by ronajon » 26 Jun 2017, 13:58

easiest (and dirtiest) way is to change value '0.7' on line 2275 of file 'Subliminal/pkg_resources.py to another value. eg 0.6
hang10z wrote:
25 Jun 2017, 23:35
I'm getting an error when using this, I assume it has something to do with the python packages that are installed on my ubuntu server. I have full root access, just not sure how to resolve it. Thanks for the assistance. BTW I replaced the download title name so don't mind the goofy movie name. :lol: 8-)

EDIT: I have Python 2.7.12 installed
python2.7 --version
Python 2.7.12

Code: Select all

ERROR	Sun Jun 25 2017 19:22:41	Post-process-script nzbget-subliminal-0.9.9/Subliminal.py for DOWNLOAD TITLE GOES HERE LOL failed (terminated with unknown status)
INFO	Sun Jun 25 2017 19:22:41	Subliminal: ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /usr/lib/python2.7/dist-packages
INFO	Sun Jun 25 2017 19:22:41	Subliminal: "with distribute. Found one at %s" % str(self.location))
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2278, in insert_on
INFO	Sun Jun 25 2017 19:22:41	Subliminal: self.insert_on(path)
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2177, in activate
INFO	Sun Jun 25 2017 19:22:41	Subliminal: add_activation_listener(lambda dist: dist.activate())
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2675, in <lambda>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: callback(dist)
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 662, in subscribe
INFO	Sun Jun 25 2017 19:22:41	Subliminal: add_activation_listener(lambda dist: dist.activate())
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/pkg_resources.py", line 2675, in <module>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: import pkg_resources
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal/guessit/__init__.py", line 23, in <module>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: from guessit import matcher
INFO	Sun Jun 25 2017 19:22:41	Subliminal: File "/opt/nzbget/scripts/nzbget-subliminal-0.9.9/Subliminal.py", line 333, in <module>
INFO	Sun Jun 25 2017 19:22:41	Subliminal: Traceback (most recent call last):
INFO	Sun Jun 25 2017 19:22:41	Executing post-process-script nzbget-subliminal-0.9.9/Subliminal.py for DOWNLOAD TITLE GOES HERE LOL

hang10z
Posts: 4
Joined: 27 Sep 2015, 16:26

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by hang10z » 26 Jun 2017, 17:51

ronajon wrote:
26 Jun 2017, 13:58
easiest (and dirtiest) way is to change value '0.7' on line 2275 of file 'Subliminal/pkg_resources.py to another value. eg 0.6
That worked ronajon... Thank you for your help!

ulrick65
Posts: 9
Joined: 10 May 2016, 13:49

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by ulrick65 » 16 Jul 2017, 16:24

Awesome script! Well done.

I am new to downloading subs...ignored them for years, but since I am getting deaf in my old age I find them useful now, so this script is great.

Got a question though: I have files that get downloaded with the subs in the .rar file already (and a .idx file). I can extract the .rar automatically, but I can't see a way to get Subliminal to skip processing if the .idx and .sub already exist. I see where to do it if they already are embedded in the file...but not for .sub

Any pointers or help on this would be appreciated. Also, any pointers in general around subs would be welcome. I would love to embed them automatically in the mkv if that was possible.

Thanks.

l2g
Posts: 185
Joined: 27 Jun 2014, 22:13
Contact:

Re: [PP-Script / Scan-Script] Automatically Fetch Subtitles

Post by l2g » 17 Jul 2017, 12:53

ulrick65 wrote:
16 Jul 2017, 16:24
I can't see a way to get Subliminal to skip processing if the .idx and .sub already exist. I see where to do it if they already are embedded in the file...but not for .sub
That is a really good request; I definitely don't consider those extensions prior to fetching subs, but i should! Give me a few days (worst case, not until the weekend) and I'll see if i can push an update to this script to handle this.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests