Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 21 additions and 23 deletions.
  1. +21 −23 addon.py
View
44 addon.py
@@ -120,42 +120,40 @@ 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)
- else:
- plugin.notify(msg=_('Not Implemented yet'))
+ 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)
+ elif source == 'vimeo.com':
+ if media_type == 'video':
+ playback_url = ('plugin://plugin.video.vimeo/'
+ '?action=play_video&videoid=%s' % media.get('id'))
+ return plugin.set_resolved_url(playback_url)
+ plugin.log.warning(repr(media))
+ plugin.notify(msg=_('Not Implemented yet'))
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(

No commit comments for this range

Something went wrong with that request. Please try again.