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

Dubbing #259

Closed elpaxel closed 3 months ago

elpaxel commented 5 months ago

I have website\provider with tv series in different dubs. So for convenience' sake I need to return something like that:

Dubs -- Seasons ---- Episodes ------ Streams

As I understand it, this is impossible to do now. I could do something like:

Seasons -- Episodes ---- Dubs (disguised as streams with redirect to actual streams)

But in most cases dubs have different amount of Seasons\Episodes and I end up sending whole lot unnecessary requests.

Kodi has “folders” that I can arrange however I want. I understand that Stremio will not be doing this due to breaking changes. But Kodi also have "modal windows" that you can call and return selected item. It would be great to have something like that in Stremio.

Lets say in "defineMetaHandler" I call modal window with dubs list and based on the selected dub I then filter "videos". I know this is not the best example. Basically, I need some way to receive user input before loading the "video" list.

jaruba commented 5 months ago

@elpaxel i think you could make an addon config page, so the user chooses the dub language before installing the addon, then you could order seasons/episodes based on the user choice of the dub language

if a user wants multiple dubs, then they can install the addon multiple times with different dub choices, each addon will have a separate catalog of items for each dub choice (so they would select the dub language at catalog level, not stream level)

jaruba commented 5 months ago

here are the docs for addon configuration pages: https://github.com/Stremio/stremio-addon-sdk/blob/master/docs/api/responses/manifest.md#user-data

elpaxel commented 5 months ago

Well, it can be done this way, but it is very inconvenient. Some websites have multiple dubs in the same language from different studios. Of course, I can split the config into different studios, but the main thing is that Stremio lacks a very useful feature.

I thought about it and if not "folders" (that can be generic and can be customized as you like) and not "modals" (that can be called anytime to gather input from user) then maybe some type of dynamic filters can be implemented. Lets say it will be showed before seasons chooser. And you can pass it like:

selectors: [
  {
    name: "dubs",
    list: [
      { name: "Studio 1", id: "studio_1", selected: true }
      { name: "Studio 2", id: "studio_2", selected: false }
    ]
  },
  ... some other selectors ...
],
videos: [... videos from the studio if any ...]

and then something like:

builder.onSelectorChange(function(args){
  ... get new video list based on args.name and args.list.find(l => l.selected).id ...
  return Promise.resolve({ videos });
})

Basically onSelectorChange is a function that mutates videos list. I know it's not that simple because it all has to work through network requests, but it's an extremely useful feature since you can't expect all content to be standardized to just seasons/episodes.

Blockr22 commented 3 months ago

Would really appreciate if Stremio or some addon can play only dubs. We have otaku in Kodi that can play a particular dub. Would luv this functionality to watch dubbed anime's.

dexter21767-dev commented 3 months ago

@elpaxel u can create M3U playlists containing your stream and audio files to add dubs on the fly. https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.4.1

it would look something like this:

#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="https://www.example.com/example1.mp3"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="fr",NAME="French",DEFAULT=NO,AUTOSELECT=YES,URI="https://www.example.com/example2.mp3"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",LANGUAGE="de",NAME="German",DEFAULT=NO,AUTOSELECT=YES,URI="https://www.example.com/example3.mp3"

#EXT-X-STREAM-INF:BANDWIDTH=800000,AUDIO="audio"
https://www.example.com/example.mp4
elpaxel commented 3 months ago

Yes, I can, but in 99% of cases the voiceovers are glued together with the video file. Of course, I can add several video files to one m3u8/mpd file, but at the moment the choice of video file is only available in the ExoPlayer. Stremio has an ExoPlayer built-in, but it’s unlikely they added functionality for selecting a video file (I haven’t checked). Ultimately, Stremio needs to implement the functionality of dynamically loading child nodes because selecting only seasons and episodes is not enough.

[{
    type: "season",
    label: "Season 1",
    children: [{
        type: "episode",
        label: "Episode 1",
        children: [{
            type: "dub",
            label: "Dub 1",
            children: [{
                type: "server",
                label: "Server 1",
                children: [{
                    type: "quality",
                    label: "Quality 1",
                    link: "url"
                }]
            }]
        }]
    }]
}]

