Commit Graph

1215 Commits (0f06f96a7c4dffbdd854f17993188469b8cc4c86)
 

Author SHA1 Message Date
Mike Lang 0f06f96a7c Fix: Move events-specific observe_rows() out of SheetSync 3 months 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.
3 months ago
Mike Lang 73eaac16f3 Update sheetsync CLI interface to allow any combination of types and backends 3 months ago
Mike Lang bb4cc8c668 sheetsync: Replace old special-case PlaylistSync with SheetSync subclass 3 months ago
Mike Lang ef11b69f4d Fix sheetsync to use Sheets client from common 3 months ago
Mike Lang 98b1749528 implement SheetsPlaylistMiddleware and fix lots of SheetsMiddleware issues 3 months ago
Mike Lang c84b2254ee sheetsync: Streamlog middleware for playlists 3 months ago
Mike Lang e9b6e27598 sheetsync: Make the middleware interface explicit with a base class
The main purpose here is just documentation, so it's clear what the semantics of a middleware is.
3 months ago
Mike Lang 3ffbefea4f sheetsync: Split SheetsMiddleware into a common base class and events specific 3 months ago
Mike Lang bebce3df4c sheetsync: Only consider a row missing if we did a full sync
This prevents things being spuriously missing because they were in a worksheet we didn't sync.
3 months ago
Mike Lang 3cdd8f22ad Split SheetSync object to be fully generic and have an EventsSync object for events 3 months ago
Mike Lang 6a9884ee5b sheetsync: Move extra metrics columns into a variable 3 months ago
Mike Lang 37dd7c3e4f sheetsync: Move various config fields to be defined on the class object
Also make the columns lists into sets
3 months ago
Mike Lang 5559dffec6 sheetsync: pull metric gathering into a seperate function 3 months ago
Mike Lang 37f42853ec sheetsync: Extract db table name into a variable
So we can swap it out for playlists later
3 months ago
Mike Lang 00d0ecc3bb sheetsync: Handle sheet_name as an input column to avoid special casing
sheet_name must always be present on a sheet row, but is only present on a db row
if the db actually stores that data.

As a side benefit, the db will now update if sheet_name changes.
3 months ago
Mike Lang 2db20d202b sheetsync: Update streamlog middleware for section -> tab rename 3 months ago
Mike Lang 9fb356bf45 sheetsync: Better error handling for running out of space when creating rows 3 months ago
Mike Lang 29ff11457e sheetsync: Namespace all logs and metrics behind a sheetsync "name"
This helps differentiate the multiple syncs we now have and will have:
- syncing events from streamlog
- reverse syncing events to sheets
- syncing playlists
3 months ago
Mike Lang 87b504a00a sheetsync: Rename "row" and "event" to "sheet_row" and "db_row"
First step to combining event and playlist sync into one codepath.

No actual behaviour changes intended.
3 months ago
Mike Lang 20ee79cdb1 Get sheets working again 3 months ago
Mike Lang f89ab6fa43 Don't make sheet name an input column, go back to special casing it on row create
This means it won't update if put in the wrong place,
but avoids issues with reverse sync trying to write it out when it's not an actual column
3 months ago
Mike Lang 430938dc49 error is always a string, it just might be empty 3 months ago
Mike Lang f8d3eb7f00 wip: 3 months ago
Mike Lang ee4a68af50 clear up confusion with empty string vs None 3 months ago
Mike Lang 3e873ca5f6 wip: fixes 3 months ago
Mike Lang eebfa5885b sheetsync: pass in event id instead of event name 3 months ago
Mike Lang cf41f572f5 Fix streamlog formatting 3 months ago
Mike Lang db3a779292 docker-compose: Allow setting up sheetsync for sheets or streamlog 3 months ago
Mike Lang 986a1db964 sheetsync: Change how options are specified to allow multiple backends / syncs 3 months ago
Mike Lang 74869de89d Implement reverse sync mode
This is a mode where all data flows one-way from the database to the sheet.
It is intended to be used to populate an empty sheet from database events,
possibly sourced from somewhere else.

To make this work, a few changes were required:
* Track which ids we've seen so we know what events were not matched with a row
* Allow `row` to be None in sync_rows
* When it is, call the middleware to create a new row with a new id
* In sheets, this is implemented by tracking the last empty rows we saw, and claiming them as needed.
3 months ago
Mike Lang 85de9757f7 sheetsync: Remove pick_worksheets() from middleware api
Instead, get_rows() makes that decision internally if needed.
3 months ago
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