示例#1
0
def successful_clip(state_dict, title='Test clip: S01E01-2018-07-01T00:00'):
    return Clip(
        webpage='https://areena.yle.fi/1-1234567',
        flavors=[
            # The flavors are intentionally unsorted
            StreamFlavor(
                media_type='video',
                height=1080,
                width=1920,
                bitrate=2808,
                streams=[StateCollectingBackend(state_dict, 'high_quality')]),
            StreamFlavor(
                media_type='video',
                height=360,
                width=640,
                bitrate=880,
                streams=[StateCollectingBackend(state_dict, 'low_quality')]),
            StreamFlavor(media_type='video',
                         height=360,
                         width=640,
                         bitrate=864,
                         streams=[
                             StateCollectingBackend(
                                 state_dict, 'low_quality_finnish_subs')
                         ],
                         hard_subtitle=Subtitle(url=None, lang='fi')),
            StreamFlavor(
                media_type='video',
                height=720,
                width=1280,
                bitrate=1412,
                streams=[StateCollectingBackend(state_dict,
                                                'medium_quality')]),
            StreamFlavor(media_type='video',
                         height=720,
                         width=1280,
                         bitrate=1872,
                         streams=[
                             StateCollectingBackend(
                                 state_dict, 'medium_quality_high_bitrate')
                         ])
        ],
        title=title,
        duration_seconds=950,
        region='Finland',
        publish_timestamp=datetime(2018, 7, 1, tzinfo=FixedOffset(3)),
        expiration_timestamp=datetime(2019, 1, 1, tzinfo=FixedOffset(3)),
        embedded_subtitles=[
            EmbeddedSubtitle('fin', 'käännöstekstitys'),
            EmbeddedSubtitle('swe', 'käännöstekstitys')
        ])
示例#2
0
def incomplete_flavors_clip(state_dict):
    return Clip(
        webpage='https://areena.yle.fi/1-1234567',
        flavors=[
            StreamFlavor(media_type='video',
                         streams=[StateCollectingBackend(state_dict, '1')]),
            StreamFlavor(media_type='video',
                         height=360,
                         width=640,
                         streams=[StateCollectingBackend(state_dict, '2')]),
            StreamFlavor(media_type='video',
                         streams=[StateCollectingBackend(state_dict, '3')])
        ],
        title='Test clip: S01E01-2018-07-01T00:00',
        duration_seconds=None,
        region='Finland',
        publish_timestamp=None,
        expiration_timestamp=None)
示例#3
0
def failed_stream_clip(state_dict):
    return Clip(webpage='https://areena.yle.fi/1-1234567',
                flavors=[
                    StreamFlavor(media_type='video',
                                 height=360,
                                 width=640,
                                 bitrate=964,
                                 streams=[
                                     FailingBackend(state_dict, '1', 'wget'),
                                     FailingBackend(state_dict, '2', 'ffmpeg')
                                 ])
                ],
                title='Test clip: S01E01-2018-07-01T00:00',
                duration_seconds=950,
                region='Finland',
                publish_timestamp=None,
                expiration_timestamp=None)
示例#4
0
def multistream_clip(state_dict, title='Test clip: S01E01-2018-07-01T00:00'):
    return Clip(webpage='https://areena.yle.fi/1-1234567',
                flavors=[
                    StreamFlavor(
                        media_type='video',
                        height=360,
                        width=640,
                        bitrate=864,
                        streams=[
                            FailingBackend(state_dict, '1', 'wget'),
                            FailingBackend(state_dict, '2', 'Invalid stream'),
                            StateCollectingBackend(state_dict, '3', 'wget'),
                            StateCollectingBackend(state_dict, '4',
                                                   'youtubedl')
                        ])
                ],
                title='Test clip: S01E01-2018-07-01T00:00',
                duration_seconds=950,
                region='Finland',
                publish_timestamp=None,
                expiration_timestamp=None)