Skip to content

Commit 52c210a

Browse files
committed
add external subtitles support
1 parent e185a22 commit 52c210a

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

fly.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ app = 'plexio'
22
primary_region = 'iad'
33

44
[build]
5-
image = 'ghcr.io/vanchaxy/plexio:0.1.5'
5+
image = 'ghcr.io/vanchaxy/plexio:0.1.6'
66

77
[env]
88
CACHE_TYPE = 'redis'

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "frontend",
33
"private": true,
4-
"version": "0.1.5",
4+
"version": "0.1.6",
55
"type": "module",
66
"scripts": {
77
"dev": "vite --host",

plexio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.5'
1+
__version__ = '0.1.6'

plexio/models/plex.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ def get_stremio_streams(self, configuration):
171171

172172
audio_languages = set()
173173
subtitles_languages = set()
174+
external_subtitles = []
174175
for part_stream in media['Part'][0].get('Stream', []):
175176
if part_stream['streamType'] == 2:
176177
audio_languages.add(
@@ -180,6 +181,20 @@ def get_stremio_streams(self, configuration):
180181
subtitles_languages.add(
181182
get_flag_emoji(part_stream.get('languageTag', 'Unknown')),
182183
)
184+
if 'key' in part_stream:
185+
external_subtitles.append(
186+
{
187+
'id': str(part_stream['id']),
188+
'lang': part_stream['displayTitle'],
189+
'url': str(
190+
configuration.streaming_url
191+
/ part_stream['key'][1:]
192+
% {
193+
'X-Plex-Token': configuration.access_token,
194+
}
195+
),
196+
}
197+
)
183198

184199
description_template = '{filename}\n{quality}\n{languages}'
185200
languages = '/'.join(sorted(audio_languages))
@@ -202,6 +217,7 @@ def get_stremio_streams(self, configuration):
202217
'X-Plex-Token': configuration.access_token,
203218
},
204219
),
220+
subtitles=external_subtitles,
205221
behaviorHints={'bingeGroup': quality_description},
206222
),
207223
)
@@ -233,6 +249,7 @@ def get_stremio_streams(self, configuration):
233249
languages=languages,
234250
),
235251
url=str(transcode_url % {'videoQuality': 100}),
252+
subtitles=external_subtitles,
236253
behaviorHints={'bingeGroup': quality_description},
237254
),
238255
)
@@ -252,6 +269,7 @@ def get_stremio_streams(self, configuration):
252269
languages=languages,
253270
),
254271
url=str(transcode_url % quality_params['plex_args']),
272+
subtitles=external_subtitles,
255273
behaviorHints={'bingeGroup': quality_description},
256274
),
257275
)

0 commit comments

Comments
 (0)