Yes, sometimes the structure looks like this.

dexter21767-dev commented 3 months ago

@elpaxel if the voiceovers are part of the video files then i don't see the point of all this, just return the streams and let the user decide which one they wanna watch. just make the titles and descriptions descriptive enough for the user to know which one to pick.

elpaxel commented 3 months ago

As I mentioned in the first post - "I end up sending whole lot unnecessary requests". With "folders" and dynamic loading of child nodes I would send 1 request for every level I choose. To gather all streams with different dubs, servers and qualities I would literally ddos media provider.

dexter21767-dev commented 3 months ago

@elpaxel you don't need to gather all the streams. u can make use of redirects like torrentio does with debrid streams. for example:

{ streams: [
url: 'youraddon.com/someroute/id/ep/dub1/server1/quality1',
url: 'youraddon.com/someroute/id/ep/dub1/server2/quality1',
url: 'youraddon.com/someroute/id/ep/dub1/server2/quality2',
url: 'youraddon.com/someroute/id/ep/dub2/server1/quality1',
url: 'youraddon.com/someroute/id/ep/dub2/server1/quality2'
]}

then in your addon add 'someroute' as route, where it takes the id, ep, dub , server and any other info you need to resolve the stream URL, and return a redirect response to that URL. this way you only need to send requests for the stream the user is trying to watch.

elpaxel commented 3 months ago

Yeah that is the same thing. Lets say there is 3 episodes in Spanish and 4 episodes in English. It will be whole lot "useless" links. Folders like in Kodi is really useful feature. Seasons, episodes and streams is just too little. Stremio team really should just make a switch to new structure. But for now at least mark this issues as "not planned" and not just completed.

dexter21767-dev commented 3 months ago

@elpaxel no idea what u mean by "useless" links. u can add config to filter streams as jaruba mentioned. and it's complete as u didn't provide any reason except that "that's how kodi does it". I already proposed multiple solutions that don't require remaking all of our client apps and breaking all community addons and rendering them useless. but hopefully, this doesn't discourage you from reaching out if u have any other issues.

elpaxel commented 3 months ago

Well I didn't want to post more in-depth examples because I thought my point was more or less obvious and because it involves websites that I DON'T use naturally. But okay I will try my best.

FMovies: https://fmoviesz.to/tv/black-mirror-mvmjz/1-1

  1. Here we have Season/Episode AND Servers. Let say I add config where user sets to always choose Vidplay server. And lets say user chooses episode which is not on the Vidplay server. In that case user needs to go and switch server to MyCloud in the config. Minor inconvenience. But then he chooses another episode and now this episode is on the Vidplay server and the user needs to switch server again.
  2. In case with redirects user don't need to switch server in the config. But you will end up with "not working"/"useless" links. And what I mean is if episode is on Vidplay and not on MyCloud then when you click Vidplay link you will open a video but when you click MyCloud link it will do nothing (or show error whatever).

Rezka: https://rezka.ag/series/fiction/77-chernoe-zerkalo-2011.html

  1. We have Dubs, Seasons and Episodes. Each dub can have different number of Seasons and Episodes. Again nightmare with the config and whole lot of "useless" links with redirects.
  2. Lets say instead of config and redirects I will just take full Seasons/Episodes list from IMDB. And then on each Episode I will scrape dubs. With 13 dubs it will take 13 requests on each episode and 351 request for 6 seasons of Black Mirror. That is ddos that I mentioned.

Both providers also have Qualities that you can choose. It is again config or redirects etc. etc.

Stremio lacks two major features.

  1. Folder structure with dynamic requests on each level of children.
  2. Running addons/scripts locally. I know that you can run addon on local server. What I mean is just injecting addon inside Stremio. Again like KODI does it. Because more and more providers match IP from request to the Server and IP on request to the Stream (video).

Because of this two features Stremio can't be used as frontend for something more complicated.

And you don't need to break anything. You literally can leave everything as is but add separate API. And if some addon will use this API then Stremio will show folders instead of default Seasons/Episodes.

I hope this answers at least some questions.