Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz89B committed Jun 11, 2022
1 parent 3f1bb7d commit 0f4b8bc
Show file tree
Hide file tree
Showing 11 changed files with 216 additions and 33 deletions.
54 changes: 47 additions & 7 deletions addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
lock_icon = os.path.join(icons, 'lock.png')
settings_icon = os.path.join(icons, 'settings.png')

catchup_msg = addon.getSetting('teliaplay_play_beginning')
if catchup_msg == 'true':
play_beginning = True
else:
play_beginning = False

login = addon.getSetting('teliaplay_username').strip()
password = addon.getSetting('teliaplay_password').strip()

Expand Down Expand Up @@ -1181,6 +1187,8 @@ def live_channels():

count = 0

channel_lst = []

for channel in channels:
if channel['id'] in engagementLiveChannels:
count += 1
Expand Down Expand Up @@ -1219,13 +1227,16 @@ def live_channels():
img = icons.get('dark').get('source')
icon = unquote(img)

channel_lst.append((exlink, name, icon))
add_item(label=name, url=exlink, mode='programs', icon=icon, folder=True, playable=False, info_labels={'title':name, 'plot':name}, fanart=fanart, item_count=count)

xbmcplugin.endOfDirectory(addon_handle)

except Exception as ex:
print('live_channels exception: {}'.format(ex))

return channel_lst

def live_channel(exlink, extitle):
country = int(addon.getSetting('teliaplay_locale'))
beartoken = addon.getSetting('teliaplay_beartoken')
Expand Down Expand Up @@ -1911,12 +1922,13 @@ def play(exlink, title, media_id, catchup_type, start, end):
now = int(time.time())

if int(now) >= int(start) and int(now) <= int(end):
response = xbmcgui.Dialog().yesno(localized(30012), localized(30014))
if response:
exlink = media_id
catchup_type = 'STARTOVER'
else:
catchup_type = 'LIVE'
catchup_type = 'LIVE'
if play_beginning:
response = xbmcgui.Dialog().yesno(localized(30012), localized(30014))
if response:
exlink = media_id
catchup_type = 'STARTOVER'

elif int(end) >= int(now):
xbmcgui.Dialog().ok(localized(30012), localized(30028))
return
Expand Down Expand Up @@ -2088,7 +2100,32 @@ def profiles(j_response):
profile = profiles[ret]

addon.setSetting('teliaplay_profile_name', profile[0])
addon.setSetting('teliaplay_profile_avatar', profile[-1])
addon.setSetting('teliaplay_profile_avatar', profile[-1])

def build_m3u():
path = xbmcgui.Dialog().browse(0, localized(30062), 'files')
if path == '':
return

xbmcgui.Dialog().notification(localized(30012), localized(30063), xbmcgui.NOTIFICATION_INFO)
data = '#EXTM3U'

items = live_channels()
for item in items:
cid = item[0]
url = 'plugin://plugin.video.teliaplay/?title=&mode=play&url={cid}&catchup=LIVE&start=0&end=0'.format(cid=cid)

tvg_id = item[1].lower().replace(' ', '_') + '.' + cc[country]
title = item[1] + ' ' + ca[country]
icon = item[2]

data += '\n#EXTINF:-1 tvg-id="{id}" tvg-name="{title}" tvg-logo="{icon}" group-title="Telia", {title}\n{url}'.format(id=tvg_id, title=title, url=url, icon=icon)

with open(path + 'teliaplay_iptv.m3u', 'w+') as f:
f.write(data)

xbmcgui.Dialog().notification(localized(30012), localized(30064), xbmcgui.NOTIFICATION_INFO)
return

def router(param):
args = dict(urlparse.parse_qsl(param))
Expand Down Expand Up @@ -2172,6 +2209,9 @@ def router(param):
pincode()
xbmc.executebuiltin('Container.Refresh()')

elif mode == 'build_m3u':
build_m3u()

else:
home()

Expand Down
8 changes: 6 additions & 2 deletions 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="plugin.video.teliaplay" name="Telia Play" version="0.5" provider-name="mariusz89b">
<addon id="plugin.video.teliaplay" name="Telia Play" version="1.0" provider-name="mariusz89b">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.inputstreamhelper" version="0.2.4"/>
Expand All @@ -24,7 +24,11 @@
<platform>all</platform>
<license>GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 and MIT LICENSE.</license>
<source>https://github.com/Mariusz89B/plugin.video.teliaplay</source>
<news>v0.5 (2022-06-10)
<news>v1.0 (2022-06-11)
- Added M3U playlist generator.
- Code refactoring.

v0.5 (2022-06-10)
- Hotfix.

v0.4 (2022-06-09)
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.0 (2022-06-11)
- Added M3U playlist generator.
- Code refactoring.

v0.5 (2022-06-10)
- Hotfix.

Expand Down
30 changes: 29 additions & 1 deletion resources/language/resource.language.da_dk/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,32 @@ msgstr "Ryd login oplysninger"

msgctxt "#30057"
msgid "Login credentials cleared."
msgstr "Loginoplysninger ryddet."
msgstr "Loginoplysninger ryddet."

msgctxt "#30058"
msgid "Profile"
msgstr "Profil"

msgctxt "#30059"
msgid "Show catchup dialog"
msgstr "Vis indhentningsdialog"

msgctxt "#30060"
msgid "M3U Generator"
msgstr "M3U Generator"

msgctxt "#30061"
msgid "Create M3U playlist"
msgstr "Opret M3U spilleliste"

msgctxt "#30062"
msgid "Select output destination"
msgstr "Vælg outputdestination"

