diff options
author | Razzeee <razzeee@gmail.com> | 2017-04-09 23:14:54 +0200 |
---|---|---|
committer | enen92 <enen92@users.noreply.github.com> | 2017-04-09 22:14:54 +0100 |
commit | 479a368e3491d81d93f70488becec23e078448e8 (patch) | |
tree | e38f57a272d76f59cecdc15c35c6e0fb43862bb8 /plugin.video.rocketbeans | |
parent | 9008136341ac30a204db34cd23c89d2875970453 (diff) |
[plugin.video.rocketbeans] 1.0.1 (#1138)
Diffstat (limited to 'plugin.video.rocketbeans')
-rw-r--r-- | plugin.video.rocketbeans/addon.xml | 12 | ||||
-rw-r--r-- | plugin.video.rocketbeans/resources/lib/__init__.py | 0 | ||||
-rw-r--r-- | plugin.video.rocketbeans/resources/lib/guide.py | 45 | ||||
-rw-r--r-- | plugin.video.rocketbeans/resources/lib/plugin.py | 51 | ||||
-rw-r--r-- | plugin.video.rocketbeans/resources/lib/youtube.py | 20 |
5 files changed, 124 insertions, 4 deletions
diff --git a/plugin.video.rocketbeans/addon.xml b/plugin.video.rocketbeans/addon.xml index f3535e3..70a51b3 100644 --- a/plugin.video.rocketbeans/addon.xml +++ b/plugin.video.rocketbeans/addon.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<addon id="plugin.video.rocketbeans" version="1.0.0" name="Rocket Beans TV" provider-name="Razzeee"> +<addon id="plugin.video.rocketbeans" version="1.0.1" name="Rocket Beans TV" provider-name="Razzeee"> <requires> <import addon="xbmc.python" version="2.25.0" /> <import addon="plugin.video.youtube" version="5.2.1" /> @@ -11,8 +11,12 @@ <extension point="xbmc.addon.metadata"> <summary lang="en_GB">Rocket Beans TV | 24/7 Entertainment</summary> <summary lang="de_DE">Rocket Beans TV | 24/7 Entertainment</summary> - <description lang="en_GB">Rocket Beans TV is 24/7 Entertainment focusing on digital topics like movies, games and comedy.</description> - <description lang="de_DE">Rocket Beans TV ist Entertainment 24/7 zu digitalen Themen wie Filme, Games und Comedy.</description> + <description lang="en_GB">Rocket Beans TV is 24/7 Entertainment focusing on digital topics like gaming and digital popculture.</description> + <description lang="de_DE">Willkommen bei Rocket Beans TV, dem ersten deutschen, unabhängigen und Community-getriebenem 24/7-Web-Sender! + +Auf YouTube senden die Beans 24 Stunden am Tag und versorgen euch mit geilem Content rund um Gaming und digitaler Popkultur. + +Wir machen nur, auf was wir Bock haben – und das mit Erfolg! Egal ob spannende Let’s Plays, interaktive Formate wie „Chat Duell“, unser Kinomagazin „Kino+“ oder exklusive Events: Mit unseren ehemaligen Game One-Moderatoren Budi, Etienne, Nils und Simon, dem fantastischen Einsatz unseres hochmotivierten Raketenteams und dem beispiellosen Support unserer Bohnen-Community liefern wir euch bestes TV-Entertainment abseits ausgetretener Pfade – spontan, authentisch und unabhängig.</description> <language>de</language> <platform>all</platform> <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license> @@ -24,6 +28,6 @@ <screenshot>resources/screenshot-01.png</screenshot> <screenshot>resources/screenshot-02.png</screenshot> </assets> - <news>Initial release</news> + <news>Fixed problem with startup</news> </extension> </addon> diff --git a/plugin.video.rocketbeans/resources/lib/__init__.py b/plugin.video.rocketbeans/resources/lib/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/plugin.video.rocketbeans/resources/lib/__init__.py diff --git a/plugin.video.rocketbeans/resources/lib/guide.py b/plugin.video.rocketbeans/resources/lib/guide.py new file mode 100644 index 0000000..f8438fc --- /dev/null +++ b/plugin.video.rocketbeans/resources/lib/guide.py @@ -0,0 +1,45 @@ +import datetime +import json +import time +import urllib2 + +from resources.data import config + + +def show_guide(): + items = [] + + request = urllib2.Request(config.GUIDE_URL, headers={'User-Agent': 'Kodi'}) + response = urllib2.urlopen(request) + string_data = response.read() + + data = json.loads(string_data) + schedule = data['schedule'] + + cur_date = None + for item in schedule: + startTime = datetime.datetime( + *time.strptime(item['timeStart'][:19], "%Y-%m-%dT%H:%M:%S")[:6]) + title = item['title'] + type = item['type'] + + if cur_date is None: + cur_date = startTime.date() + elif (startTime.date() - cur_date).days != 0: + items.append(startTime.strftime('--- %A, %d. %B ---')) + cur_date = startTime.date() + + if not type: + type_string = '' + else: + type_name = type[0].upper() + type[1:] + if type == 'live': + type_string = '[COLOR FFFF0000][' + type_name + '][/COLOR]' + elif type == 'premiere': + type_string = '[COLOR FF0000FF][' + type_name + '][/COLOR]' + else: + type_string = type_name + + items.append(startTime.strftime('%H:%M ') + title + ' ' + type_string) + + return items diff --git a/plugin.video.rocketbeans/resources/lib/plugin.py b/plugin.video.rocketbeans/resources/lib/plugin.py new file mode 100644 index 0000000..215f8c7 --- /dev/null +++ b/plugin.video.rocketbeans/resources/lib/plugin.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +import routing +import sys +import urllib +import urlparse + +from resources.data import config +from resources.lib.guide import show_guide +from resources.lib.youtube import get_live_video_id_from_channel_id +from xbmcgui import ListItem +from xbmcplugin import addDirectoryItem, endOfDirectory, setContent + +plugin = routing.Plugin() +setContent(plugin.handle, 'videos') + + +@plugin.route('/') +def index(): + video_id = get_live_video_id_from_channel_id(config.CHANNEL_ID) + url = "plugin://plugin.video.youtube/play/?video_id=%s" % video_id + li = ListItem(label='Live', + thumbnailImage="https://i.ytimg.com/vi/%s/maxresdefault_live.jpg" % video_id) + li.setProperty('isPlayable', 'true') + addDirectoryItem(plugin.handle, url, li) + + url = "plugin://plugin.video.youtube/user/%s/" % config.CHANNEL_ID + addDirectoryItem(plugin.handle, url, ListItem('Mediathek'), True) + + url = "plugin://plugin.video.youtube/channel/%s/" % config.LETS_PLAY_CHANNEL_ID + addDirectoryItem( + plugin.handle, url, ListItem('Let\'s-Play-Mediathek'), True) + + addDirectoryItem( + plugin.handle, plugin.url_for(guide), ListItem('Sendeplan'), True) + + endOfDirectory(plugin.handle) + + +@plugin.route('/guide') +def guide(): + guide_items = show_guide() + + for guide_item in guide_items: + li = ListItem(guide_item) + addDirectoryItem(plugin.handle, '', li) + endOfDirectory(plugin.handle) + + +def run(): + plugin.run() diff --git a/plugin.video.rocketbeans/resources/lib/youtube.py b/plugin.video.rocketbeans/resources/lib/youtube.py new file mode 100644 index 0000000..8ef78b9 --- /dev/null +++ b/plugin.video.rocketbeans/resources/lib/youtube.py @@ -0,0 +1,20 @@ +import re +import urllib2 + +import xbmc + + +def get_live_video_id_from_channel_id(channel_id): + request = urllib2.Request("https://www.youtube.com/c/%s/live" % channel_id) + response = urllib2.urlopen(request) + string_data = response.read() + lines = string_data.splitlines() + + re_video_url = re.compile(r'http://www.youtube.com/v/(?P<video_id>[^\?]+)') + + + for line in lines: + #xbmc.log(line) + re_video_url_match = re.search(re_video_url, line) + if re_video_url_match: + return re_video_url_match.group('video_id') |