Commit Graph

37 Commits (master)

Author SHA1 Message Date
Mike Lang 3f6263a037 playlist-manager: More fixes 3 weeks ago
Mike Lang d8953568b2 playlist_manager: Add --once option 3 weeks ago
Mike Lang 9d12d37053 playlist_manager: Fixes 3 weeks ago
Mike Lang a3aaa37bb0 Restructure playlists table
to have all tags, not just playlists.
Notably, this means playlist ids may be null.
1 month ago
Mike Lang 8dd6741ee9 schema: Playlist tags may be null, indicating "match nothing"
This is intended for partially-entered playlist data where tags have not been specified yet.
1 month 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.
1 month 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.
1 month ago
Mike Lang 0a55a74efd playlist_manager: Reorder first/last videos when needed 1 month ago
Mike Lang ce8e7bb3b4 playlist_manager: Make a specialized error for api requests
So we can easily check the status code.
1 month 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.
1 month 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".
1 month 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.
1 month 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()
1 month ago
Mike Lang 8799014735 playlist_manager: Convert format() to f-strings
Just some general cleanup.
1 month 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.
1 month 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
1 month ago
Mike Lang 005783ab87 playlist_manager: Fix typo in comment 1 month ago
Mike Lang 3606fadaa8 Pin gevent version to work around build issues
Seeing the following error on latest versions of gevent:

 Traceback (most recent call last):
   File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
     return _run_code(code, main_globals, None,
   File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
     exec(code, run_globals)
   File "/usr/lib/python3.9/site-packages/zulip_bots/schedulebot.py", line 2, in <module>
     import gevent.monkey
   File "/usr/lib/python3.9/site-packages/gevent/__init__.py", line 72, in <module>
     from gevent._hub_local import get_hub
   File "/usr/lib/python3.9/site-packages/gevent/_hub_local.py", line 150, in <module>
     import_c_accel(globals(), 'gevent.__hub_local')
   File "/usr/lib/python3.9/site-packages/gevent/_util.py", line 148, in import_c_accel
     mod = importlib.import_module(cname)
   File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
     return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'gevent._gevent_c_hub_local'
10 months ago
Mike Lang 78c053000e Upgrade pip in order to make wheels work 10 months ago
Mike Lang 044dfb8084 Pin argh to avoid stupid breaking changes 11 months ago
Mike Lang 30d5ccc483 Fix all old references to github.com/ekimekim/wubloader 1 year ago
Mike Lang b9c44375c3 playlist_manager: Don't add non-public videos to playlists
So that playlists don't pick up unlisted videos.
When the video is modified to be public, it will be added as normal.

However, note that since playlist_manager never removes videos from playlists,
making an existing video public video unlisted will not remove it from playlists.
2 years ago
Mike Lang 63d8b1d504 playlist manager: serialize insert requests
We've seen cases where videos are not inserted even though the API call succeeded.
Our suspicion is that two concurrent insert calls for the same video are causing a race.

We try to avoid this by putting a lock around insert calls
3 years ago
Mike Lang 467edf3d19 Read dynamic playlist manager config from sheet
The sheetsync loads playlist ids and tags into a new table `playlists`.
playlist manager reads this table and merges it with the playlists given on the command line.
3 years ago
Mike Lang a47c29fff4 Link images to github repo by adding a LABEL
When pushed, this tells github to associate the ghcr.io repo that was pushed to
with the github repo specified (the owner needs to match).

This does a few things.
Most importantly, this automatically gives github actions credentials to push to these
repositories when run in the context of the wubloader repo.
3 years ago
Mike Lang aab8cf2f0f Set up plumbing for multi-range videos and implement no-transition fast cut videos only
This is the simplest case as we can just cut each range like we already do,
then concat the results.

We still allow for the full design in the database and cutter, but error out if transitions
is ever anything but hard cuts or if it's a full cut.

We also update the restreamer to allow accepting ranges, however for usability we still allow
the old "just one start and end" args.

Note this changes the thrimshim API to give and take the new "video_ranges" and "video_transitions" columns.
3 years ago
Mike Lang 62bd6539ea Unpin gevent as that was a workaround for a py2 issue 3 years ago
Mike Lang f2a8007bf7 Fix build dependency issues 3 years ago
Mike Lang ac917409e4 Fix formatting issue in playlist manager 3 years ago
HubbeKing 6d790a1b36 Do a first naive pass for py3 compatibility
Check that open() calls for reading and writing use binary modes
Use alpine version with py3-pip package
Use python3 in Dockerfile CMD
Remove sys.setdefaultencoding() "hack"
Simplify ensure_directory() in common.common package
3 years ago
Mike Lang f0546e2ee3 Pin gevent to 1.5a2 to avoid https://github.com/gevent/gevent/issues/1711 3 years ago
Mike Lang 389d3e08d7 Fix typo in making playlist manager case insensitive 4 years ago
Mike Lang ab33dfe00d Fix some typos in playlist manager 4 years ago
Mike Lang 5357a40ea7 playlist_manager: Compare tags case-insensitively
To avoid confusion between eg. "Interview" and "interview"
4 years ago
Mike Lang b53fcd65a0 Add dependencies required to install psycopg2 from source
We can't install the binaries as they don't support musl
4 years ago
Mike Lang 9413b99b91 Implement playlist manager 4 years ago
Mike Lang 9562032c24 Create new playlist manager service
Playlist manager adds youtube videos to youtube playlists based on database tags.
4 years ago