• 1
  • 57
  • 58
  • 59(current)
  • 60
  • 61
  • 138
[DEPRECIATED] XBMC Subtitles - Addon Script (previously OpenSubtitles OSD)
gui.py has all the answers Smile line 279?


Code:
zip_subs = os.path.join( self.tmp_sub_dir, "zipsubs.zip")
Is there any way to make this addon appear right after hitting play if there's no subtitle track?
Jani Wrote:Is there any way to make this addon appear right after hitting play if there's no subtitle track?

unfortunately not, that would require changes in xbmc core
amet Wrote:unfortunately not, that would require changes in xbmc core
Too bad. I wonder if the devs would be willing to implement a callback of some sort when a video starts playing? Or has this been discussed earlier?

It'd be something simple as one could register his plugin for this callback in settings or something. Then when the video starts the registered addons would be notified.
Hey!

First of all, thanks for an awesome addon, couldnt be more happy about it Smile

Though I've been having som problems with it.

When I locate the correct sub for my release It wont start the download, the only thing it does is change the words to download and then nothing happens.

The weird thing is that it works with a couple of Movies/tvshows sometimes but most of the times it just freezes.

I have my target for subs to a different folder. Is that part of the problem?

Here is my log: http://pastebin.com/GR3h7RYs

Thank you.
simondagman Wrote:Hey!

First of all, thanks for an awesome addon, couldnt be more happy about it Smile

Though I've been having som problems with it.

When I locate the correct sub for my release It wont start the download, the only thing it does is change the words to download and then nothing happens.

The weird thing is that it works with a couple of Movies/tvshows sometimes but most of the times it just freezes.

I have my target for subs to a different folder. Is that part of the problem?

Here is my log: http://pastebin.com/GR3h7RYs

Thank you.
This is a known problem and it will be fixed in the next version.
You can try the new version, that has not been made public yet, by replacing the folder "/Users/Simon/Library/Application Support/XBMC/addons/script.xbmc.subtitles" with the folder "script.xbmc.subtitles" from this zipfile: https://github.com/amet/script.xbmc.subt...all/master
2.3.5 is in official repo

Code:
2.3.5
- Corrected the fix for the problem of failing services on Unix with unpacking subtitle file

2.3.4
- fixed: On Unix some services failed in using the unpacked subtitle file
- added: more tvshow regex for file mode search
Thank you! It seems like that update solved it!
Okay, so this is where I am so far:
  • I search successfully for the given title, both tv show and movie
  • I open each of the result pages and parse them for the required data
  • I return a valid subtitles_list, filtered by the requested languages
  • I build the correct file URL which is a valid zip file

However when trying to use the built in zip extraction feature the OSD just closes and the new subtitles fail to play.
Amet/anyone, could you try and help me?

Here is the code for downloading the file:
Code:
# Get the file content using geturl()
    content = getURL(url)
    if content:
        # Going to write them to standrad zip file (always zips in sratim)
        local_tmp_file = os.path.join(tmp_sub_dir, "zipsubs.zip")
        log( __name__ ,"%s Saving subtitles to '%s'" % (debug_pretext, local_tmp_file))
        try:
            local_file_handle = open(local_tmp_file, "wb")
            local_file_handle.write(content)
            local_file_handle.close()
        except:
            log( __name__ ,"%s Failed to save subtitles to '%s'" % (debug_pretext, local_tmp_file))
        # Standard output -
        # True iff the file is packed as zip,
        # language of subtitles,
        # filename If file not packed (or if we unpacked it ourselves)
        return True, language, ""

