Ejemplo n.º 1
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
Ejemplo n.º 2
0
def MetadataObjectForURL(media_info, url_items, player):
    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.title = title
    metadata_object.title = unicode(media_info['name'])
    metadata_object.rating_key = media_info['rating_key']
    metadata_object.rating = media_info['rating']
    metadata_object.thumb = media_info['thumb']
    metadata_object.art = media_info['thumb']
    metadata_object.tags = media_info['tags']
    metadata_object.summary = media_info['summary']
    # metadata_object.directors = data['directors']

    if 'duration' in media_info:
        metadata_object.duration = int(media_info['duration']) * 1000

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

    metadata_object.items.extend(MediaObjectsForURL(url_items, player))

    return metadata_object
Ejemplo n.º 3
0
def MediaObjectsForURL(urls, player):
    media_objects = []

    for url, config in urls.iteritems():
        play_callback = Callback(player, url=url, play_list=False)

        media_object = FlowBuilder.build_media_object(play_callback, config)

        media_objects.append(media_object)

    return media_objects
Ejemplo n.º 4
0
def MediaObjectsForURL(urls, player):
    media_objects = []

    for url, config in urls.iteritems():
        play_callback = Callback(player, url=url, play_list=False)

        media_object = FlowBuilder.build_media_object(play_callback, config)

        media_objects.append(media_object)

    return media_objects
Ejemplo n.º 5
0
def HandleTrack(container=False, **params):
    media_info = MediaInfo(**params)

    url = media_info['id']

    if 'm4a' in media_info['format']:
        format = 'm4a'
    else:
        format = 'mp3'

    metadata = FlowBuilder.get_metadata(format)

    metadata["bitrate"] = media_info['bitrate']
    metadata["duration"] = media_info['duration']

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

    metadata_object.key = Callback(HandleTrack, container=True, **media_info)
    metadata_object.rating_key = unicode(media_info['name'])
    metadata_object.title = media_info['name']
    metadata_object.artist = media_info['name']
    metadata_object.thumb = media_info['thumb']

    if 'duration' in media_info:
        metadata_object.duration = int(media_info['duration'])

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

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

    metadata_object.items.append(media_object)

    if container:
        oc = ObjectContainer(title2=unicode(media_info['name']))

        oc.add(metadata_object)

        return oc
    else:
        return metadata_object
Ejemplo n.º 6
0
def HandleTrack(container=False, **params):
    media_info = MediaInfo(**params)

    url = media_info['id']

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

    metadata_object.key = Callback(HandleTrack, container=True, **media_info)
    metadata_object.rating_key = unicode(media_info['name'])
    metadata_object.title = unicode(media_info['name'])
    metadata_object.duration = int(media_info['duration'])

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

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

    if 'm4a' in media_info['format']:
        format = 'm4a'
    else:
        format = 'mp3'

    metadata = FlowBuilder.get_metadata(format)

    metadata["bitrate"] = media_info['bitrate']
    metadata["duration"] = media_info['duration']

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

    metadata_object.items.append(media_object)

    if container:
        oc = ObjectContainer(title2=unicode(params['name']))

        oc.add(metadata_object)

        return oc
    else:
        return metadata_object
Ejemplo n.º 7
0
def MediaObjectsForURL(url_items, player):
    media_objects = []

    for item in url_items:
        url = item['url']
        config = item['config']

        play_callback = Callback(player, url=url)

        media_object = FlowBuilder.build_media_object(play_callback, config)

        media_objects.append(media_object)

    return media_objects
Ejemplo n.º 8
0
def MediaObjectsForURL(url_items, player):
    media_objects = []

    for item in url_items:
        url = item['url']
        config = item['config']

        play_callback = Callback(player, url=url)

        media_object = FlowBuilder.build_media_object(play_callback, config)

        media_objects.append(media_object)

    return media_objects
Ejemplo n.º 9
0
def MetadataObjectForURL(media_info, url_items, player):
    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.title = media_info['name']
    metadata_object.rating_key = media_info['rating_key']
    metadata_object.rating = media_info['rating']
    metadata_object.thumb = media_info['thumb']
    metadata_object.art = media_info['thumb']
    metadata_object.tags = media_info['tags']
    metadata_object.summary = media_info['summary']
    # metadata_object.directors = data['directors']

    if 'duration' in media_info:
        metadata_object.duration = int(media_info['duration']) * 1000

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

    metadata_object.items.extend(MediaObjectsForURL(url_items, player))

    return metadata_object
Ejemplo n.º 10
0
# -*- coding: utf-8 -*-

from media_info import MediaInfo
import util
import plex_util
import pagination
from flow_builder import FlowBuilder

from muz_arbuz_plex_service import MuzArbuzPlexService

service = MuzArbuzPlexService()

builder = FlowBuilder()


@route(PREFIX + '/albums')
def HandleAlbums(title, page=1, **params):
    oc = ObjectContainer(title2=unicode(L(title)))

    page = int(page)
    limit = util.get_elements_per_page()
    offset = (page - 1) * limit

    response = service.get_albums(limit=limit,
                                  offset=offset,
                                  year__gte=util.get_start_music_year(),
                                  year__lte=util.get_end_music_year(),
                                  **service.filter_request_params(params))

    oc.title2 = unicode(L(title)) + ' (' + str(
        response['meta']['total_count']) + ')'
Ejemplo n.º 11
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
Ejemplo n.º 12
0
import util
import common
import plex_video_service
import radio_service
from flow_builder import FlowBuilder
builder = FlowBuilder()
service = plex_video_service.PlexVideoService()
radio_service = radio_service.RadioService()
import live
import archive
import bookmarks
import radio
def Start():
    Plugin.AddViewGroup("InfoList", viewMode="InfoList", mediaType="items")
    Plugin.AddViewGroup("List", viewMode="List", mediaType="items")
    Plugin.AddViewGroup('PanelStream', viewMode='PanelStream', mediaType='items')
    Plugin.AddViewGroup('MediaPreview', viewMode='MediaPreview', mediaType='items')
    # DirectoryObject.thumb = R(ICON)
    DirectoryObject.art = R(common.ART)
    # VideoClipObject.thumb = R(ICON)
    VideoClipObject.art = R(common.ART)
    HTTP.CacheTime = CACHE_1HOUR
    util.validate_prefs()
@handler(common.PREFIX, 'Etvnet', thumb=common.ICON, art=common.ART, allow_sync=True)
def MainMenu(autorizationCompleted=False, resetToken=False):
    oc = ObjectContainer(title1='Etvnet', art=R(common.ART))
    if resetToken:
        service.reset_token()
    if not service.check_token():
        oc.add(DirectoryObject(