Stremio / stremio-addon-sdk

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

Access for video path or url i SubtitlesHandler #285

Closed juhacz closed 1 week ago

juhacz commented 1 week ago

I would like to create a plugin that downloads subtitles from the largest Polish subtitle database napiprojekt.pl. The problem is that in SubtitlesHandler I only have access to the OpenSubtitles videoHash, videoSize and filename fields. The problem is that "OpenSubtitles file hash" give me nothing to calculate the hash for napiproekt.pl. I need to read the first 1MB of the file, so I need the url to the file or access to it. Is it possible to gain such access to the video file to obtain the appropriate data?

TRtomasz commented 1 week ago

How do you expect to access video file that is locally on user side? Stremio provides the OS hash so addons can match it.

juhacz commented 1 week ago

I meant the url of the file from the web, debrid etc. or the path to the local file that the user opened. I just need to have access to it to create a hash and look for subtitles. What do you mean by "OS hash"? Can you provide a link to the documentation, I don't really understand what you mean?

TRtomasz commented 1 week ago

https://trac.opensubtitles.org/projects/opensubtitles/wiki/HashSourceCodes

juhacz commented 1 week ago

Of course I saw it, the value is passed to the StreamHandler.

stdClass Object
(
    [type] => series
    [id] => tt8772296:1:1
    [extra] => stdClass Object
        (
            [videoHash] => 76956e15cafbe0c2
            [videoSize] => 949788100
        )

)

But how do I know that the prowided file hash, assign it to an .srt file, of which there are several dozen thousand. I need to calculate the hash using the napiprojekt method, but I do not have access to the file to which I want to download the subtitles.