diff --git a/addon.py b/addon.py index d2e3252..98c714e 100644 --- a/addon.py +++ b/addon.py @@ -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() @@ -1181,6 +1187,8 @@ def live_channels(): count = 0 + channel_lst = [] + for channel in channels: if channel['id'] in engagementLiveChannels: count += 1 @@ -1219,6 +1227,7 @@ 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) @@ -1226,6 +1235,8 @@ def live_channels(): 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') @@ -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 @@ -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)) @@ -2172,6 +2209,9 @@ def router(param): pincode() xbmc.executebuiltin('Container.Refresh()') + elif mode == 'build_m3u': + build_m3u() + else: home() diff --git a/addon.xml b/addon.xml index 2975ec2..adda4f5 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -24,7 +24,11 @@ all GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 and MIT LICENSE. https://github.com/Mariusz89B/plugin.video.teliaplay - v0.5 (2022-06-10) + v1.0 (2022-06-11) +- Added M3U playlist generator. +- Code refactoring. + +v0.5 (2022-06-10) - Hotfix. v0.4 (2022-06-09) diff --git a/changelog.txt b/changelog.txt index beb5ca2..f6d1535 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +v1.0 (2022-06-11) +- Added M3U playlist generator. +- Code refactoring. + v0.5 (2022-06-10) - Hotfix. diff --git a/resources/language/resource.language.da_dk/strings.po b/resources/language/resource.language.da_dk/strings.po index a04baf2..10e5aba 100644 --- a/resources/language/resource.language.da_dk/strings.po +++ b/resources/language/resource.language.da_dk/strings.po @@ -246,4 +246,32 @@ msgstr "Ryd login oplysninger" msgctxt "#30057" msgid "Login credentials cleared." -msgstr "Loginoplysninger ryddet." \ No newline at end of file +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" \ No newline at end of file diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 414036c..4dbbe1c 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -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 "" \ No newline at end of file diff --git a/resources/language/resource.language.nb_no/strings.po b/resources/language/resource.language.nb_no/strings.po index 34cbd56..d99f749 100644 --- a/resources/language/resource.language.nb_no/strings.po +++ b/resources/language/resource.language.nb_no/strings.po @@ -246,4 +246,32 @@ msgstr "Slett påloggingsinformasjon" msgctxt "#30057" msgid "Login credentials cleared." -msgstr "Påloggingsinformasjon slettet." \ No newline at end of file +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" \ No newline at end of file diff --git a/resources/language/resource.language.sv_se/strings.po b/resources/language/resource.language.sv_se/strings.po index 0637283..904c4c1 100644 --- a/resources/language/resource.language.sv_se/strings.po +++ b/resources/language/resource.language.sv_se/strings.po @@ -246,4 +246,32 @@ msgstr "Rensa inloggningsuppgifter" msgctxt "#30057" msgid "Login credentials cleared." -msgstr "Inloggningsuppgifter rensades." \ No newline at end of file +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" \ No newline at end of file diff --git a/resources/screenshots/screenshot-01.jpg b/resources/screenshots/screenshot-01.jpg new file mode 100644 index 0000000..a541ecc Binary files /dev/null and b/resources/screenshots/screenshot-01.jpg differ diff --git a/resources/screenshots/screenshot-02.jpg b/resources/screenshots/screenshot-02.jpg new file mode 100644 index 0000000..f599f37 Binary files /dev/null and b/resources/screenshots/screenshot-02.jpg differ diff --git a/resources/screenshots/screenshot-03.jpg b/resources/screenshots/screenshot-03.jpg new file mode 100644 index 0000000..8f69939 Binary files /dev/null and b/resources/screenshots/screenshot-03.jpg differ diff --git a/resources/settings.xml b/resources/settings.xml index 7267fad..09a14c9 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -37,27 +37,6 @@ true - - 0 - true - - - - 0 - - - true - - - - true - - - - 30044 - true - - 0 RunScript(special://home/addons/plugin.video.teliaplay/cleardata.py,cleardata) @@ -134,6 +113,50 @@ + + + + 0 + true + + + + 0 + true + + + + 0 + + + true + + + + true + + + + 30044 + true + + + + + + + + 0 + RunPlugin(plugin://plugin.video.teliaplay?mode=build_m3u) + + true + + + true + + + +