Example #1
0
def GetItem(playerid, properties):
    """
    JsonRPC Callback Player.GetItem
    """
    app = freevo.taskmanager.applications[-1]
    if not 'type' in properties:
        properties.append('type')
    result = utils.fill_basic_item_properties(app.item, properties)
    result['id'] = 0
    for prop in properties:
        if prop == 'streamdetails':
            value = {
                'audio': [],
                'subtitle': [],
                'video': [] }
            if app.name == 'videoplayer':
                for a in app.item.metadata.audio:
                    value['audio'].append(utils.fill_audio_details(a))
                for s in app.item.metadata.subtitles:
                    value['subtitle'].append(utils.fill_subtitle_details(s))
                for v in app.item.metadata.video:
                    value['video'].append({'aspect': v.aspect, 'duration': int(app.item.metadata.length),
                                           'height': v.height, 'width': v.width, 'stereomode': '',
                                           'codec': v.codec.lower().replace('h.264 avc', 'h264')})
        elif prop == 'playcount':
            value = 0     # FIXME
        elif prop == 'resume':
            value = {
                'position': 0.0,
                'total': 0.0 }  # FIXME
        else:
            log.error('no support for %s' % prop)
            continue
        result[prop] = value
    return {'item': result }
Example #2
0
def GetItems(playlistid, properties, limits):
    """
    JsonRPC Callback Playlist.GetItems
    """
    app = freevo.taskmanager.applications[-1]
    # Dummy playlist with current item. Fix this to use the actual
    # playlist in progress
    if app.name == 'menu':
        playlist = []
    elif app.name in ('videoplayer', 'audioplayer', 'imageviewer'):
        if not app.item.playlist:
            playlist = [ app.item ]
        else:
            playlist = app.item.playlist.choices
    else:
        playlist = []
        log.error('unsupported application %s' % app)
    result = []
    for item in playlist:
        _properties = properties[:]
        result.append(utils.fill_basic_item_properties(item, _properties))
        for prop in _properties:
            if prop == 'playcount':
                value = 0
            elif prop == 'duration':
                value = app.item.info.get('length')
            else:
                log.error('no support for %s' % prop)
                value = ''
            result[-1][prop] = value
    start = limits['start']
    end = min(limits['end'], len(result))
    return {
        'limits': {'start': start, 'end': end, 'total': len(result)},
        'items': result[start:end+1] }
Example #3
0
def GetItem(playerid, properties):
    """
    JsonRPC Callback Player.GetItem
    """
    app = freevo.taskmanager.applications[-1]
    if not 'type' in properties:
        properties.append('type')
    result = utils.fill_basic_item_properties(app.item, properties)
    result['id'] = 0
    for prop in properties:
        if prop == 'streamdetails':
            value = {
                'audio': [],
                'subtitle': [],
                'video': [] }
            if app.name == 'videoplayer':
                for a in app.item.metadata.audio:
                    value['audio'].append(utils.fill_audio_details(a))
                for s in app.item.metadata.subtitles:
                    value['subtitle'].append(utils.fill_subtitle_details(s))
                for v in app.item.metadata.video:
                    value['video'].append({'aspect': v.aspect, 'duration': int(app.item.metadata.length),
                                           'height': v.height, 'width': v.width, 'stereomode': '',
                                           'codec': v.codec.lower().replace('h.264 avc', 'h264')})
        elif prop == 'playcount':
            value = 0     # FIXME
        elif prop == 'art':
            value = {}
            if app.item.get('series') and app.item.get('episode'):
                series = app.item.get('series')
                series = kaa.webmetadata.tv.series(series)
                if series:
                    if series.banner:
                        value['tvshow.banner'] = utils.register_image(series.banner)
                    if series.image:
                        value['tvshow.fanart'] = utils.register_image(series.image)
                    if series.poster:
                        value['tvshow.poster'] = utils.register_image(series.poster)
            thumb = app.item.get('image')
            if thumb:
                value['thumb'] = utils.register_image(thumb, app.item)
            print value
        else:
            log.error('no support for %s' % prop)
            value = ''
        result[prop] = value
    return {'item': result }
Example #4
0
def GetItem(playerid, properties):
    """
    JsonRPC Callback Player.GetItem
    """
    app = freevo.taskmanager.applications[-1]
    if not 'type' in properties:
        properties.append('type')
    result = utils.fill_basic_item_properties(app.item, properties)
    result['id'] = 0
    for prop in properties:
        if prop == 'streamdetails':
            value = {'audio': [], 'subtitle': [], 'video': []}
            if app.name == 'videoplayer':
                for a in app.item.metadata.audio:
                    value['audio'].append(utils.fill_audio_details(a))
                for s in app.item.metadata.subtitles:
                    value['subtitle'].append(utils.fill_subtitle_details(s))
                for v in app.item.metadata.video:
                    value['video'].append({
                        'aspect':
                        v.aspect,
                        'duration':
                        int(app.item.metadata.length),
                        'height':
                        v.height,
                        'width':
                        v.width,
                        'stereomode':
                        '',
                        'codec':
                        v.codec.lower().replace('h.264 avc', 'h264')
                    })
        elif prop == 'playcount':
            value = 0  # FIXME
        elif prop == 'resume':
            value = {'position': 0.0, 'total': 0.0}  # FIXME
        else:
            log.error('no support for %s' % prop)
            continue
        result[prop] = value
    return {'item': result}