Zaxxon709 / maxql

GNU General Public License v3.0
3 stars 0 forks source link

Just an idea... #1

Closed nebulous42069 closed 9 months ago

nebulous42069 commented 9 months ago

Great tool BTW, just an enhancement idea. How about adding Subtitles on/off for the addons. I know a lot of people like subtitles and would be a good addition. Or if you would like I could add it and create a pull request if your interested. Thanks

Zaxxon709 commented 9 months ago

Thanks. Yes, that could be a useful addition. I usually add a service within Kodi's player settings to handle subtitles but I guess many users use the video add-on instead. It would however need to include the option to choose the language. Just enabling subtitles would only work for one language.

Zaxxon709 commented 9 months ago

@nebulous42069 I decided to have a quick look at this today. However, I noticed shortly into it that some add-ons do not have subtitles as an option. Seren/Ezra are two I've found so far. I did write up the code for choosing the subtitle language and enabling/disabling a few add-ons but stopped there. I'm wondering if this is worth the trouble since adding a service to Kodi's player will handle subtitles for all streams during playback. What do you think?

nebulous42069 commented 9 months ago

@nebulous42069 I decided to have a quick look at this today. However, I noticed shortly into it that some add-ons do not have subtitles as an option. Seren/Ezra are two I've found so far. I did write up the code for choosing the subtitle language and enabling/disabling a few add-ons but stopped there. I'm wondering if this is worth the trouble since adding a service to Kodi's player will handle subtitles for all streams during playback. What do you think?

Yea, your probably right. Axe the idea. Sorry! I havent put enough research into this since I dont use subtitles myself, not sure what the difference is between enabling subtitles in the addon Vs enabling a provider. When i did spend a little time on it it seemed the Enable subtitles option seemed to work better/smoother than an external provider, but cant be sure. So I wonder if the enable subs in the addon actually enables the hard-coded subs in a stream file? Or what exactly the difference is.. Ill look into it a bit more, but for now I dont have a better reason why this method would work better than enabling a provider like a4K.

Zaxxon709 commented 9 months ago

@nebulous42069 I decided to have a quick look at this today. However, I noticed shortly into it that some add-ons do not have subtitles as an option. Seren/Ezra are two I've found so far. I did write up the code for choosing the subtitle language and enabling/disabling a few add-ons but stopped there. I'm wondering if this is worth the trouble since adding a service to Kodi's player will handle subtitles for all streams during playback. What do you think?

Yea, your probably right. Axe the idea. Sorry! I havent put enough research into this since I dont use subtitles myself, not sure what the difference is between enabling subtitles in the addon Vs enabling a provider. When i did spend a little time on it it seemed the Enable subtitles option seemed to work better/smoother than an external provider, but cant be sure. So I wonder if the enable subs in the addon actually enables the hard-coded subs in a stream file? Or what exactly the difference is.. Ill look into it a bit more, but for now I dont have a better reason why this method would work better than enabling a provider like a4K.

Due to it being a pretty quick addition, I did finish adding the option to enable subtitles. I did find 4 add-ons that did not have the option to enable (Seren, Fen Light, afFENity, and Ezra). Like your self, I have not used subtitles via the add-on before. I've always used a service like A4K. I'd suspect if it's enabled within an add-on then subtitles will be displayed if the actual video file being played has them included (i.e. subtitles included in a cached torrent directory). If they're hardcoded there is no enabling/disabling. They're there if you like it or not.

Zaxxon709 commented 9 months ago

@nebulous42069 Here is MaxQL with subtitles added if you would like to test. I haven't pushed an update.

plugin.program.maxql.zip

nebulous42069 commented 9 months ago

@nebulous42069 I decided to have a quick look at this today. However, I noticed shortly into it that some add-ons do not have subtitles as an option. Seren/Ezra are two I've found so far. I did write up the code for choosing the subtitle language and enabling/disabling a few add-ons but stopped there. I'm wondering if this is worth the trouble since adding a service to Kodi's player will handle subtitles for all streams during playback. What do you think?

