[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.
kloaknet
Posts: 335
Joined: 23 Jul 2014, 08:52

Re: [PP-Script] Automatically Fetch Subtitles

Post by kloaknet » 09 Sep 2014, 14:31

could it be true that for the scheduler the auto subs lookup doesnt work? I have set it to an age 48 hours, but the releases are skipped. It were rather old (about 1 year) posts, but downloaded in the last 2 days. Forcing the ppscript to be run via the history worked

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

Re: [PP-Script] Automatically Fetch Subtitles

Post by l2g » 09 Sep 2014, 18:04

kloaknet wrote:could it be true that for the scheduler the auto subs lookup doesnt work? I have set it to an age 48 hours, but the releases are skipped. It were rather old (about 1 year) posts, but downloaded in the last 2 days. Forcing the ppscript to be run via the history worked
I'm very confident that part is working... If your using linux, you could just 'touch' the file which changes it's modification date to be .... well 'now'. or the time you touched it.
if your using Windows, there is this article here: http://superuser.com/questions/10426/wi ... mand-touch. But you might be able to just access the properties of the file and take away it's read permission (or any permission) and then re-add it. That should touch the file in some way (updating it's modification date to a current time.)

Once the modification date is within the 48hr window you said your set to, it will process it with the scheduler. Alternatively, change 48 to 8760 (1 year) or even 17520 (2 years). But keep in mind, this will cause your scheduler to scan and attempt to fetch a lot more content that is missing subs. It's good to keep the scheduler time low and just 'touch' the file you want to rescan with.

FINALLY as a last option, since you know the specific show/movie you want to fetch, just run subliminal from the command line.

Code: Select all

Subliminal.py -f -S /path/to/your/show
(the -f forces a check reguardless of the file age)

Hope this helps!

kloaknet
Posts: 335
Joined: 23 Jul 2014, 08:52

Re: [PP-Script] Automatically Fetch Subtitles

Post by kloaknet » 10 Sep 2014, 13:58

thanks, I ll keep a watch on it, I am running on a linux based system, so it should be ok.

regarding the manual trick, I just go to the history, click the file, post process, tick subliminal, actions and post process the release again :)

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

Re: [PP-Script] Automatically Fetch Subtitles

Post by l2g » 14 Sep 2014, 17:59

I got podnapisi working again. I had to do some Subliminal Core changes to make it possible allowing for their new web page structure. As it turned out, the changes werent as in depth as I original though. All patched content pushed to GitHub and version incremented to v0.8.0.

The main link has been updated (the first post of this thread), but to save you the extra click, you can access the same direct link (v0.8.0) here.

Note: I can not however reproduce Ayla's bug involving a fetch of english and danish subs but french subs coming down instead. That is just weird. I can't see anywhere in the code that would ever cause that to happen and has not happened to me yet. Ayla, if it happens again, the only thing i can suggest is that you make sure DebugMode is also set to Yes so that you fetch me more details. There simply isn't enough logging in what you captured without debugging enabled. Also please let me know if it happens with AdvanceMode set or BasicMode. I'm still wondering if this is related to enzyme.

Garret
Posts: 6
Joined: 17 Oct 2013, 10:05

Re: [PP-Script] Automatically Fetch Subtitles

Post by Garret » 14 Sep 2014, 20:51

I do not understand why when I copied the Sublimnal.py and its folder to the ppscript folder I cannot see the Subliminal script tab in the NZBget webui settings.
Of course I also tried to restart NZbget.

I have other scripts like videosort and they work perfectly. Why the 0.8.0 does not appear in the settings menu?

I have NZBget 12.0.

hugbug
Developer & Admin
Posts: 7542
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [PP-Script] Automatically Fetch Subtitles

Post by hugbug » 14 Sep 2014, 21:09

The script has a script signature which requires v13:

Code: Select all

### NZBGET POST-PROCESSING/SCHEDULER SCRIPT
If you change it to (there are two lines, both must be changed):

Code: Select all

### NZBGET POST-PROCESSING SCRIPT
it will show up in v12 but I can't say if the script will work with v12. You can test.

Moolan
Posts: 14
Joined: 22 Sep 2014, 09:40

Re: [PP-Script] Automatically Fetch Subtitles

