Skip to content

Commit

Permalink
slyguy.plex.live -> v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matthuisman authored and johnny5-is-alive committed Sep 20, 2023
1 parent 8d4753d commit 093152b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
2 changes: 1 addition & 1 deletion slyguy.plex.live/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="slyguy.plex.live" name="Plex Live" provider-name="SlyGuy" version="0.0.10">
<addon id="slyguy.plex.live" name="Plex Live" provider-name="SlyGuy" version="0.1.0">
<requires>
<import addon="script.module.slyguy" version="0.63.1"/>
</requires>
Expand Down
33 changes: 2 additions & 31 deletions slyguy.plex.live/resources/lib/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import arrow
from slyguy import plugin, inputstream, mem_cache, settings, userdata, gui
from slyguy.session import Session
from slyguy.util import gzip_extract
from slyguy.exceptions import PluginError

from .language import _
Expand Down Expand Up @@ -186,12 +185,7 @@ def play(id, **kwargs):
headers = data['headers']
headers.update(region.get('headers', {}))

url = channel.get('url')
resp = Session().head(PLAY_URL.format(id=id), headers=headers, allow_redirects=True)
if resp.ok:
url = resp.url

if not url:
if not channel.get('url'):
raise PluginError(_.NO_VIDEO_FOUND)

return plugin.Item(
Expand All @@ -200,7 +194,7 @@ def play(id, **kwargs):
art = {'thumb': channel['logo']},
inputstream = inputstream.HLS(live=True),
headers = data['headers'],
path = url,
path = channel['url'],
)

@plugin.route()
Expand Down Expand Up @@ -234,29 +228,6 @@ def playlist(output, **kwargs):
id=id, name=channel['name'], logo=channel['logo'], region=region['name'], url=plugin.url_for(play, id=id, _is_live=True),
))

@plugin.route()
def configure_merge(**kwargs):
data = _app_data()
data['regions'].pop(ALL, None)

user_regions = userdata.get('merge_regions', [])
avail_regions = sorted(data['regions'], key=lambda x: (data['regions'][x]['sort'], data['regions'][x]['name']))

options = []
preselect = []
for index, code in enumerate(avail_regions):
region = data['regions'][code]
options.append(plugin.Item(label=region['name'], art={'thumb': region['logo']}))
if code in user_regions:
preselect.append(index)

indexes = gui.select(heading=_.SELECT_REGIONS, options=options, multi=True, useDetails=True, preselect=preselect)
if indexes is None:
return

user_regions = [avail_regions[i] for i in indexes]
userdata.set('merge_regions', user_regions)

@plugin.route()
def configure_merge(**kwargs):
data = _app_data()
Expand Down

0 comments on commit 093152b

Please sign in to comment.