Commit Graph

1520 Commits (3d22afbf0d9d79665c649f9f02dda23e1bb54511)
 

Author SHA1 Message Date
Mike Lang 17463d70fe sheetsync: Remove worksheet from middleware apis
since it's now baked into the row dict
3 months ago
Mike Lang eec58f2651 sheetsync: Always have sheet name as part of row dict 3 months ago
Mike Lang fa9a4b70bb bugfix 3 months ago
Mike Lang ca3f92c0b6 sheetsync: Use streamlog section instead of deriving day from start time 3 months ago
Mike Lang 071cd29f4d sheetsync: Implement Streamlog middleware 3 months ago
Mike Lang d064522d60 sheetsync: Move edit url management into Sheets middleware
As streamlog doesn't require it.
3 months ago
Mike Lang be111ccb2a Change database primary key from UUID to TEXT
We still store uuids, but in text form.
This allows us to store non-UUID ids for systems that have other ids.
3 months ago
Mike Lang 72f7c59a77 Sheetsync: Split into the main loop logic + sheets-specific middleware
NOTE ON CONFLICTS

In master, we moved sheets.py to common as it only contained a generic client.
Now sheets.py also contains specific sheetsync stuff.

Our resolution:
- Keep the generic version in common
- Keep the old version verbatim (including the now-redundant generic client) in sheetsync

We will move the sheetsync implementation to the generic client after the rebase is complete.
3 months ago
Mike Lang 0e5bf1a0fe sheetsync: Split playlist runloop from normal sheets 3 months ago
Mike Lang a16259e892 sheetsync: Move id allocation out of sync_row() 3 months ago
Mike Lang 256e0f7ba1 sheetsync: Move row_index variable into row dict 3 months ago
Mike Lang c5c9075f9e Basic streamlog api 3 months ago
Mike Lang c2d2f4b85c Revert "sheetsync: Support archive sheet"
This reverts commit b93597c274.
3 months ago
Mike Lang 4c87ad6735 Revert "sheetsync: unmapped columns aren't a problem."
This reverts commit 5256577d00.
3 months ago
Mike Lang 9dec3cb729 Allow the youtube-manual upload backend to modify videos
So we can modify youtube videos we manually uploaded.
If the video isn't actually ours, it will error when the modify is attempted which is ok.
3 months ago
Mike Lang 49dd25c0fa playlist_manager: Improved handling of playlist outdated errors
By restarting the update immediately instead of waiting for the next one.
We only try this up to 3 times to prevent excessive quota usage if it keeps happening.
3 months ago
Mike Lang 90a6b5ee17 playlist_manager: Check for re-orderings without doing them initially
Previously, we would only do reorderings if we were refreshing the playlist
for some other reason (eg. a video was inserted).

We want to refresh the playlist before attempting reorderings,
so we split the routine into two parts:
- A part that finds out-of-order videos and returns a list of moves to make.
- A part that executes those moves.

We do the former before AND after refreshing, and the latter only with the result from after.
3 months ago
Mike Lang 0a55a74efd playlist_manager: Reorder first/last videos when needed 3 months ago
Mike Lang ce8e7bb3b4 playlist_manager: Make a specialized error for api requests
So we can easily check the status code.
3 months ago
Mike Lang a802cbb1d2 playlist_manager: Sort first/last videos correctly
In addition to sorting the videos themselves into the correct spots,
we need to special case them when scanning for the correct place to insert other videos.

Note this only places them in the correct place on insert,
which requires they be set in the playlist config BEFORE being inserted.

A follow-up commit will handle the case of needing to re-order them post insert.
3 months ago
Mike Lang fae5267941 playlist_manager: Fetch first/last event info when fetching playlists
And switch to passing around a namedtuple of these + tags instead of just tags.

To avoid confusion with the list of videos in the playlist, we refer to this data as the "playlist config".
3 months ago
Mike Lang 115fd8bba3 schema: Add first and last event ids to playlist table
These represent a pinned first/last video in a playlist.
On the choice of a video id vs an event id:
- Event ids are known before video ids, so we can "set and forget" before a video is uploaded
- No need to re-set if an event's video is re-edited or changed
- In cases where an external video is desired, we can use manual link to associate an event with it

Since we're referencing a primary key, we might as well also make it a proper foreign key
with sensible delete behaviour, though in practice we never delete events.
3 months ago
Mike Lang e9281e652c playlist_manager: Cache playlist entry IDs along with video IDs
This is required in order to be able to move entries later.
Note our view of entry IDs may always be out of date, so any time you use one
you have to handle it no longer existing.
3 months ago
Mike Lang 8c1a8e717e playlist_manager: Wrap lookups of playlist_state into a function
This prevents accidents where we do a simple lookup instead of a .get()
3 months ago
Mike Lang 8799014735 playlist_manager: Convert format() to f-strings
Just some general cleanup.
3 months ago
Mike Lang c6c279356c playlist_manager: Explicitly say when a variable is a "playlist_id" vs a "playlist" (a list of videos)
This makes the code much easier to read by making it clear what each variable actually refers to.
3 months ago
Mike Lang d9f521107f playlist_manager: Clarify set operations
Use slightly more verbose opertations with intermediate variables that make it clear what we're doing
3 months ago
Mike Lang 005783ab87 playlist_manager: Fix typo in comment 3 months ago
Mike Lang 6b0a025812 Add transition support to fast cuts 4 months ago
Mike Lang c8724a1e63 rewrite fast cuts to support transitions being allowed later
In theory there should be no change in actual output for no-transition cuts,
even though we're handling the logic in a very different way.

