dbvideostriketeam / wubloader

MIT License
14 stars 6 forks source link

Allow setting a pinned first or last video in a playlist #397

Closed ekimekim closed 1 month ago

ekimekim commented 1 month ago

Co-authored by @ZeldaZach Fixes https://github.com/dbvideostriketeam/wubloader/issues/386

This adds two configurable properties to a playlist, specifying a "first" and "last" event id. Both are optional.

When present, they cause the video associated with that event to always be placed first or last in playlist order, overriding the normal "by start time" ordering and working retroactively (ie. they'll be moved to the front/back if not there already). The primary use case for this is supercuts, which we generally want to put at the end of a playlist even if the associated event row coincides with the first instance of the thing being supercut. It may also prove useful eg. if we get a clean version of a repeating intro, which would best go at the front of a playlist.

While conceptually simple, this change required some signifigant refactoring of playlist_manager to plumb more data to where it was needed, for example needing to cache the playlist entry ids instead of just video ids. Along the way we do some refactoring for clarity, most notably splitting the use of ambiguous variables named playlist into either:

This change does not incorporate any way to set these first/last event ids, which would likely be in sheetsync - however I don't really want to make further changes there until https://github.com/dbvideostriketeam/wubloader/issues/345 is complete.

ZeldaZach commented 1 month ago

Preliminary review, it seems fine. If it's functional, good to merge

ekimekim commented 1 month ago

Still need to test. Unfortunately since it involves the youtube API it's a bit annoying to do.

chrusher commented 1 month ago

Looks good to me.

ekimekim commented 1 month ago

Will test properly as part of our all-up testing.