refactor(playout): unwrap schedule.media dict
This commit is contained in:
parent
0d4e2823e2
commit
00648b8f94
3 changed files with 224 additions and 225 deletions
|
@ -412,231 +412,229 @@ def test_get_schedule(schedule, requests_mock, api_client: ApiClient):
|
|||
requests_mock.get(f"{base_url}/api/v2/webstreams/1", json=WEBSTREAM_1)
|
||||
|
||||
assert get_schedule(api_client) == {
|
||||
"media": {
|
||||
"2022-09-05-11-00-00": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 1,
|
||||
"start": "2022-09-05-11-00-00",
|
||||
"end": "2022-09-05-11-05-02",
|
||||
"uri": None,
|
||||
"id": 2,
|
||||
"show_name": "Show 1",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 13.7008,
|
||||
"cue_out": 315.845,
|
||||
"metadata": {
|
||||
"track_title": "My Friend the Forest",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "11.46",
|
||||
"filesize": 10000,
|
||||
"2022-09-05-11-00-00": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 1,
|
||||
"start": "2022-09-05-11-00-00",
|
||||
"end": "2022-09-05-11-05-02",
|
||||
"uri": None,
|
||||
"id": 2,
|
||||
"show_name": "Show 1",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 13.7008,
|
||||
"cue_out": 315.845,
|
||||
"metadata": {
|
||||
"track_title": "My Friend the Forest",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-11-05-02": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 2,
|
||||
"start": "2022-09-05-11-05-02",
|
||||
"end": "2022-09-05-11-10-00",
|
||||
"uri": None,
|
||||
"id": 4,
|
||||
"show_name": "Show 1",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 297.8558,
|
||||
"metadata": {
|
||||
"track_title": "#2",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "-1.65",
|
||||
"filesize": 10000,
|
||||
"replay_gain": "11.46",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-11-05-02": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 2,
|
||||
"start": "2022-09-05-11-05-02",
|
||||
"end": "2022-09-05-11-10-00",
|
||||
"uri": None,
|
||||
"id": 4,
|
||||
"show_name": "Show 1",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 297.8558,
|
||||
"metadata": {
|
||||
"track_title": "#2",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-11-10-00": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 3,
|
||||
"start": "2022-09-05-11-10-00",
|
||||
"end": "2022-09-05-12-08-59",
|
||||
"uri": None,
|
||||
"id": 5,
|
||||
"show_name": "Show 2",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 3539.13,
|
||||
"metadata": {
|
||||
"track_title": "Democracy Now! 2022-09-05 Monday",
|
||||
"artist_name": "Democracy Now! Audio",
|
||||
"mime": "audio/mp3",
|
||||
},
|
||||
"replay_gain": "-1.39",
|
||||
"filesize": 10000,
|
||||
"replay_gain": "-1.65",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-11-10-00": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 3,
|
||||
"start": "2022-09-05-11-10-00",
|
||||
"end": "2022-09-05-12-08-59",
|
||||
"uri": None,
|
||||
"id": 5,
|
||||
"show_name": "Show 2",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 3539.13,
|
||||
"metadata": {
|
||||
"track_title": "Democracy Now! 2022-09-05 Monday",
|
||||
"artist_name": "Democracy Now! Audio",
|
||||
"mime": "audio/mp3",
|
||||
},
|
||||
"2022-09-05-12-08-59": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 4,
|
||||
"start": "2022-09-05-12-08-59",
|
||||
"end": "2022-09-05-12-10-00",
|
||||
"uri": None,
|
||||
"id": 4,
|
||||
"show_name": "Show 2",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 61.0,
|
||||
"metadata": {
|
||||
"track_title": "#2",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "-1.65",
|
||||
"filesize": 10000,
|
||||
"replay_gain": "-1.39",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-12-08-59": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 4,
|
||||
"start": "2022-09-05-12-08-59",
|
||||
"end": "2022-09-05-12-10-00",
|
||||
"uri": None,
|
||||
"id": 4,
|
||||
"show_name": "Show 2",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 61.0,
|
||||
"metadata": {
|
||||
"track_title": "#2",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-12-10-00": {
|
||||
"type": EventKind.WEB_STREAM_BUFFER_START,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-09-55",
|
||||
"end": "2022-09-05-12-09-55",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
"replay_gain": "-1.65",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-12-10-00": {
|
||||
"type": EventKind.WEB_STREAM_BUFFER_START,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-09-55",
|
||||
"end": "2022-09-05-12-09-55",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
},
|
||||
"2022-09-05-12-10-00_0": {
|
||||
"type": EventKind.WEB_STREAM_OUTPUT_START,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-10-00",
|
||||
"end": "2022-09-05-12-40-00",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
"show_name": "Show 3",
|
||||
},
|
||||
"2022-09-05-12-40-00": {
|
||||
"type": EventKind.WEB_STREAM_BUFFER_END,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-40-00",
|
||||
"end": "2022-09-05-12-40-00",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
},
|
||||
"2022-09-05-12-40-00_0": {
|
||||
"type": EventKind.WEB_STREAM_OUTPUT_END,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-40-00",
|
||||
"end": "2022-09-05-12-40-00",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
},
|
||||
"2022-09-05-12-40-00_1": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 6,
|
||||
"start": "2022-09-05-12-40-00",
|
||||
"end": "2022-09-05-12-53-23",
|
||||
"uri": None,
|
||||
"id": 3,
|
||||
"show_name": "Show 3",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 55.1211,
|
||||
"cue_out": 858.4,
|
||||
"metadata": {
|
||||
"track_title": "All Melody",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-12-10-00_0": {
|
||||
"type": EventKind.WEB_STREAM_OUTPUT_START,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-10-00",
|
||||
"end": "2022-09-05-12-40-00",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
"show_name": "Show 3",
|
||||
"replay_gain": "-2.13",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-12-53-23": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 7,
|
||||
"start": "2022-09-05-12-53-23",
|
||||
"end": "2022-09-05-12-58-25",
|
||||
"uri": None,
|
||||
"id": 2,
|
||||
"show_name": "Show 3",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 13.7008,
|
||||
"cue_out": 315.845,
|
||||
"metadata": {
|
||||
"track_title": "My Friend the Forest",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-12-40-00": {
|
||||
"type": EventKind.WEB_STREAM_BUFFER_END,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-40-00",
|
||||
"end": "2022-09-05-12-40-00",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
"replay_gain": "11.46",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-12-58-25": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 8,
|
||||
"start": "2022-09-05-12-58-25",
|
||||
"end": "2022-09-05-13-00-00",
|
||||
"uri": None,
|
||||
"id": 1,
|
||||
"show_name": "Show 3",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 8.25245,
|
||||
"cue_out": 95.0,
|
||||
"metadata": {
|
||||
"track_title": "The Dane",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-12-40-00_0": {
|
||||
"type": EventKind.WEB_STREAM_OUTPUT_END,
|
||||
"row_id": 5,
|
||||
"start": "2022-09-05-12-40-00",
|
||||
"end": "2022-09-05-12-40-00",
|
||||
"uri": "http://stream.radio.org/main.ogg",
|
||||
"id": 1,
|
||||
"replay_gain": "4.52",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-12-59-58": {
|
||||
"type": EventKind.ACTION,
|
||||
"event_type": "switch_off",
|
||||
"start": "2022-09-05-12-59-58",
|
||||
"end": "2022-09-05-12-59-58",
|
||||
},
|
||||
"2022-09-05-13-00-00": {
|
||||
"type": EventKind.ACTION,
|
||||
"event_type": "kick_out",
|
||||
"start": "2022-09-05-13-00-00",
|
||||
"end": "2022-09-05-13-00-00",
|
||||
},
|
||||
"2022-09-05-13-00-00_0": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 9,
|
||||
"start": "2022-09-05-13-00-00",
|
||||
"end": "2022-09-05-13-05-02",
|
||||
"uri": None,
|
||||
"id": 2,
|
||||
"show_name": "Show 4",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 13.7008,
|
||||
"cue_out": 315.845,
|
||||
"metadata": {
|
||||
"track_title": "My Friend the Forest",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-12-40-00_1": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 6,
|
||||
"start": "2022-09-05-12-40-00",
|
||||
"end": "2022-09-05-12-53-23",
|
||||
"uri": None,
|
||||
"id": 3,
|
||||
"show_name": "Show 3",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 55.1211,
|
||||
"cue_out": 858.4,
|
||||
"metadata": {
|
||||
"track_title": "All Melody",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "-2.13",
|
||||
"filesize": 10000,
|
||||
"replay_gain": "11.46",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-13-05-02": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 10,
|
||||
"start": "2022-09-05-13-05-02",
|
||||
"end": "2022-09-05-13-10-00",
|
||||
"uri": None,
|
||||
"id": 4,
|
||||
"show_name": "Show 4",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 297.8558,
|
||||
"metadata": {
|
||||
"track_title": "#2",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"2022-09-05-12-53-23": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 7,
|
||||
"start": "2022-09-05-12-53-23",
|
||||
"end": "2022-09-05-12-58-25",
|
||||
"uri": None,
|
||||
"id": 2,
|
||||
"show_name": "Show 3",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 13.7008,
|
||||
"cue_out": 315.845,
|
||||
"metadata": {
|
||||
"track_title": "My Friend the Forest",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "11.46",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-12-58-25": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 8,
|
||||
"start": "2022-09-05-12-58-25",
|
||||
"end": "2022-09-05-13-00-00",
|
||||
"uri": None,
|
||||
"id": 1,
|
||||
"show_name": "Show 3",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 8.25245,
|
||||
"cue_out": 95.0,
|
||||
"metadata": {
|
||||
"track_title": "The Dane",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "4.52",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-12-59-58": {
|
||||
"type": EventKind.ACTION,
|
||||
"event_type": "switch_off",
|
||||
"start": "2022-09-05-12-59-58",
|
||||
"end": "2022-09-05-12-59-58",
|
||||
},
|
||||
"2022-09-05-13-00-00": {
|
||||
"type": EventKind.ACTION,
|
||||
"event_type": "kick_out",
|
||||
"start": "2022-09-05-13-00-00",
|
||||
"end": "2022-09-05-13-00-00",
|
||||
},
|
||||
"2022-09-05-13-00-00_0": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 9,
|
||||
"start": "2022-09-05-13-00-00",
|
||||
"end": "2022-09-05-13-05-02",
|
||||
"uri": None,
|
||||
"id": 2,
|
||||
"show_name": "Show 4",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 13.7008,
|
||||
"cue_out": 315.845,
|
||||
"metadata": {
|
||||
"track_title": "My Friend the Forest",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "11.46",
|
||||
"filesize": 10000,
|
||||
},
|
||||
"2022-09-05-13-05-02": {
|
||||
"type": EventKind.FILE,
|
||||
"row_id": 10,
|
||||
"start": "2022-09-05-13-05-02",
|
||||
"end": "2022-09-05-13-10-00",
|
||||
"uri": None,
|
||||
"id": 4,
|
||||
"show_name": "Show 4",
|
||||
"fade_in": 500.0,
|
||||
"fade_out": 500.0,
|
||||
"cue_in": 0.0,
|
||||
"cue_out": 297.8558,
|
||||
"metadata": {
|
||||
"track_title": "#2",
|
||||
"artist_name": "Nils Frahm",
|
||||
"mime": "audio/flac",
|
||||
},
|
||||
"replay_gain": "-1.65",
|
||||
"filesize": 10000,
|
||||
},
|
||||
}
|
||||
"replay_gain": "-1.65",
|
||||
"filesize": 10000,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue