From b38d9847cd804f0abf749146b74124b76393e76b Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 28 Dec 2017 15:56:25 +0200 Subject: [plugin.video.montreal.greek-tv] 1.3.1 Remove forgotten file [plugin.video.montreal.greek-tv] 1.3.0 --- plugin.video.montreal.greek-tv/addon.py | 133 +++++++++++++++++---- plugin.video.montreal.greek-tv/addon.xml | 15 ++- plugin.video.montreal.greek-tv/changelog.txt | 11 +- .../resources/__init__.py | 2 +- .../language/resource.language.el_gr/strings.po | 67 +++++------ .../language/resource.language.en_gb/strings.po | 66 +++++----- .../resources/lib/__init__.py | 1 + .../resources/lib/control.py | 49 +++----- .../resources/lib/directory.py | 3 +- .../resources/lib/youtube.py | 9 +- .../resources/media/newspaper_fanart.png | Bin 0 -> 52723 bytes .../resources/media/newspaper_icon.png | Bin 0 -> 5160 bytes .../resources/settings.xml | 6 - 13 files changed, 209 insertions(+), 153 deletions(-) create mode 100644 plugin.video.montreal.greek-tv/resources/media/newspaper_fanart.png create mode 100644 plugin.video.montreal.greek-tv/resources/media/newspaper_icon.png delete mode 100644 plugin.video.montreal.greek-tv/resources/settings.xml diff --git a/plugin.video.montreal.greek-tv/addon.py b/plugin.video.montreal.greek-tv/addon.py index 845bbe1..9b2b027 100644 --- a/plugin.video.montreal.greek-tv/addon.py +++ b/plugin.video.montreal.greek-tv/addon.py @@ -18,10 +18,10 @@ along with this program. If not, see . """ -import requests +import requests, json import CommonFunctions as common from base64 import b64decode -from resources.lib import control, youtube, cache, directory, syshandle, sysaddon, action, url +from resources.lib import control, youtube, cache, directory, syshandle, sysaddon, action, url, image # Misc variables: @@ -30,17 +30,19 @@ addonart = control.join(control.addonPath, 'resources/media') livetv_img = control.join(addonart, 'livetv.png') radio_img = control.join(addonart, 'radio.png') youtube_img = control.join(addonart, 'youtube.png') -settings_img = control.join(addonart, 'settings.png') +news_icon = control.join(addonart, 'newspaper_icon.png') +news_fanart = control.join(addonart, 'newspaper_icon.png') +fp = control.infoLabel('Container.FolderPath') # Please do not copy these keys, instead create your own: # http://forum.kodi.tv/showthread.php?tid=267160&pid=2299960#pid2299960 key = b64decode('QUl6YVN5QThrMU95TEdmMDNIQk5sMGJ5RDUxMWpyOWNGV28yR1I0') ytid = 'UCFr8nqHDhA_fLQq2lEK3Mlw' -old_radio_url = 'http://209.95.50.189:8049/stream' def yt(): + return youtube.youtube(key=key).videos(ytid) @@ -56,37 +58,105 @@ def vod(): directory.add(video_list) +def news_index(): + + base_link = 'https://issuu.com/greektimes/docs/' + json_obj = 'https://issuu.com/call/profile_demo/v1/documents/greektimes?offset=0&limit=1000' + + result = requests.get(json_obj).text + + news_list = json.loads(result)['items'] + + empty_list = [] + + for n in news_list: + + title = n['title'] + image = n['coverUrl'] + url = base_link + n['uri'] + + data = {'title': title, 'image': image, 'url': url, 'action': 'paper_index'} + + empty_list.append(data) + + directory.add(empty_list, content='images') + + +def paper_index(link): + + base_img_url = 'https://image.isu.pub/' + + html = requests.get(link).text + + script = common.parseDOM(html, 'script', attrs={'type': 'application/javascript'})[-2] + + data = json.loads(script.partition(' = ')[2].rstrip(';')) + document = data['document'] + total_pages = int(document['pageCount']) + + empty_list = [] + final_list = [] + + for page in range(1, total_pages + 1): + + title = document['title'] + ' - ' + control.lang(30003) + ' ' + str(page) + page_img = base_img_url + document['id'] + '/jpg/page_{0}_thumb_large.jpg'.format(str(page)) + page_url = base_img_url + document['id'] + '/jpg/page_{0}.jpg'.format(str(page)) + + data = {'title': title, 'image': page_img, 'url': page_url} + + empty_list.append(data) + + for i in empty_list: + li = control.item(label=i['title']) + li.setArt({'poster': i['image'], 'thumb': i['image'], 'fanart': news_fanart}) + li.setInfo('image', {'title': i['title'], 'picturepath': i['url']}) + url = i['url'] + final_list.append((url, li, False)) + + control.content(syshandle, 'images') + control.addItems(syshandle, final_list) + control.directory(syshandle) + + def main_menu(): - xml = requests.get(url='http://www.greekradio.net/mgtv.xml').text + xml = requests.get(url='http://s135598769.onlinehome.us/mgtv.xml').text mgtv = common.parseDOM(xml, 'title')[0] livetv_url = common.parseDOM(xml, 'url')[0] mgr = common.parseDOM(xml, 'title')[1] - new_radio_url = common.parseDOM(xml, 'url')[1] + radio_url = common.parseDOM(xml, 'url')[1] # Live TV - url1 = '{0}?action=play&url={1}'.format(sysaddon, livetv_url) - li = control.item(label=mgtv) - li.setArt({'icon': livetv_img, 'thumb': livetv_img, 'fanart': control.addonInfo('fanart')}) - li.setInfo('video', {'title': mgtv}) - li.setProperty('IsPlayable', 'true') - control.addItem(handle=syshandle, url=url1, listitem=li, isFolder=False) + url1 = '{0}?action={1}&url={2}'.format(sysaddon, 'play', livetv_url) + li1 = control.item(label=mgtv) + li1.setArt({'icon': livetv_img, 'thumb': livetv_img, 'fanart': control.addonInfo('fanart')}) + li1.setInfo('video', {'title': mgtv}) + li1.setProperty('IsPlayable', 'true') + control.addItem(handle=syshandle, url=url1, listitem=li1, isFolder=False) # Radio - url2 = '{0}?action=play&url={1}'.format(sysaddon, new_radio_url if control.setting('old-url') == 'false' else old_radio_url) - li = control.item(label=mgr) - li.setArt({'icon': radio_img, 'thumb': radio_img, 'fanart': control.addonInfo('fanart')}) - li.setInfo('audio', {'title': mgr}) - li.setProperty('IsPlayable', 'true') - control.addItem(handle=syshandle, url=url2, listitem=li, isFolder=False) + url2 = '{0}?action={1}&url={2}'.format(sysaddon, 'play', radio_url) + li2 = control.item(label=mgr) + li2.setArt({'icon': radio_img, 'thumb': radio_img, 'fanart': control.addonInfo('fanart')}) + li2.setInfo('audio', {'title': mgr}) + li2.setProperty('IsPlayable', 'true') + control.addItem(handle=syshandle, url=url2, listitem=li2, isFolder=False) # Youtube - url3 = '{0}?action=youtube'.format(sysaddon) - li = control.item(label='Montreal Greek TV - Youtube Channel') - li.setArt({'icon': youtube_img, 'thumb': youtube_img, 'fanart': control.addonInfo('fanart')}) - li.setInfo('video', {'title': 'Montreal Greek TV - Youtube Channel'}) - control.addItem(handle=syshandle, url=url3, listitem=li, isFolder=True) + url3 = '{0}?action={1}'.format(sysaddon, 'youtube') + li3 = control.item(label='Montreal Greek TV - {0}'.format(control.lang(30001).encode('utf-8'))) + li3.setArt({'icon': youtube_img, 'thumb': youtube_img, 'fanart': control.addonInfo('fanart')}) + li3.setInfo('video', {'title': 'Montreal Greek TV - {0}'.format(control.lang(30001).encode('utf-8'))}) + control.addItem(handle=syshandle, url=url3, listitem=li3, isFolder=True) + + # Newspaper + url4 = '{0}?action={1}'.format(sysaddon, 'news_addon') + li4 = control.item(label='The Montreal Greek Times - {0}'.format(control.lang(30002).encode('utf-8'))) + li4.setArt({'icon': news_icon, 'thumb': news_icon, 'fanart': news_fanart}) + li4.setInfo('image', {'title': 'The Montreal Greek Times - {0}'.format(control.lang(30002).encode('utf-8')), 'picturepath': news_icon}) + control.addItem(handle=syshandle, url=url4, listitem=li4, isFolder=True) control.directory(syshandle) @@ -99,7 +169,10 @@ def play_item(path): if action is None: - main_menu() + if 'image' in fp: + news_index() + else: + main_menu() elif action == 'play': @@ -109,6 +182,14 @@ elif action == 'youtube': vod() -elif action == 'settings': +elif action == 'news_index': + + news_index() + +elif action == 'paper_index': + + paper_index(url) + +elif action == 'news_addon': - control.openSettings() + control.execute('ActivateWindow(pictures,"plugin://{0}/?content_type=image",return)'.format(control.addonInfo('id'))) diff --git a/plugin.video.montreal.greek-tv/addon.xml b/plugin.video.montreal.greek-tv/addon.xml index f67862c..3421afa 100644 --- a/plugin.video.montreal.greek-tv/addon.xml +++ b/plugin.video.montreal.greek-tv/addon.xml @@ -1,12 +1,12 @@ - + - video + video image all @@ -18,6 +18,15 @@ GNU General Public License, v3 338115 +1.3.1 (28-12-2017) +- Minor name change due to author's request + +1.3.0 (27-12-2017) +- Added newspapers section +- Changed main xml url +- Removed old radio station url and accompanying toggle option +- Various minor enhancements and cosmetics + 1.2.1 (16-11-2017) - Few minor tweaks here & there - Tinified artwork @@ -44,7 +53,7 @@ icon.png fanart.jpg - http://www.greekradio.net/ + http://greektimes.ca twilight@freemail.gr https://github.com/Twilight0/plugin.video.montreal.greek-tv/ diff --git a/plugin.video.montreal.greek-tv/changelog.txt b/plugin.video.montreal.greek-tv/changelog.txt index 074863f..2586599 100644 --- a/plugin.video.montreal.greek-tv/changelog.txt +++ b/plugin.video.montreal.greek-tv/changelog.txt @@ -1,5 +1,14 @@ +1.3.1 (28-12-2017) +- Minor name change due to author's request + +1.3.0 (27-12-2017) +- Added newspapers section +- Changed main xml url +- Removed old radio station url and accompanying toggle option +- Various minor enhancements and cosmetics + 1.2.1 (16-11-2017) -- Few minor tweaks here & there +- Few minor tweaks here & there 1.2.0 (02-08-2017) - Made several changes to comply with Kodi addon submission rules diff --git a/plugin.video.montreal.greek-tv/resources/__init__.py b/plugin.video.montreal.greek-tv/resources/__init__.py index d3f5a12..8b13789 100644 --- a/plugin.video.montreal.greek-tv/resources/__init__.py +++ b/plugin.video.montreal.greek-tv/resources/__init__.py @@ -1 +1 @@ - + diff --git a/plugin.video.montreal.greek-tv/resources/language/resource.language.el_gr/strings.po b/plugin.video.montreal.greek-tv/resources/language/resource.language.el_gr/strings.po index 2c2212f..e8f6cb5 100644 --- a/plugin.video.montreal.greek-tv/resources/language/resource.language.el_gr/strings.po +++ b/plugin.video.montreal.greek-tv/resources/language/resource.language.el_gr/strings.po @@ -1,40 +1,27 @@ -# Addon Name: Montreal Greek TV -# Addon id: plugin.video.montreal.greek-tv -# Addon Provider: Twilight0 -msgid "" -msgstr "" -"Project-Id-Version: Montreal Greek TV\n" -"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" -"PO-Revision-Date: 2016-06-22 11:29+0000\n" -"Last-Translator: twilight0\n" -"Language-Team: English (http://www.domain.com)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: el\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -msgctxt "#30001" -msgid "General" -msgstr "Γενικά" - -msgctxt "#30002" -msgid "Use old radio stream" -msgstr "Κάνε χρήση της παλαιάς ροής ραδιοφώνου" - -msgctxt "#30003" -msgid "" -msgstr "" - -msgctxt "#30004" -msgid "" -msgstr "" - -msgctxt "#30005" -msgid "" -msgstr "" - -msgctxt "#30006" -msgid "" -msgstr "" - +# Addon Name: Montreal Greek TV +# Addon id: plugin.video.montreal.greek-tv +# Addon Provider: Twilight0 +msgid "" +msgstr "" +"Project-Id-Version: Montreal Greek TV\n" +"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2016-06-22 11:29+0000\n" +"Last-Translator: twilight0\n" +"Language-Team: English (http://www.domain.com)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: el\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#30001" +msgid "Youtube Channel" +msgstr "Κανάλι Youtube" + +msgctxt "#30002" +msgid "ΧΡΟΝΙΚΑ Newspaper" +msgstr "ΧΡΟΝΙΚΑ Newspaper" + +msgctxt "#30003" +msgid "Page" +msgstr "Σελίδα" diff --git a/plugin.video.montreal.greek-tv/resources/language/resource.language.en_gb/strings.po b/plugin.video.montreal.greek-tv/resources/language/resource.language.en_gb/strings.po index 91a20cd..185537c 100644 --- a/plugin.video.montreal.greek-tv/resources/language/resource.language.en_gb/strings.po +++ b/plugin.video.montreal.greek-tv/resources/language/resource.language.en_gb/strings.po @@ -1,39 +1,27 @@ -# Addon Name: Montreal Greek TV -# Addon id: plugin.video.montreal.greek-tv -# Addon Provider: Twilight0 -msgid "" -msgstr "" -"Project-Id-Version: Montreal Greek TV\n" -"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" -"PO-Revision-Date: 2016-06-22 11:29+0000\n" -"Last-Translator: twilight0\n" -"Language-Team: English (http://www.domain.com)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: en\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -msgctxt "#30001" -msgid "General" -msgstr "" - -msgctxt "#30002" -msgid "Use old radio stream" -msgstr "" - -msgctxt "#30003" -msgid "" -msgstr "" - -msgctxt "#30004" -msgid "" -msgstr "" - -msgctxt "#30005" -msgid "" -msgstr "" - -msgctxt "#30006" -msgid "" -msgstr "" +# Addon Name: Montreal Greek TV +# Addon id: plugin.video.montreal.greek-tv +# Addon Provider: Twilight0 +msgid "" +msgstr "" +"Project-Id-Version: Montreal Greek TV\n" +"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2016-06-22 11:29+0000\n" +"Last-Translator: twilight0\n" +"Language-Team: English (http://www.domain.com)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgctxt "#30001" +msgid "Youtube Channel" +msgstr "" + +msgctxt "#30002" +msgid "ΧΡΟΝΙΚΑ Newspaper" +msgstr "" + +msgctxt "#30003" +msgid "Page" +msgstr "" diff --git a/plugin.video.montreal.greek-tv/resources/lib/__init__.py b/plugin.video.montreal.greek-tv/resources/lib/__init__.py index 96ddb71..12283e0 100644 --- a/plugin.video.montreal.greek-tv/resources/lib/__init__.py +++ b/plugin.video.montreal.greek-tv/resources/lib/__init__.py @@ -25,3 +25,4 @@ syshandle = int(sys.argv[1]) params = dict(urlparse.parse_qsl(sys.argv[2][1:])) action = params.get('action', None) url = params.get('url') +image = params.get('image') diff --git a/plugin.video.montreal.greek-tv/resources/lib/control.py b/plugin.video.montreal.greek-tv/resources/lib/control.py index 3e6a8d7..8a48197 100644 --- a/plugin.video.montreal.greek-tv/resources/lib/control.py +++ b/plugin.video.montreal.greek-tv/resources/lib/control.py @@ -18,9 +18,8 @@ along with this program. If not, see . ''' - -import os, xbmc, xbmcaddon, xbmcplugin, xbmcgui, xbmcvfs - +import xbmc, xbmcaddon, xbmcplugin, xbmcgui, xbmcvfs +import os integer = 1000 lang = xbmcaddon.Addon().getLocalizedString @@ -35,6 +34,7 @@ directory = xbmcplugin.endOfDirectory content = xbmcplugin.setContent property = xbmcplugin.setProperty resolve = xbmcplugin.setResolvedUrl +sortmethod = xbmcplugin.addSortMethod infoLabel = xbmc.getInfoLabel condVisibility = xbmc.getCondVisibility @@ -45,6 +45,9 @@ execute = xbmc.executebuiltin skin = xbmc.getSkinDir() player = xbmc.Player() playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) +monitor = xbmc.Monitor() +wait = monitor.waitForAbort +aborted = monitor.abortRequested transPath = xbmc.translatePath skinPath = xbmc.translatePath('special://skin/') @@ -60,6 +63,7 @@ image = xbmcgui.ControlImage alphanum_input = xbmcgui.INPUT_ALPHANUM password_input = xbmcgui.INPUT_PASSWORD hide_input = xbmcgui.ALPHANUM_HIDE_INPUT +verify = xbmcgui.PASSWORD_VERIFY item = xbmcgui.ListItem openFile = xbmcvfs.File @@ -79,9 +83,13 @@ cacheFile = os.path.join(dataPath, 'cache.db') def infoDialog(message, heading=addonInfo('name'), icon='', time=3000): if icon == '': icon = addonInfo('icon') + try: + dialog.notification(heading, message, icon, time, sound=False) + except: + execute("Notification(%s, %s, %s, %s)" % (heading, message, time, icon)) @@ -89,11 +97,7 @@ def okDialog(heading, line1): return dialog.ok(heading, line1) -def inputDialog(heading): - return dialog.input(heading) - - -def yesnoDialog(line1, line2, line3, heading=addonInfo('name'), nolabel='', yeslabel=''): +def yesnoDialog(line1, line2='', line3='', heading=addonInfo('name'), nolabel=None, yeslabel=None): return dialog.yesno(heading, line1, line2, line3, nolabel, yeslabel) @@ -102,28 +106,20 @@ def selectDialog(list, heading=addonInfo('name')): def openSettings(query=None, id=addonInfo('id')): + try: + idle() - execute('Addon.OpenSettings(%s)' % id) + execute('Addon.OpenSettings({0})'.format(id)) if query is None: raise Exception() c, f = query.split('.') execute('SetFocus(%i)' % (int(c) + 100)) execute('SetFocus(%i)' % (int(f) + 200)) - except: - return - -def openSettings_alt(): - try: - idle() - xbmcaddon.Addon().openSettings() except: - return - -def openPlaylist(): - return execute('ActivateWindow(VideoPlaylist)') + return def refresh(): @@ -132,16 +128,3 @@ def refresh(): def idle(): return execute('Dialog.Close(busydialog)') - - -def wait4abort(secs=None): - return xbmc.Monitor().waitForAbort(secs) - - -def set_view_mode(vmid): - return execute('Container.SetViewMode({0})'.format(vmid)) - - -# for compartmentalized theme addons -def addonmedia(icon): - return join(addonPath, 'resources', 'media', icon) diff --git a/plugin.video.montreal.greek-tv/resources/lib/directory.py b/plugin.video.montreal.greek-tv/resources/lib/directory.py index 3ae0b04..eff1fc6 100644 --- a/plugin.video.montreal.greek-tv/resources/lib/directory.py +++ b/plugin.video.montreal.greek-tv/resources/lib/directory.py @@ -23,7 +23,6 @@ import urllib import control - def add(items, cacheToDisc=True, content=None, mediatype=None, infotype='video'): if items is None or len(items) == 0: @@ -127,7 +126,7 @@ def add(items, cacheToDisc=True, content=None, mediatype=None, infotype='video') except: pass - if not content is None: + if content is not None: control.content(int(sys.argv[1]), content) control.directory(int(sys.argv[1]), cacheToDisc=cacheToDisc) diff --git a/plugin.video.montreal.greek-tv/resources/lib/youtube.py b/plugin.video.montreal.greek-tv/resources/lib/youtube.py index ecd7e45..7fd224a 100644 --- a/plugin.video.montreal.greek-tv/resources/lib/youtube.py +++ b/plugin.video.montreal.greek-tv/resources/lib/youtube.py @@ -85,6 +85,7 @@ class youtube(object): return self.list def video_list(self, cid, url, pagination): + try: result = requests.get(url).text result = json.loads(result) @@ -139,8 +140,11 @@ class youtube(object): threads.append(workers.Thread(self.thread, u[i], i)) self.data.append('') - [i.start() for i in threads] - [i.join() for i in threads] + for i in threads: + i.start() + + for i in threads: + i.join() items = [] for i in self.data: @@ -180,6 +184,7 @@ class youtube(object): return self.list def thread(self, url, i): + try: result = requests.get(url).text self.data[i] = result diff --git a/plugin.video.montreal.greek-tv/resources/media/newspaper_fanart.png b/plugin.video.montreal.greek-tv/resources/media/newspaper_fanart.png new file mode 100644 index 0000000..51ba560 Binary files /dev/null and b/plugin.video.montreal.greek-tv/resources/media/newspaper_fanart.png differ diff --git a/plugin.video.montreal.greek-tv/resources/media/newspaper_icon.png b/plugin.video.montreal.greek-tv/resources/media/newspaper_icon.png new file mode 100644 index 0000000..6c39908 Binary files /dev/null and b/plugin.video.montreal.greek-tv/resources/media/newspaper_icon.png differ diff --git a/plugin.video.montreal.greek-tv/resources/settings.xml b/plugin.video.montreal.greek-tv/resources/settings.xml deleted file mode 100644 index 8cf2505..0000000 --- a/plugin.video.montreal.greek-tv/resources/settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file -- cgit v1.2.3