i96751414 / plugin.video.flix

Flix - A movie scraper for Kodi
MIT License
7 stars 1 forks source link

im trying to add subtitles to providers but don't know how to cache it. #12

Open teemokin opened 1 month ago

teemokin commented 1 month ago

Hi!

https://github.com/i96751414/plugin.video.flix/compare/master...teemokin:plugin.video.flix:added please check my code changes above.

I managed to pass subtitles from providers to Kodi player. But when I resume an item with the last stream(maybe cached?) it doesn't have subtitles. it's "Do you want to use the previously chosen result?" to be clear

https://github.com/i96751414/plugin.video.flix/blob/5734918b62666bf82607cf798787c2d69f45fa15/lib/providers.py#L92 this is the log of "value" 2024-05-04 00:31:29.518 T:10556 info : [plugin.video.flix] EpisodeItem(id=158300, season=1, episode=4):https://some-site.m3u8|User-Agent=Mozilla

I guess I need to store subtitles URLs as well but it's beyond my ability. I would appreciate your help.

teemokin commented 1 month ago

https://github.com/i96751414/plugin.video.flix/compare/master...teemokin:plugin.video.flix:added

I finally managed to solve the problem, but my new code is a total disaster LOL. I'm not sure which part to edit...

As of now, the 'url' variable must be in dictionary format in script.flix.provider.

ProviderResult( label="With subtitles link", label2="label2", icon=ADDON_ICON, url={ 'url': 'http://link.com/video.mp4', 'ext_subs': ['https://link.com/eng.srt'] } )

current_id = str(item) key = "flix:last_played:" + item.__class__.__name__ # flix:last_played:EpisodeItem value = get_property(key)

It would be better if the 'value' variable is defined as a dictionary type.

i96751414 commented 1 month ago

One option would be to return ProviderResult containing provider_data, which can be any data type you want, and then implement the resolve method. Please have a look a the following dummy implementation, hopefully it makes sense: https://github.com/i96751414/script.flix.dummy/blob/master/lib/provider.py