This doesn't actually allow transitions, but sets up most of what is needed
4 months ago
Mike Lang 066d10f94a Full cut: Support video transitions
We support all preset transitions in the xfade filter,
as well as a handful of "custom" ones we define.

We only support an audio cross-fade. We may want to support J and L audio cuts (switch audio
before/after the transition) later.
4 months ago
Mike Lang 5fbdaf8422 full cuts: Support multiple ranges
This allows full cuts to support multiple ranges in the same way fast cuts do,
by using multiple inputs to ffmpeg and concat filters joining them.

This will be easy to add transitions to later as this is "just" replacing a concat filter
with an xfade + afade filter.
4 months ago
Mike Lang cc789caa7e Move ffmpeg_cut_segment to new ffmpeg_cut_many() system 4 months ago
Mike Lang ba36338db4 Add simpler wrapper for ffmpeg_cut_segments() for single-input case
Also change ffmpeg_cut_many() arg order so common cases can have a default value.
4 months ago
Mike Lang e65145bcad Replace ffmpeg_cut_stdin() with ffmpeg_cut_many()
This is a more featureful wrapper around ffmpeg with notable differences:
- It's used as a context manager, and so can manage its own cleanup
- It takes care of input feeding
- It can handle multiple inputs (via pipes), instead of one (via stdin)

This drastically reduces the setup and cleanup code required for most basic usage,
and the multi-input support will be used in followup changes.
4 months ago
Mike Lang d571bbe81e ffmpeg_cut_stdin: Remove cut_start and duration built-in args
Of 4 users of this function, all but one set them to None.
We're about to replace that one usage with something else, so it makes more sense
to not have them as options at all and just have the user add to the encode args manually.
4 months ago
ZeldaZach e7a839c6cd Remove need to download twice on startup 4 months ago
ZeldaZach 07fc84e85e Relabel Comment to show new config values 4 months ago
ZeldaZach 8bbc72184c Support hot reload of Zulip Schedule
- Move sheets API into common dir, since multi use
- Live download from Google Sheets using Config
- Falls back on old schedule if new one can't be downloaded for some reason
4 months ago
Mike Lang a34af372d0
thrimbletrimmer: Validate chapter titles are ascii only
We are not sure what characters are allowed in chapter titles.
Emoji seem to be disallowed. It is unknown whether things like accents or smart quotes are allowed.
To be conservative, we warn if there are any non-ascii characters in the chapter title.
7 months ago
Mike Lang cb144866a6 Change wording of "submit anyway" button when saving a draft 7 months ago
Mike Lang f9ff537b84 restreamer: Fix a bug where playlist reports video is finished spuriously
This happens when we are live viewing a stream, and the last available segment
is at the end of an hour.
We generate the end timestamp as being the end of the last available hour,
which might be within the range of the last available segment. When this happens
we stream the last segment then say we reached the requested end point.
This makes the player stop asking for more segments.

The fix is to pad the end time by an extra hour so we're asking for 1 hour more than the
last available hour.
7 months ago
Mike Lang daf6001402 restreamer: Move get_best_segments() inside playlist cache 7 months ago
Mike Lang 264545eb9d CachedIterator: Fix bug where state can change while taking the lock
Resulting in a case where we grab the wrong result, or even try to get the next item
after the iterator has already been discarded.
7 months ago
Mike Lang 0895ce44ff generate media playlist: Yield in chunks for performance
Flask sends a chunked response with one chunk per item yielded.
This adds a lot of overhead per yielded item.
We avoid this by collecting the lines of the media playlist into larger chunks
and only flushing once every 1000 segments.

For small playlists this means they'll be emitted as one chunk,
but for large playlists we still get the streaming behaviour.
7 months ago
Mike Lang 1857a998c9 reduce overhead of gevent.idle() by only yielding once per 1000 segments 7 months ago
Mike Lang 7e90346b87 restreamer: Have playlist cache stream results 7 months ago
Mike Lang 8ede4622ca CachedIterator: Re-serve any errors encountered while iterating
instead of the second one to reach the error treating it as a successful end of iterator.
7 months ago
Mike Lang 909cece196 restreamer: Move media playlist cache to also cover HLS playlist generation 7 months ago
Mike Lang cb2c58c75c restreamer: Yield the event loop during playlist generation 7 months ago