Ejemplo n.º 1
0
def MetadataObjectForURL(name, channel_id, thumb, files):
    video = MovieObject(
        rating_key='rating_key',
        title=unicode(name),
        thumb=thumb,
        art=thumb
    )

    video.key = Callback(GetLiveChannel, name=name, channel_id=channel_id, thumb=thumb, files=files, container=True)

    offset = service.get_offset(util.get_time_shift())

    format ='mp4'
    quality_level = util.get_quality_level()

    # Log(Client.Platform in util.RAW_HLS_CLIENTS)
    # Log(Client.Product)  # Plex Web
    # Log(Client.Platform)  # Safari

    # if Client.Platform == 'Chrome':
    #     quality_level = util.get_quality_level()
    # else:
    #     quality_level = None

    files = json.loads(urllib.unquote_plus(files))

    bitrates = service.bitrates(files, accepted_format=format, quality_level=quality_level)

    video.items.extend(MediaObjectsForURL(bitrates, channel_id, offset, format))

    return video
Ejemplo n.º 2
0
def add_schedule(oc, channel_id, default_time, list):
    channels = service.get_live_channels()['data']

    channel = find_channel(int(channel_id), channels)

    offset = service.get_offset(util.get_time_shift())
    time_delta = datetime.timedelta(hours=offset)

    files = channel['files']

    for media in list:
        start_time = get_time(media['start_time'])
        finish_time = get_time(media['finish_time'])

        current_title = in_time_range(default_time - time_delta, start_time,
                                      finish_time)

        if media['media_id']:
            if media['rating']:
                rating = media['rating']
            else:
                rating = 'unknown'

            key = Callback(archive.HandleChild,
                           id=media['media_id'],
                           name=media['name'],
                           thumb='thumb',
                           rating_key=rating,
                           description=media['description'],
                           duration=0,
                           year=0,
                           on_air=media['start_time'],
                           index=0,
                           files=json.dumps(files))

            title = get_schedule_title(media['name'],
                                       start_time,
                                       finish_time,
                                       current_title=current_title)

            oc.add(DirectoryObject(key=key, title=unicode(title)))
        else:
            select_key = Callback(GetSchedule, channel_id=channel_id)

            title = get_schedule_title(media['name'],
                                       start_time,
                                       finish_time,
                                       current_title=current_title,
                                       available=False)

            oc.add(DirectoryObject(key=select_key, title=unicode(title)))
Ejemplo n.º 3
0
def add_schedule(oc, channel_id, default_time, list):
    channels = service.get_live_channels()['data']

    channel = find_channel(int(channel_id), channels)

    offset = service.get_offset(util.get_time_shift())
    time_delta = datetime.timedelta(hours=offset)

    files = channel['files']

    for media in list:
        start_time = get_time(media['start_time'])
        finish_time = get_time(media['finish_time'])

        current_title = in_time_range(default_time - time_delta, start_time, finish_time)

        if media['media_id']:
            if media['rating']:
                rating = media['rating']
            else:
                rating = 'unknown'

            key = Callback(archive.HandleChild,
                id = media['media_id'],
                name = media['name'],
                thumb = 'thumb',
                rating_key = rating,
                description = media['description'],
                duration = 0,
                year = 0,
                on_air = media['start_time'],
                index = 0,
                files = json.dumps(files)
            )

            title = get_schedule_title(media['name'], start_time, finish_time, current_title=current_title)

            oc.add(DirectoryObject(key=key, title=unicode(title)))
        else:
            select_key = Callback(GetSchedule, channel_id=channel_id)

            title = get_schedule_title(media['name'], start_time, finish_time, current_title=current_title, available=False)

            oc.add(DirectoryObject(key=select_key, title=unicode(title)))
Ejemplo n.º 4
0
def MetadataObjectForURL(name, channel_id, thumb, files):
    video = MovieObject(rating_key='rating_key',
                        title=unicode(name),
                        thumb=thumb,
                        art=thumb)

    video.key = Callback(GetLiveChannel,
                         name=name,
                         channel_id=channel_id,
                         thumb=thumb,
                         files=files,
                         container=True)

    offset = service.get_offset(util.get_time_shift())

    format = 'mp4'
    quality_level = util.get_quality_level()

    # Log(Client.Platform in util.RAW_HLS_CLIENTS)
    # Log(Client.Product)  # Plex Web
    # Log(Client.Platform)  # Safari

    # if Client.Platform == 'Chrome':
    #     quality_level = util.get_quality_level()
    # else:
    #     quality_level = None

    files = json.loads(urllib.unquote_plus(files))

    bitrates = service.bitrates(files,
                                accepted_format=format,
                                quality_level=quality_level)

    video.items.extend(MediaObjectsForURL(bitrates, channel_id, offset,
                                          format))

    return video