And here is the debug logfile (I'm currently overwriting Titlovi for easier testing and integration):
Code:
20:29:04 T:8020 M:1227710464   DEBUG: ### [XBMC Subtitles-services.Titlovi.service] -  Fetching subtitles using url http://www.sratim.co.il/downloadsubtitle.php?id=57959
20:29:04 T:8020 M:1227710464   DEBUG: ### [XBMC Subtitles-services.Titlovi.service] -  Getting url: http://www.sratim.co.il/downloadsubtitle.php?id=57959
20:29:05 T:8020 M:1227816960   DEBUG: ### [XBMC Subtitles-services.Titlovi.service] -  Saving subtitles to 'C:\Program Files\XBMC\portable_data\userdata\addon_data\script.xbmc.subtitles\sub_tmp\zipsubs.zip'
20:29:05 T:8020 M:1227141120  NOTICE: Regex File Se: 1, Ep: 03,
20:29:05 T:2180 M:1227087872  NOTICE: Closing subtitle stream
20:29:05 T:2180 M:1227087872  NOTICE: Opening Subtitle stream: 0 source: 1025
20:29:05 T:2180 M:1227087872   ERROR: CDVDPlayerSubtitle::OpenStream - Unable to create subtitle parser
20:29:05 T:2180 M:1227083776 WARNING: CDVDPlayer::OpenSubtitleStream - Unsupported stream 0. Stream disabled.

I could of course extract the files myself but since you have a built in operation mode that handles that I'd rather not.


After I work out this bug I still need to fix one annoying problem with the search results (searching for "episode 1" returns episodes 1,10,11,12 etc' - I got a refined re pattern lined up), do some documenting and create the logo artwork Laugh. Almost there...
dont clip the log, also attach the full .py file so that we can test as well.

are you looking for "How I met your mother S01E03"?

did the script create .srt file? did it unzip correctly?

give us something to work with
you might be getting two files in a zip, srt and txt. if txt gets activated it will show nothing.

I think you will have to unzip to the temp location and then specify the .srt file to be moved and activated


Code:
import urllib2
    req_headers = {
    'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13',
    'Referer': 'www.sratim.co.il'}
    request = urllib2.Request(url, headers=req_headers)
    opener = urllib2.build_opener()
    response = opener.open(request)

    content = response.read()
    #content = get_url(url)
    if content:
        # Going to write them to standrad zip file (always zips in sratim)
        local_tmp_file = os.path.join(tmp_sub_dir, "zipsubs.zip")
        log( __name__ ,"%s Saving subtitles to '%s'" % ("", local_tmp_file))
        try:
            local_file_handle = open(zip_subs, "w" + "b")
            local_file_handle.write(content)
            local_file_handle.close()
        except:
            log( __name__ ,"%s Failed to save subtitles to '%s'" % ("", local_tmp_file))
        # Standard output -
        # True iff the file is packed as zip,
        # language of subtitles,
        # filename If file not packed (or if we unpacked it ourselves)
        return True, language, ""
Quote:dont clip the log, also attach the full .py file so that we can test as well.
I'm new to the forum, didn't think that much information would be appreciated... sorry.

Quote:you might be getting two files in a zip, srt and txt. if txt gets activated it will show nothing.
That's exactly it! I assumed the addon will look for resulting srt/sub to play, but when I think of it that's kind of a foolish assumption since some subtitles are .txt and the problem is the content not the extension.


I will fix it using one of the (many) examples that unzip the files in the script itseld and let you know as soon as I have a working version.
remember that the log should be pasted on pastebin.com and the link here if you decide to post it
Thanks, I actually got it working already using one of the other service.py's (only took a couple of minutes Wink). I'm now working on fixing that episode results issue, some cleanup, documentation and then the artwork.

How can I upload the code when I'm done? Could you create a new folder on your Github and set me up with permissions for it?
I'm guessing I'll need help integrating it with the addon, I don't know which files to modify and I don't suppose you'd want me editing them anyway Big Grin
all you need is a new folder in services, let me know once you have it ready and you can e-mail it. or you can fork on github, add the service and request the pull. I will edit the settings.xml to add the radio button for the new service
  • 1
  • 57
  • 58
  • 59(current)
  • 60
  • 61
  • 138

Logout Mark Read Team Forum Stats Members Help
[DEPRECIATED] XBMC Subtitles - Addon Script (previously OpenSubtitles OSD)7