Stremio / stremio-addon-sdk

🧙 A Node.js SDK for creating and publishing Stremio add-ons
https://www.stremio.com/addon-sdk
MIT License
679 stars 181 forks source link

Subtitles Handler not being called? #58

Closed pabsilva closed 5 years ago

pabsilva commented 5 years ago

Hi,

I am trying to create a subtitle add-on, but I am having trouble getting the call to the defined handler. I've followed the documentation and tried starting from code generated by the the addon-bootstrap, which generated the following code:

const { addonBuilder } = require("stremio-addon-sdk")

// Docs: https://github.com/Stremio/stremio-addon-sdk/blob/master/docs/api/responses/manifest.md
const manifest = {
    "id": "community.TestCoolAddon",
    "version": "0.0.1",
    "catalogs": [],
    "resources": [
        "subtitles"
    ],
    "types": [
        "movie",
        "series"
    ],
    "name": "Test-Cool-Addon",
    "description": "A nice first addon.",
    "idPrefixes": [
        "tt"
    ]
}
const builder = new addonBuilder(manifest)

builder.defineSubtitlesHandler(({type, id}) => {
    console.log("request for subtitles: "+type+" "+id)
    // Docs: https://github.com/Stremio/stremio-addon-sdk/blob/master/docs/api/requests/defineSubtitlesHandler.md
    return Promise.resolve({ subtitles: [] })
})

module.exports = builder.getInterface()

The add-on loads without issues, but the handler defined for the subtitles is not called (I've tried the 'stream' handler, and it was called). Am I missing something?

I looked around for examples featuring subtitles, but I couldn't find any (aside from the documentation), so I'm kind of lost on this matter.

core1024 commented 5 years ago

This is an issue in Stremio. It looks like only the first add-on, that provides subtitles is called. Expect a fix to be rolled soon. Meanwhile you can test your add-on by disabling all other subtitles related add-ons, namely the Open subtitles one.

You can find the subtitles related documentation here.

pabsilva commented 5 years ago

Ah, too bad. I'll try that, then. Thanks for the quick response.

core1024 commented 5 years ago

The issue is fixed in staging. After a couple of hours it will be available to all users.

Bare in mind that the subtitles resource is identified by OpenSubtitles hash and not IMDB ID, so global idPrefixes in your manifest would not match any subtitles.

If your add-on provides only subtitles I suggest you to remove the idPrefixes property from your manifest.

Ivshti commented 5 years ago

@DeadalusVIII we've decided we're making some changes to the way subtitles are requested, that will be rolled out on monday:

https://github.com/Stremio/stremio-addon-sdk/releases/tag/v1.1.4 https://github.com/Stremio/stremio-addon-sdk/blob/v1.1.4/docs/api/requests/defineSubtitlesHandler.md

we've exchanged the place of the opensubtitles hash and the videoId, to make the request consistent with other add-on system requests

pabsilva commented 5 years ago

Makes sense. Thank you for the heads-up!

pedroslopez commented 5 years ago

Hi there! Was this ever actually fixed? My subtitles handler never gets called.

You can even check in the default code that's generated with the addon bootstrap cli. Even there, the subtitles handler is not called. Even after uninstalling all subtitle-providing addons as mentioned above, it still does not get called.

Ivshti commented 5 years ago

This was fixed, our internal tests confirmed it which version of stremio are you using? can you screenshot your settings page?

On Sun, 12 May 2019 at 23:11, Pedro S. Lopez notifications@github.com wrote:

Hi there! Was this ever actually fixed? My subtitles handler never gets called.

You can even check in the default code that's generated with the addon bootstrap cli. Even there, the subtitles handler is not called. Even after uninstalling all subtitle-providing addons as mentioned above, it still does not get called.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Stremio/stremio-addon-sdk/issues/58#issuecomment-491625403, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJQTDNMEWFPPAOOYZM6K43PVB2V7ANCNFSM4G5B7IWQ .

--

[image: photo] Ivo Georgiev Founder & CEO, Stremio

https://www.stremio.com http://www.stremio.com

GPG: AC692BE9EB6E024B5C58A8EAC1E94996BC56BACE http://www.stremio.com http://www.facebook.com/stremio/ http://twitter.com/stremio http://www.instagram.com/stremioofficial/ http://www.reddit.com/r/Stremio/ http://blog.stremio.com/

https://play.google.com/store/apps/details?id=com.stremio.beta https://itunes.apple.com/us/app/stremio/id987232010?mt=8

pedroslopez commented 5 years ago

@Ivshti Thanks for the quick response. I'm testing the add-on via the web staging app (staging.strem.io). In any case, it doesn't work on my installed stremio client either, which is on v4.4.25. What settings would you need to see?

EDIT: Interestingly enough, i uninstalled and installed the add-on again and now it is being called. Worked fine for a bit, then again it didn't seem to be getting called. This time, though, I just backed out of the stream and clicked it again and for whatever reason it worked again.

jaruba commented 5 years ago

@pedroslopez there was a new release made y-day, it should fix the subtitle issues you've been having