Post by Moolan » 22 Sep 2014, 09:44

Hi,

I have tried running this script on different shows; most worked fine e.g. Suits, Simpsons but there is one that keeps giving error and I have no idea how to fix it.

Input:

Code: Select all

Usernames-Mac-Mini:~ Username$ python /Users/Username/Library/Application\ Support/NZBGet/scripts/Subliminal/Subliminal.py -f -S /Users/Username/Movies/TV\ Shows/True\ Blood/Season\ 07/True\ Blood\ -\ S07E02\ -\ I\ Found\ You.mkv
Output:

Code: Select all

2014-09-22 19:13:27,809 - 2867 - INFO - Found 1 matched file(s).
2014-09-22 19:13:27,810 - 2867 - INFO - Using advanced search mode
2014-09-22 19:13:27,811 - 2867 - INFO - Using the following providers: podnapisi, opensubtitles, addic7ed, thesubdb, tvsubtitles
2014-09-22 19:13:27,811 - 2867 - WARNING - Addic7ed provider dropped due to missing credentials
2014-09-22 19:13:27,823 - 2867 - INFO - Scanning video 'True Blood - S07E02 - I Found You.mkv' in '/Users/Username/Movies/TV Shows/True Blood/Season 07'
2014-09-22 19:13:29,121 - 2867 - INFO - Skipping provider 'tvsubtitles': no video to search for
2014-09-22 19:13:29,121 - 2867 - INFO - Listing subtitles with provider 'podnapisi' for video <Movie [u'True Blood']> with languages set([<Language [en]>])
2014-09-22 19:13:31,990 - 2867 - INFO - Found 30 subtitles
2014-09-22 19:13:31,990 - 2867 - INFO - Listing subtitles with provider 'thesubdb' for video <Movie [u'True Blood']> with languages set([<Language [en]>])
2014-09-22 19:13:32,496 - 2867 - INFO - Found 0 subtitles
2014-09-22 19:13:32,497 - 2867 - INFO - Listing subtitles with provider 'opensubtitles' for video <Movie [u'True Blood']> with languages set([<Language [en]>])
2014-09-22 19:13:33,031 - 2867 - INFO - Found 2 subtitles
2014-09-22 19:13:33,051 - 2867 - INFO - Computed score 13 with matches set([u'title'])
2014-09-22 19:13:33,058 - 2867 - INFO - Computed score 13 with matches set([u'title'])
2014-09-22 19:13:33,064 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,071 - 2867 - INFO - Computed score 13 with matches set([u'title'])
2014-09-22 19:13:33,086 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,095 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,109 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,125 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,139 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,146 - 2867 - INFO - Computed score 13 with matches set([u'title'])
2014-09-22 19:13:33,154 - 2867 - INFO - Computed score 13 with matches set([u'title'])
2014-09-22 19:13:33,161 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,169 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,175 - 2867 - INFO - Computed score 15 with matches set([u'video_codec', u'title'])
2014-09-22 19:13:33,182 - 2867 - INFO - Computed score 13 with matches set([u'title'])
2014-09-22 19:13:33,645 - 2867 - ERROR - Fatal Exception:
  Traceback (most recent call last):
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/nzbget/ScriptBase.py", line 2096, in run
    exit_code = main_function(*args, **kwargs)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal.py", line 848, in main
    use_nzbheaders=False,
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal.py", line 621, in subliminal_fetch
    hi_score_adjust=hi_score_adjust,
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/subliminal/api.py", line 249, in download_best_subtitles
    for subtitle, score in sorted([(s, s.compute_score(video)) for s in subtitles],
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/subliminal/subtitle.py", line 56, in compute_score
    initial_matches = self.compute_matches(video)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/subliminal/providers/podnapisi.py", line 69, in compute_matches
    matches |= compute_guess_matches(video, guessit.guess_movie_info(release + '.mkv'))
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/__init__.py", line 229, in guess_movie_info
    return guess_file_info(filename, info=info, options=options, type='movie', **kwargs)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/__init__.py", line 170, in guess_file_info
    result.append(_guess_filename(filename, options, **kwargs))
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/__init__.py", line 109, in _guess_filename
    mtree = _build_filename_mtree(filename, options=options, **kwargs)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/__init__.py", line 115, in _build_filename_mtree
    mtree = IterativeMatcher(filename, options=options, **kwargs)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/matcher.py", line 105, in __init__
    self._process(transformer, False)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/matcher.py", line 120, in _process
    transformer.process(self.match_tree, self.options)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/transfo/guess_filetype.py", line 193, in process
    filetype, other = self.guess_filetype(mtree, options)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/transfo/guess_filetype.py", line 139, in guess_filetype
    guess = episode_transformer.guess_episodes_rexps(filename)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/transfo/guess_episodes_rexps.py", line 74, in guess_episodes_rexps
    return self.container.as_guess(found, string)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/containers.py", line 449, in as_guess
    value = self._effective_prop_value(prop, group_name, input, match.span(group_name) if group_name else match.span(), sep_replacement)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/containers.py", line 482, in _effective_prop_value
    value = prop.format(value, group_name)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/containers.py", line 223, in format
    return formatter(value)
    File "/Users/Username/Library/Application Support/NZBGet/scripts/Subliminal/Subliminal/guessit/patterns/numeral.py", line 150, in parse_numeral
    raise ValueError('Invalid numeral: ' + value)
  ValueError: Invalid numeral: One
Any advise?

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

Re: [PP-Script] Automatically Fetch Subtitles

Post by l2g » 23 Sep 2014, 19:17

Moolan,
Thanks for providing all that detail. I can't unfortunately reproduce what your experiencing. Here is what i did to test it:

Code: Select all

#> mkdir -p tmp/True\ Blood/Season\ 07
#> touch 'tmp/True Blood/Season 07/True Blood - S07E02 - I Found You.mkv'
#> ./Subliminal.py -f -S tmp/True\ Blood/Season\ 07/True\ Blood\ -\ S07E02\ -\ I\ Found\ You.mkv 
2014-09-23 15:04:34,933 - 25709 - INFO - Found 1 matched file(s).
2014-09-23 15:04:34,933 - 25709 - INFO - Using advanced search mode
2014-09-23 15:04:34,934 - 25709 - INFO - Using the following providers: podnapisi, opensubtitles, addic7ed, thesubdb, tvsubtitles
2014-09-23 15:04:34,934 - 25709 - WARNING - Addic7ed provider dropped due to missing credentials
2014-09-23 15:04:35,038 - 25709 - INFO - Scanning video 'True Blood - S07E02 - I Found You.mkv' in 'tmp/True Blood/Season 07'
2014-09-23 15:04:35,433 - 25709 - WARNING - Size is lower than 10MB: hashes not computed
2014-09-23 15:04:35,454 - 25709 - ERROR - Parsing video metadata with enzyme failed
2014-09-23 15:04:37,623 - 25709 - INFO - Skipping provider 'thesubdb': no video to search for
2014-09-23 15:04:37,630 - 25709 - INFO - Listing subtitles with provider 'podnapisi' for video <Episode [u'True Blood', 7x2]> with languages set([<Language [en]>])
2014-09-23 15:04:38,779 - 25709 - INFO - Found 3 subtitles
2014-09-23 15:04:38,779 - 25709 - INFO - Listing subtitles with provider 'opensubtitles' for video <Episode [u'True Blood', 7x2]> with languages set([<Language [en]>])
2014-09-23 15:04:39,581 - 25709 - INFO - Found 4 subtitles
2014-09-23 15:04:39,581 - 25709 - INFO - Listing subtitles with provider 'tvsubtitles' for video <Episode [u'True Blood', 7x2]> with languages set([<Language [en]>])
2014-09-23 15:04:46,112 - 25709 - INFO - Found 1 subtitles
2014-09-23 15:04:46,216 - 25709 - INFO - Computed score 35 with matches set([u'series', u'episode', u'season'])
2014-09-23 15:04:46,230 - 25709 - INFO - Computed score 35 with matches set([u'episode', u'season', u'series', u'title'])
2014-09-23 15:04:46,267 - 25709 - INFO - Computed score 35 with matches set([u'series', u'episode', u'season'])
2014-09-23 15:04:46,276 - 25709 - INFO - Computed score 35 with matches set([u'series', u'episode', u'season'])
2014-09-23 15:04:46,285 - 25709 - INFO - Computed score 35 with matches set([u'series', u'episode', u'season'])
2014-09-23 15:04:46,294 - 25709 - INFO - Computed score 35 with matches set([u'series', u'episode', u'season'])
2014-09-23 15:04:46,303 - 25709 - INFO - Computed score 35 with matches set([u'series', u'episode', u'season'])
2014-09-23 15:04:46,303 - 25709 - INFO - Computed score 35 with matches set([u'series', u'episode', u'season'])
2014-09-23 15:04:46,303 - 25709 - INFO - Downloading subtitle <PodnapisiSubtitle [en]> with score 35 into u'tmp/True Blood/Season 07/True Blood - S07E02 - I Found You.en.srt'
2014-09-23 15:04:49,813 - 25709 - INFO - Matched 1 possible subtitle(s) for True Blood - S07E02 - I Found You.mkv
# It all worked fine for me...
That said, a few things strike me as kind of odd from your output. Specifically from the podnapisi provider... Your output claims it found 30 subtitles from here?! Yet there are only 3 subtitles that actually match the title in your example (on podnapisi). Are you using the v0.8 code i posted (as podnapisi recently had some changes to it's website). It's possible you're experiencing a bug using the old code? Or there is a new bug that i didn't consider when i updated that module that is crashing for you? Perhaps their website was just giving you weird results on that day? Is it still happening now?

One thing you could try is just running the scan again and excluding podnapisi as one of the providers.. With respect to your previous post, here is an example of what i mean:

Code: Select all

python /Users/Username/Library/Application\ Support/NZBGet/scripts/Subliminal/Subliminal.py -p opensubtitles,tvsubtitles,thesubdb -f -S /Users/Username/Movies/TV\ Shows/True\ Blood/Season\ 07/True\ Blood\ -\ S07E02\ -\ I\ Found\ You.mkv

Moolan
Posts: 14
Joined: 22 Sep 2014, 09:40

Re: [PP-Script] Automatically Fetch Subtitles

Post by Moolan » 23 Sep 2014, 21:47

Hi l2g,

A bit more information. I have a fresh install of Maverick OS X 10.9.5 running on a Mac Mini. I think the python version on it was 2.7.5 (will confirm when I get home). I am using the latest version of the extension script, downloaded as ZIP from github.

The strange thing was I downloaded Plex Subliminal Agent and it gave the exact same error for True Blood. I wonder could it be the way my files are named or I am using an incorrect version of Python. What I can try tonight is isolate an episode and run the newly downloaded script from desktop as well as skipping podnapisi.

Apologies, I am not very tech savvy.

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

Re: [PP-Script] Automatically Fetch Subtitles

Post by l2g » 24 Sep 2014, 02:27

Moolan,
Glad to hear you're using the latest version. I still recommand disabling the podnapisi provider (just as a test) to see if you go farther.

Your tip about having Plex Subliminal Agent installed may be a clue (especially since it's happening through it too). That tells me you have a global shared library (of the same name) being included over-riding the ones I include (specifically the 'subliminal' python package). I followed through to see what the Plex Subliminal Agent source looks like (from their git page) and found out that it has you install the development branch of Subliminal v8.0 (source). If you installed this using pip or easy_install as per their instructions, that version may get used instead of the one i packaged (which is their original 7.4 version).

This can also be proven if you run the following command (i'm curious what gets outputted on your end):

Code: Select all

subliminal --version
Moolan wrote:Apologies, I am not very tech savvy.
That's okay, I don't have a Mac, so i'm on guess work right now :)

As a test, can you uninstall your copy of Subliminal that seems globally installed on your system. This may break your Plex Subliminal Agent, but it will certainly test/rule out my theory.
Alternatively, if you could locate the '../python2.7/site-packages/subliminal/' directory on your system. You could replace it with the one I packaged (also located in your '../nzbget/scripts/Subliminal/subliminal' directory.

This may work too to gracefully uninstall the global version of subliminal. That will allow the tool i provide to automatically source the one i provide instead.

Code: Select all

pip uninstall subliminal
The same could be said with enzyme, and guessit too. But for now i'd just focus on subliminal even though the exception is coming from guessit. I don't think guessit should be processing 27 bogus subtitles anyway (causing it to crash to begin with).

Good luck!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests