Exemple #1
0
    def _on_play(self, context, re_match):
        params = context.get_params()
        slug = params['slug']

        stream_urls = self._client.get_video_url_by_slug(slug)
        if 'youtube' in stream_urls:
            return UriItem(stream_urls['youtube'])

        if 'streaming' in stream_urls:
            return UriItem(stream_urls['streaming'])

        return False
Exemple #2
0
def process(category, provider, context, re_match):
    result = []

    # we need a login
    client = provider.get_client(context)
    if not provider.is_logged_in() and category in [
            'new_uploaded_videos_tv', 'disliked_videos'
    ]:
        return UriItem(context.create_uri(['sign', 'in']))

    if category == 'related_videos':
        return _process_related_videos(provider, context, re_match)
    elif category == 'popular_right_now':
        return _process_popular_right_now(provider, context, re_match)
    elif category == 'recommendations':
        return _process_recommendations(provider, context, re_match)
    elif category == 'browse_channels':
        return _process_browse_channels(provider, context, re_match)
    elif category == 'new_uploaded_videos_tv':
        return _process_new_uploaded_videos_tv(provider, context, re_match)
    elif category == 'disliked_videos':
        return _process_disliked_videos(provider, context, re_match)
    elif category == 'live':
        return _process_live_events(provider, context, re_match)
    elif category == 'description_links':
        return _process_description_links(provider, context, re_match)
    else:
        raise kodion.KodionException(
            "YouTube special category '%s' not found" % category)
Exemple #3
0
    def on_play(self, context, re_match):
        channel_id = re_match.group('channel_id')
        channel_config = Client.CHANNELS[channel_id]
        video_id = context.get_param('video_id', '')
        video_path = context.get_param('video_path', '')

        if context.get_param('free', '1') == '0':
            price = context.get_param('price', '')
            title = context.localize(
                self._local_map['nowtv.buy.title']) % price
            context.get_ui().on_ok(
                title, context.localize(self._local_map['nowtv.buy.text']))
            return False

        if video_id and video_path:
            try:
                video_streams = self.get_client(context).get_video_streams(
                    channel_config, video_path)
                video_stream = kodion.utils.select_stream(
                    context, video_streams)
                return UriItem(video_stream['url'])
            except UnsupportedStreamException, ex:
                context.get_ui().show_notification(
                    context.localize(
                        self._local_map['now.exception.drm_not_supported']))
                return False
Exemple #4
0
    def _on_play(self, context, re_match):
        video_id = context.get_param('video_id', '')
        if video_id:
            try:
                streams = self.get_client(context).get_film_streams(video_id)
            except UnsupportedStreamException, ex:
                context.get_ui().show_notification(context.localize(self._local_map['now.exception.drm_not_supported']))
                return False

            uri_item = UriItem(streams[0])
            return uri_item
Exemple #5
0
def process(method, provider, context, re_match):
    result = []

    # we need a login
    client = provider.get_client(context)
    if not provider.is_logged_in():
        return UriItem(context.create_uri(['sign', 'in']))

    if method == 'list':
        result.extend(_process_list(provider, context, re_match))
        pass
    elif method == 'add':
        return _process_add(provider, context, re_match)
    elif method == 'remove':
        return _process_remove(provider, context, re_match)
    else:
        raise kodion.KodionException("Unknown subscriptions method '%s'" %
                                     method)

    return result
Exemple #6
0
    def _play(self, context, re_match):
        params = context.get_params()
        video_id = params.get('id', '')
        if video_id == '':
            raise kodion.KodimonException(
                "Missing parameter 'id' to play video")

        json_data = self._get_client(context).get_video_url(video_id)
        video_url = json_data.get('VideoURL', '')
        if not video_url:
            raise kodion.KodimonException(
                "Could not resolve url for video '%s'" % video_id)

        re_drm_match = re.search(r'no_flash_de|drm_update_app_de', video_url)
        if re_drm_match:
            context.get_ui().show_notification(
                context.localize(
                    self._local_map['7tv.exception.drm_not_supported']))
            return False

        return UriItem(video_url)