Yea, your probably right. Axe the idea. Sorry! I havent put enough research into this since I dont use subtitles myself, not sure what the difference is between enabling subtitles in the addon Vs enabling a provider. When i did spend a little time on it it seemed the Enable subtitles option seemed to work better/smoother than an external provider, but cant be sure. So I wonder if the enable subs in the addon actually enables the hard-coded subs in a stream file? Or what exactly the difference is.. Ill look into it a bit more, but for now I dont have a better reason why this method would work better than enabling a provider like a4K.

Due to it being a pretty quick addition, I did finish adding the option to enable subtitles. I did find 4 add-ons that did not have the option to enable (Seren, Fen Light, afFENity, and Ezra). Like your self, I have not used subtitles via the add-on before. I've always used a service like A4K. I'd suspect if it's enabled within an add-on then subtitles will be displayed if the actual video file being played has them included (i.e. subtitles included in a cached torrent directory). If they're hardcoded there is no enabling/disabling. They're there if you like it or not.

Sweet, yea hardcoded was the wrong term I suppose. Embedded would be the right term. Will this also switch the Kodi video setting for subtitles On/Off. That would cover all the addons.

nebulous42069 commented 9 months ago

By looking at some addons code it seems that the enable subtitles setting simply enables subtitles automatically from opensubtitles.org. def search(self, query, imdb_id, language, season=None, episode=None): cache_name = 'opensubtitles_%s_%s' % (imdb_id, language) if season: cache_name += '_%s_%s' % (season, episode) cache = main_cache.get(cache_name) if cache: return cache url = 'https://rest.opensubtitles.org/search/imdbid-%s/query-%s%s/sublanguageid-%s' \ % (imdb_id, quote(query), '/season-%d/episode-%d' % (season, episode) if season else '', language) response = self._get(url, retry=True) response = json.loads(response.text) main_cache.set(cache_name, response, expiration=timedelta(hours=24)) return response

Zaxxon709 commented 9 months ago

@nebulous42069 I decided to have a quick look at this today. However, I noticed shortly into it that some add-ons do not have subtitles as an option. Seren/Ezra are two I've found so far. I did write up the code for choosing the subtitle language and enabling/disabling a few add-ons but stopped there. I'm wondering if this is worth the trouble since adding a service to Kodi's player will handle subtitles for all streams during playback. What do you think?

Yea, your probably right. Axe the idea. Sorry! I havent put enough research into this since I dont use subtitles myself, not sure what the difference is between enabling subtitles in the addon Vs enabling a provider. When i did spend a little time on it it seemed the Enable subtitles option seemed to work better/smoother than an external provider, but cant be sure. So I wonder if the enable subs in the addon actually enables the hard-coded subs in a stream file? Or what exactly the difference is.. Ill look into it a bit more, but for now I dont have a better reason why this method would work better than enabling a provider like a4K.

Due to it being a pretty quick addition, I did finish adding the option to enable subtitles. I did find 4 add-ons that did not have the option to enable (Seren, Fen Light, afFENity, and Ezra). Like your self, I have not used subtitles via the add-on before. I've always used a service like A4K. I'd suspect if it's enabled within an add-on then subtitles will be displayed if the actual video file being played has them included (i.e. subtitles included in a cached torrent directory). If they're hardcoded there is no enabling/disabling. They're there if you like it or not.

Sweet, yea hardcoded was the wrong term I suppose. Embedded would be the right term. Will this also switch the Kodi video setting for subtitles On/Off. That would cover all the addons.

No, I did not include the option to enable subtitles in Kodi's settings. I will take a look in the morning.

Zaxxon709 commented 9 months ago

By looking at some addons code it seems that the enable subtitles setting simply enables subtitles automatically from opensubtitles.org. def search(self, query, imdb_id, language, season=None, episode=None): cache_name = 'opensubtitles_%s_%s' % (imdb_id, language) if season: cache_name += '_%s_%s' % (season, episode) cache = main_cache.get(cache_name) if cache: return cache url = 'https://rest.opensubtitles.org/search/imdbid-%s/query-%s%s/sublanguageid-%s' \ % (imdb_id, quote(query), '/season-%d/episode-%d' % (season, episode) if season else '', language) response = self._get(url, retry=True) response = json.loads(response.text) main_cache.set(cache_name, response, expiration=timedelta(hours=24)) return response

