示例#1
0
def PlayVideo(url, play_list=True):
    if not url:
        return plex_util.no_contents()
    else:
        if str(play_list) == 'True':
            url = Callback(PlayList, url=url)

        return IndirectResponse(MovieObject, key=RTMPVideoURL(url))
示例#2
0
def PlayVideo(url, play_list=True):
    if not url:
        return plex_util.no_contents()
    else:
        if str(play_list) == 'True':
            url = Callback(PlayList, url=url)

        return IndirectResponse(MovieObject, key=RTMPVideoURL(url))
示例#3
0
def HandleEpisode(operation=None, container=False, **params):
    oc = ObjectContainer(title2=unicode(L(params['name'])), user_agent='Plex')

    media_info = MediaInfo(**params)

    if 'season' in media_info:
        season = media_info['season']
    else:
        season = None

    if 'episode' in media_info:
        episode = media_info['episode']
    else:
        episode = None

    if season and int(season) > 0 and episode:
        urls = json.loads(urllib.unquote_plus(media_info['id']))
    else:
        urls = service.get_urls(path=media_info['id'])

    if len(urls) == 0:
        return plex_util.no_contents()
    else:
        service.queue.handle_bookmark_operation(operation, media_info)

        metadata_object = FlowBuilder.build_metadata_object(
            media_type=media_info['type'], title=media_info['name'])

        metadata_object.key = Callback(HandleEpisode,
                                       container=True,
                                       **media_info)

        metadata_object.rating_key = unicode(media_info['name'])
        metadata_object.thumb = media_info['thumb']
        metadata_object.title = media_info['name']

        for url in urls:
            metadata = service.get_metadata(url)

            if 'height' in metadata:
                metadata["video_resolution"] = metadata['height']

            media_object = FlowBuilder.build_media_object(
                Callback(common_routes.PlayAudio, url=url), metadata)

            metadata_object.items.append(media_object)

        oc.add(metadata_object)

        if str(container) == 'False':
            history.push_to_history(Data, media_info)
            service.queue.append_bookmark_controls(oc, HandleEpisode,
                                                   media_info)

    return oc
示例#4
0
def HandleMovie(operation=None, container=False, **params):
    # urls = service.load_cache(path)
    #
    # if not urls:
    #     urls = service.retrieve_urls(path, season=season, episode=episode)
    #
    # service.save_cache(urls)

    if 'season' in params:
        season = params['season']
    else:
        season = None

    if 'episode' in params:
        episode = params['episode']
    else:
        episode = None

    urls = service.retrieve_urls(params['id'], season=season, episode=episode)

    if not urls:
        return plex_util.no_contents()
    else:
        oc = ObjectContainer(title2=unicode(params['name']))

        media_info = MediaInfo(**params)

        service.queue.handle_bookmark_operation(operation, media_info)

        document = service.fetch_document(params['id'])
        data = service.get_media_data(document)

        if episode:
            media_info['type'] = 'episode'
            media_info['index'] = int(episode)
            media_info['season'] = int(season)
            media_info['content_rating'] = data['rating']
            # show=show,
        else:
            media_info['type'] = 'movie'
            media_info['year'] = data['year']
            media_info['genres'] = data['genres']
            media_info['countries'] = data['countries']
            media_info['genres'] = data['genres']
            # video.tagline = 'tagline'
            # video.original_title = 'original_title'

        url_items = []

        for url in urls:
            url_items.append(
                {
                    "url": url['url'],
                    "config": {
                        # "container": audio_container,
                        # "audio_codec": audio_codec,
                        "video_resolution": url['height'],
                        "width": url['width'],
                        "height": url['height'],
                        "bitrate": url['bandwidth'],
                        # "duration": duration
                    }
                })

        media_info['rating_key'] = service.get_episode_url(params['id'], season, 0)
        media_info['rating'] = data['rating']
        media_info['tags'] = data['tags']
        media_info['summary'] = data['summary']
        media_info['thumb'] = data['thumb']
        # media_info['art'] = data['thumb']
        # media_info['season'] = season
        # media_info['episode'] = episode

        oc.add(MetadataObjectForURL(media_info, url_items=url_items, player=PlayVideo))

        if str(container) == 'False':
            history.push_to_history(Data, media_info)
            service.queue.append_bookmark_controls(oc, HandleMovie, media_info)

        return oc
