Example #1
0
def GetVideoObject(name, channel_id, thumb, files, container):
    video = MovieObject(rating_key='rating_key',
                        title=unicode(name),
                        thumb=Resource.ContentsOfURLWithFallback(url=thumb))

    offset = video_service.get_offset(common.get_time_shift())

    format = 'mp4'

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

    bitrates = video_service.bitrates(new_files,
                                      accepted_format=format,
                                      quality_level=common.get_quality_level())

    video.key = Callback(GetLiveChannel,
                         name=name,
                         channel_id=channel_id,
                         thumb=thumb,
                         files=files,
                         container=True)
    video.items = MediaObjectsForURL(channel_id=channel_id,
                                     format=format,
                                     offset=offset,
                                     bitrates=json.dumps(bitrates[format]))

    return video
Example #2
0
def GetVideoObject(id, media_type, name, thumb, rating_key, description, duration, year, on_air, index, files, container):
    video = build_metadata_object(media_type=media_type, name=name, year=year, index=index)

    video.rating_key = rating_key
    video.thumb = thumb
    video.duration = int(duration)*60*1000
    video.summary = unicode(description)
    video.originally_available_at = originally_available_at(on_air)

    video.key = Callback(HandleChild, id=id, name=name, thumb=thumb,
                         rating_key=rating_key, description=description, duration=duration, year=year,
                         on_air=on_air, index=index, files=files, container=True)

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

    video.items = []

    for format, bitrates in video_service.bitrates(files, common.get_format(), common.get_quality_level()).iteritems():
        video.items.extend(MediaObjectsForURL(id=id, format=str(format), bitrates=json.dumps(bitrates)))

    return video
Example #3
0
def GetVideoObject(id, media_type, name, thumb, rating_key, description,
                   duration, year, on_air, index, files, container):
    video = build_metadata_object(media_type=media_type,
                                  name=name,
                                  year=year,
                                  index=index)

    video.rating_key = rating_key
    video.thumb = thumb
    video.duration = int(duration) * 60 * 1000
    video.summary = unicode(description)
    video.originally_available_at = originally_available_at(on_air)

    video.key = Callback(HandleChild,
                         id=id,
                         name=name,
                         thumb=thumb,
                         rating_key=rating_key,
                         description=description,
                         duration=duration,
                         year=year,
                         on_air=on_air,
                         index=index,
                         files=files,
                         container=True)

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

    video.items = []

    for format, bitrates in video_service.bitrates(
            files, common.get_format(),
            common.get_quality_level()).iteritems():
        video.items.extend(
            MediaObjectsForURL(id=id,
                               format=str(format),
                               bitrates=json.dumps(bitrates)))

    return video
Example #4
0
def GetVideoObject(name, channel_id, thumb, files, container):
    video = MovieObject(
        rating_key="rating_key", title=unicode(name), thumb=Resource.ContentsOfURLWithFallback(url=thumb)
    )

    offset = video_service.get_offset(common.get_time_shift())

    format = "mp4"

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

    bitrates = video_service.bitrates(new_files, accepted_format=format, quality_level=common.get_quality_level())

    video.key = Callback(GetLiveChannel, name=name, channel_id=channel_id, thumb=thumb, files=files, container=True)
    video.items = MediaObjectsForURL(
        channel_id=channel_id, format=format, offset=offset, bitrates=json.dumps(bitrates[format])
    )

    return video