Hmmm...doesn't opensubtitles now require an account? Maybe this feature no longer works in the add-ons without the option to add your Opensubtitles login credentials. I know A4Ksubs recently updated and I just took a look at the changelog.

v3.8.0 Switch to new OpenSubtitles API. Note: username and password are now mandatory for using OpenSubtitles.

nebulous42069 commented 9 months ago

Hmmm...doesn't opensubtitles now require an account? Maybe this feature no longer works in the add-ons without the option to add your Opensubtitles login credentials. I know A4Ksubs recently updated and I just took a look at the changelog.

v3.8.0 Switch to new OpenSubtitles API. Note: username and password are now mandatory for using OpenSubtitles.

Yea, thats what i thought, however, just tested a movie with scrubs. I deleted the 2 sub services I had installed on Kodi first (A4K and opensubs). It still shows the subtitles correctly somehow, so I dunno, lol. Code in Scrubs looks similar:

if subLang == langs[0]: raise Exception() un = control.setting('os.user') pw = control.setting('os.pass') server = xmlrpc_client.Server('http://api.opensubtitles.org/xml-rpc', verbose=0) token = server.LogIn(un, pw, 'en', 'XBMC_Subtitles_Unofficial_v5.2.14')['token'] sublanguageid = ','.join(langs) ; imdbid = re.sub('[^0-9]', '', imdb)

nebulous42069 commented 9 months ago

Also guess the Kodi subtitle switch wouldnt be necessary since the addons turn on the Kodi subtitles setting anyway when you enable them in the addons settings. Should have put a bit more thought into all this first before I posted this here. Sorry If I wasted your time...

Zaxxon709 commented 9 months ago

It appears a few devs (popular add-ons) have updated their add-ons to now support the opensubtitles.com API. A4K has updated their subtitle addon as well and there is an Opensubtitles add-on available. All should be working for a max of 5 subtitles per 24hrs. You'll need to use your login details to increase this. Not a paid sub but just an account. Below are the details of their API.

I think a useful solution for subtitles would be to add it to Account Manager. It would require a list of add-ons that have been updated to work with opensubtitles.com and include the option to add login credentials. I've checked a few add-ons and I think Shadow and all its forks are still using .org along with The Oath forks etc... I know Umbrella is updated, Maybe something to look into down the road after the dust settles.

The reason you still have subtitles when playing a stream, even with it turned off in the add-on and no service installed is due to the MKV being packed with subtitles. Not Hardcoded/Embedded but included in the MKV container.

You haven't wasted my time, I only do this as a hobby when I have free time available. I did however end up watching Ip Man again!

Your consumer can query the API on its own, and download 5 subtitles per IP's per 24 hours, but a user must be authenticated to download more. Users will then be able to download as many subtitles as their ranks allow, from 10 as simple signed up user, to 1000 for VIP user.

nebulous42069 commented 9 months ago

It appears a few devs (popular add-ons) have updated their add-ons to now support the opensubtitles.com API. A4K has updated their subtitle addon as well and there is an Opensubtitles add-on available. All should be working for a max of 5 subtitles per 24hrs. You'll need to use your login details to increase this. Not a paid sub but just an account. Below are the details of their API.

I think a useful solution for subtitles would be to add it to Account Manager. It would require a list of add-ons that have been updated to work with opensubtitles.com and include the option to add login credentials. I've checked a few add-ons and I think Shadow and all its forks are still using .org along with The Oath forks etc... I know Umbrella is updated, Maybe something to look into down the road after the dust settles.

The reason you still have subtitles when playing a stream, even with it turned off in the add-on and no service installed is due to the MKV being packed with subtitles. Not Hardcoded/Embedded but included in the MKV container.

You haven't wasted my time, I only do this as a hobby when I have free time available. I did however end up watching Ip Man again!

Your consumer can query the API on its own, and download 5 subtitles per IP's per 24 hours, but a user must be authenticated to download more. Users will then be able to download as many subtitles as their ranks allow, from 10 as simple signed up user, to 1000 for VIP user.

Ahh, ok. Thanks for the insight. Sounds good to me. Thanks!