msgctxt "#30063"
msgid "Creating playlist M3U"
msgstr "Opretter spilleliste M3U"

msgctxt "#30064"
msgid "Playlist M3U has been created"
msgstr "Playlist M3U er blevet oprettet"
28 changes: 28 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,32 @@ msgstr ""

msgctxt "#30057"
msgid "Login credentials cleared."
msgstr ""

msgctxt "#30058"
msgid "Profile"
msgstr ""

msgctxt "#30059"
msgid "Show catchup dialog"
msgstr ""

msgctxt "#30060"
msgid "M3U Generator"
msgstr ""

msgctxt "#30061"
msgid "Create M3U playlist"
msgstr ""

msgctxt "#30062"
msgid "Select output destination"
msgstr ""

msgctxt "#30063"
msgid "Creating playlist M3U"
msgstr ""

msgctxt "#30064"
msgid "Playlist M3U has been created"
msgstr ""
30 changes: 29 additions & 1 deletion resources/language/resource.language.nb_no/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,32 @@ msgstr "Slett påloggingsinformasjon"

msgctxt "#30057"
msgid "Login credentials cleared."
msgstr "Påloggingsinformasjon slettet."
msgstr "Påloggingsinformasjon slettet."

msgctxt "#30058"
msgid "Profile"
msgstr "Profil"

msgctxt "#30059"
msgid "Show catchup dialog"
msgstr "Vis innhentingsdialog"

msgctxt "#30060"
msgid "M3U Generator"
msgstr "M3U Generator"

msgctxt "#30061"
msgid "Create M3U playlist"
msgstr "Opprett M3U spilleliste"

msgctxt "#30062"
msgid "Select output destination"
msgstr "Velg utdatamål"

msgctxt "#30063"
msgid "Creating playlist M3U"
msgstr "Oppretter spilleliste M3U"

msgctxt "#30064"
msgid "Playlist M3U has been created"
msgstr "Spilleliste M3U er opprettet"
30 changes: 29 additions & 1 deletion resources/language/resource.language.sv_se/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,32 @@ msgstr "Rensa inloggningsuppgifter"

msgctxt "#30057"
msgid "Login credentials cleared."
msgstr "Inloggningsuppgifter rensades."
msgstr "Inloggningsuppgifter rensades."

msgctxt "#30058"
msgid "Profile"
msgstr "Profil"

msgctxt "#30059"
msgid "Show catchup dialog"
msgstr "Visa catchup dialogruta"

msgctxt "#30060"
msgid "M3U Generator"
msgstr "M3U Generator"

msgctxt "#30061"
msgid "Create M3U playlist"
msgstr "Skapa M3U spellista"

msgctxt "#30062"
msgid "Select output destination"
msgstr "Välj utdata destination"

msgctxt "#30063"
msgid "Creating playlist M3U"
msgstr "Skapar spellista M3U"

msgctxt "#30064"
msgid "Playlist M3U has been created"
msgstr "Spellista M3U har skapats"
Binary file added resources/screenshots/screenshot-01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/screenshots/screenshot-02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/screenshots/screenshot-03.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 44 additions & 21 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,6 @@
<hidden>true</hidden>
</control>
</setting>
<setting help="" id="teliaplay_adult_enabled" label="30047" type="boolean">
<level>0</level>
<default>true</default>
<control type="toggle"/>
</setting>
<setting help="" id="teliaplay_pincode" label="30046" type="string" parent="teliaplay_adult_enabled">
<level>0</level>
<default/>
<constraints>
<allowempty>true</allowempty>
</constraints>
<dependencies>
<dependency type="visible">
<condition operator="is" setting="teliaplay_adult_enabled">true</condition>
</dependency>
</dependencies>
<control format="string" type="edit">
<heading>30044</heading>
<hidden>true</hidden>
</control>
</setting>
<setting help="" id="teliaplay_cleardata" label="30056" type="action" parent="cmore_enabled">
<level>0</level>
<data>RunScript(special://home/addons/plugin.video.teliaplay/cleardata.py,cleardata)</data>
Expand Down Expand Up @@ -134,6 +113,50 @@
</setting>
</group>
</category>
<category help="" id="settings" label="30055">
<group id="1">
<setting help="" id="teliaplay_play_beginning" label="30059" type="boolean">
<level>0</level>
<default>true</default>
<control type="toggle"/>
</setting>
<setting help="" id="teliaplay_adult_enabled" label="30047" type="boolean">
<level>0</level>
<default>true</default>
<control type="toggle"/>
</setting>
<setting help="" id="teliaplay_pincode" label="30046" type="string" parent="teliaplay_adult_enabled">
<level>0</level>
<default/>
<constraints>
<allowempty>true</allowempty>
</constraints>
<dependencies>
<dependency type="visible">
<condition operator="is" setting="teliaplay_adult_enabled">true</condition>
</dependency>
</dependencies>
<control format="string" type="edit">
<heading>30044</heading>
<hidden>true</hidden>
</control>
</setting>
</group>
</category>
<category id="build_m3u" label="30060" help="">
<group id="1">
<setting id="create_playlist" type="action" label="30061" help="">
<level>0</level>
<data>RunPlugin(plugin://plugin.video.teliaplay?mode=build_m3u)</data>
<constraints>
<allowempty>true</allowempty>
</constraints>
<control type="button" format="action">
<close>true</close>
</control>
</setting>
</group>
</category>
<category help="30054" id="ia" label="30051">
<group id="1">
<setting help="30052" id="ia_settings" label="30053" type="action">
Expand Down

0 comments on commit 0f4b8bc

Please sign in to comment.