示例#5
0
def HandleMovie(operation=None, container=False, **params):
    oc = ObjectContainer(title2=unicode(L(params['name'])))

    media_info = MediaInfo(**params)

    media_data = service.get_media_data(media_info['id'])

    if 'season' in media_info:
        season = media_info['season']
    else:
        season = None

    if 'episode' in media_info:
        episode = media_info['episode']
    else:
        episode = None

    if season and int(season) > 0 and episode:
        urls = service.get_urls(url=media_info['id'])
    else:
        urls = service.get_urls(path=media_info['id'])

    if len(urls) == 0:
        return plex_util.no_contents()
    else:
        service.queue.handle_bookmark_operation(operation, media_info)

        metadata_object = FlowBuilder.build_metadata_object(media_type=media_info['type'], title=media_info['name'])

        metadata_object.key = Callback(HandleMovie, container=True, **media_info)

        metadata_object.rating_key = unicode(media_info['name'])

        if 'thumb' in media_info:
            metadata_object.thumb = media_info['thumb']

        if 'name' in media_info:
            metadata_object.title = media_info['name']

        if 'tags' in media_info:
            metadata_object.tags = media_data['tags']

        if 'duration' in media_info:
            metadata_object.duration = media_data['duration']

        if 'description' in media_info:
            metadata_object.summary = media_data['description']

        if 'directors' in media_info:
            metadata_object.directors = media_data['directors']

        for url in urls:
            metadata = service.get_metadata(url)

            metadata["video_resolution"] = metadata['height']

            media_object = FlowBuilder.build_media_object(Callback(common_routes.PlayVideo, url=url), metadata)

            metadata_object.items.append(media_object)

        oc.add(metadata_object)

        if str(container) == 'False':
            history.push_to_history(Data, media_info)
            service.queue.append_bookmark_controls(oc, HandleMovie, media_info)

        return oc
示例#6
0
def HandleMovie(operation=None, container=False, **params):
    # urls = service.load_cache(path)
    #
    # if not urls:
    #     urls = service.retrieve_urls(path, season=season, episode=episode)
    #
    # service.save_cache(urls)

    if 'season' in params:
        season = params['season']
    else:
        season = None

    if 'episode' in params:
        episode = params['episode']
    else:
        episode = None

    urls = service.retrieve_urls(params['id'], season=season, episode=episode)

    if not urls:
        return plex_util.no_contents()
    else:
        oc = ObjectContainer(title2=unicode(params['name']))

        media_info = MediaInfo(**params)

        service.queue.handle_bookmark_operation(operation, media_info)

        document = service.fetch_document(params['id'])
        data = service.get_media_data(document)

        if episode:
            media_info['type'] = 'episode'
            media_info['index'] = int(episode)
            media_info['season'] = int(season)
            media_info['content_rating'] = data['rating']
            # show=show,
        else:
            media_info['type'] = 'movie'
            media_info['year'] = data['year']
            media_info['genres'] = data['genres']
            media_info['countries'] = data['countries']
            media_info['genres'] = data['genres']
            # video.tagline = 'tagline'
            # video.original_title = 'original_title'

        url_items = []

        for url in urls:
            url_items.append({
                "url": url['url'],
                "config": {
                    # "container": audio_container,
                    # "audio_codec": audio_codec,
                    "video_resolution": url['height'],
                    "width": url['width'],
                    "height": url['height'],
                    "bitrate": url['bandwidth'],
                    # "duration": duration
                }
            })

        media_info['rating_key'] = service.get_episode_url(
            params['id'], season, 0)
        media_info['rating'] = data['rating']
        media_info['tags'] = data['tags']
        media_info['summary'] = data['summary']
        media_info['thumb'] = data['thumb']
        # media_info['art'] = data['thumb']
        # media_info['season'] = season
        # media_info['episode'] = episode

        oc.add(
            MetadataObjectForURL(media_info,
                                 url_items=url_items,
                                 player=PlayVideo))

        if str(container) == 'False':
            history.push_to_history(Data, media_info)
            service.queue.append_bookmark_controls(oc, HandleMovie, media_info)

        return oc