Skip to content

Commit f3d97b6

Browse files
committed
Add setting to allow choosing the playback addon
1 parent f7bacba commit f3d97b6

4 files changed

Lines changed: 74 additions & 9 deletions

File tree

resources/language/resource.language.en_gb/strings.po

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,35 @@ msgstr ""
4747
msgctxt "#30201"
4848
msgid "Title"
4949
msgstr ""
50+
51+
msgctxt "#30202"
52+
msgid "General"
53+
msgstr ""
54+
55+
msgctxt "#30203"
56+
msgid "General Settings"
57+
msgstr ""
58+
59+
msgctxt "#30204"
60+
msgid "Playback"
61+
msgstr ""
62+
63+
msgctxt "#30205"
64+
msgid "Addon used for playback"
65+
msgstr ""
66+
67+
msgctxt "#30206"
68+
msgid "Select the Add-on used for playback"
69+
msgstr ""
70+
71+
msgctxt "#30207"
72+
msgid "Youtube Add-on"
73+
msgstr ""
74+
75+
msgctxt "#30208"
76+
msgid "Tubed Add-on"
77+
msgstr ""
78+
79+
msgctxt "#30208"
80+
msgid "Coiso"
81+
msgstr ""

resources/lib/__init__.py

Whitespace-only changes.

resources/lib/plugin.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,22 @@
2020
import os
2121
from xbmcswift2 import Plugin
2222

23-
YOUTUBE_URL = 'plugin://plugin.video.tubed/?channel_id=%s&mode=channel'
24-
YOUTUBE_VIDEO_URL = 'plugin://plugin.video.tubed/?mode=play&video_id=%s'
25-
2623
plugin = Plugin()
2724

25+
PLAYBACK_ADDON_DICT = {
26+
0: {
27+
'addon': 'Youtube',
28+
'channel_url': 'plugin://plugin.video.youtube/channel/%s/?page=1',
29+
'video_url': 'plugin://plugin.video.youtube/play/?video_id=%s'
30+
},
31+
1: {
32+
'addon': 'Tubed',
33+
'channel_url': 'plugin://plugin.video.tubed/?channel_id=%s&mode=channel',
34+
'video_url': 'plugin://plugin.video.tubed/?mode=play&video_id=%s'
35+
}
36+
}
37+
38+
2839
STRINGS = {
2940
'page': 30001,
3041
'streams': 30100,
@@ -39,27 +50,27 @@
3950
'title': 'Nasa TV HD',
4051
'logo': 'public.jpg',
4152
'fanart': plugin.fanart,
42-
'stream_url': (YOUTUBE_VIDEO_URL % '21X5lGlDOfg'),
53+
'stream_url': (PLAYBACK_ADDON_DICT[plugin.get_setting('playbackaddon', int)]['video_url'] % '21X5lGlDOfg'),
4354
}, {
4455
'title': 'ISS Live Stream',
4556
'logo': 'iss.jpg',
4657
'fanart': plugin.fanart,
47-
'stream_url': (YOUTUBE_VIDEO_URL % 'EEIk7gwjgIM'),
58+
'stream_url': (PLAYBACK_ADDON_DICT[plugin.get_setting('playbackaddon', int)]['video_url'] % 'EEIk7gwjgIM'),
4859
}, {
4960
'title': 'Media Channel HD',
5061
'logo': 'media.jpg',
5162
'fanart': plugin.fanart,
52-
'stream_url': (YOUTUBE_VIDEO_URL % 'nA9UZF-SZoQ'),
63+
'stream_url': (PLAYBACK_ADDON_DICT[plugin.get_setting('playbackaddon', int)]['video_url'] % 'nA9UZF-SZoQ'),
5364
},{
5465
'title': 'ISS HD Earth Viewing',
5566
'logo': 'isshd.jpg',
5667
'fanart': plugin.fanart,
57-
'stream_url': (YOUTUBE_VIDEO_URL % '2E7l9rZ0cQY'),
68+
'stream_url': (PLAYBACK_ADDON_DICT[plugin.get_setting('playbackaddon', int)]['video_url'] % '2E7l9rZ0cQY'),
5869
},{
5970
'title': 'ISS HD Earth From Space',
6071
'logo': 'isshd.jpg',
6172
'fanart': plugin.fanart,
62-
'stream_url': (YOUTUBE_VIDEO_URL % 'EEIk7gwjgIM'),
73+
'stream_url': (PLAYBACK_ADDON_DICT[plugin.get_setting('playbackaddon', int)]['video_url'] % 'EEIk7gwjgIM'),
6374
}
6475
)
6576

@@ -122,7 +133,7 @@ def show_channels():
122133
'label': channel['name'],
123134
'thumbnail': get_logo(channel['logo']),
124135
'fanart': plugin.fanart,
125-
'path': YOUTUBE_URL % channel['channel_id'],
136+
'path': PLAYBACK_ADDON_DICT[plugin.get_setting('playbackaddon', int)]['channel_url'] % channel['channel_id'],
126137
} for channel in YOUTUBE_CHANNELS]
127138
return plugin.finish(items)
128139

resources/settings.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" ?>
2+
<settings version="1">
3+
<section id="plugin.video.nasa">
4+
<category id="general" label="30202" help="30203">
5+
<group id="1" label="30204">
6+
<setting id="playbackaddon" type="integer" label="30205" help="30206">
7+
<level>0</level>
8+
<default>0</default>
9+
<constraints>
10+
<options>
11+
<option label="30207">0</option>
12+
<option label="30208">1</option>
13+
</options>
14+
</constraints>
15+
<control type="list" format="string">
16+
<heading>30206</heading>
17+
</control>
18+
</setting>
19+
</group>
20+
</category>
21+
</section>
22+
</settings>

0 commit comments

Comments
 (0)