Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed api changes, added fire via red text to the docu title, add doc…

…u description
  • Loading branch information...
commit 6216c5cbb635a5e231f65eb4fac283446a0d177e 1 parent 72c94ea
@dersphere authored
Showing with 17 additions and 23 deletions.
  1. +15 −21 addon.py
  2. +2 −2 resources/lib/api.py
View
36 addon.py
@@ -120,27 +120,19 @@ def show_new_docus():
def play(docu_id):
docu = api.get_docu(docu_id)
plugin.log.info(repr(docu))
- # FIXME: Replace with 'media'-Code
- import re
- playback_url = None
-
- re_youtube_id = re.compile('watch\?v=(.*)')
- m = re_youtube_id.search(docu['embed'])
- if m:
- video_id = m.groups(1)
- playback_url = ('plugin://plugin.video.youtube/'
- '?action=play_video&videoid=%s' % video_id)
-
- re_youtube_playlist = re.compile('playlist\?list=(.*)')
- m = re_youtube_playlist.search(docu['embed'])
- if m:
- video_id = m.groups(1)
- playback_url = ('plugin://plugin.video.youtube/'
- '?action=play_all&playlist=%s' % video_id)
- if playback_url:
- plugin.log.info('Found URL: %s' % playback_url)
- return plugin.set_resolved_url(playback_url)
+ media = docu.get('media', {})
+ source, media_type = media.get('source'), media.get('type')
+ if source == 'youtube.com':
+ if media_type == 'video':
+ playback_url = ('plugin://plugin.video.youtube/'
+ '?action=play_video&videoid=%s' % media.get('id'))
+ return plugin.set_resolved_url(playback_url)
+ elif media_type == 'playlist':
+ playback_url = ('plugin://plugin.video.youtube/'
+ '?action=play_all&playlist=%s' % media.get('id'))
+ return plugin.set_resolved_url(playback_url)
else:
+ plugin.log.warning(repr(media))
plugin.notify(msg=_('Not Implemented yet'))
@@ -148,14 +140,16 @@ def __add_docus(docus):
# FIXME: Pagination
items = []
for i, docu in enumerate(docus):
+ title = u'[COLOR red][%s°][/COLOR] %s' % (docu['fire'], docu['title'])
item = {
- 'label': docu['title'],
+ 'label': title,
'icon': docu['thumb'],
'info': {
#'count': str(i),
'studio': docu['username'] or '',
'genre': docu['tags'] or '',
'tagline': docu['lang'] or '',
+ 'plot': docu['description'] or '',
#'votes': int(docu['views'] or '0'),
},
'path': plugin.url_for(
View
4 resources/lib/api.py
@@ -71,7 +71,7 @@ def get_docus_by_tag(self, tag_id):
def get_docu(self, docu_id):
params = {'id': docu_id}
json_data = self.__api_call(path='get_item', params=params)
- return json_data.get('items', [])[0]
+ return json_data.get('status', {}).get('items', [])[0]
def _get_items(self, **kwargs):
params = {}
@@ -87,7 +87,7 @@ def _get_items(self, **kwargs):
if not 'online' in params:
params['online'] = self.show_only_online
json_data = self.__api_call(path='get_items', params=params)
- items = json_data.get('items', [])
+ items = json_data.get('status', {}).get('items', [])
total_count = int(json_data.get('total_count', 0))
return items, total_count
Please sign in to comment.
Something went wrong with that request. Please try again.