Skip to content

feat(settings): sync every out-of-date playlist from one button - #311

Open
0xashwin wants to merge 1 commit into
bilipp:mainfrom
0xashwin:feat/sync-stale-playlists
Open

0xashwin wants to merge 1 commit into
bilipp:mainfrom
0xashwin:feat/sync-stale-playlists

Conversation

@0xashwin

Copy link
Copy Markdown
Contributor

Follow-up to 402d923. Since launch only syncs the playlist you're looking at, the others go stale until you switch to them, and with a few playlists the only way to catch them all up was opening each detail page and hitting Sync Now in turn.

This adds a Sync Out-of-Date Playlists button to the Playlists page (iOS/macOS list and the tvOS pane), shown when there's more than one playlist. It syncs whatever is never-synced, past the refresh interval, or failed last time, and skips ones that are already syncing or have sync turned off. When everything is fresh it becomes Sync All Playlists instead of a dead button.

The syncs run in the background without the cover, one at a time, since a lot of Xtream panels cap you at one connection and playlists tend to share an account. The guide refresh sees the whole run as one content sync so it doesn't start between two playlists and get cancelled straight away. While it runs the button reads "Syncing 2 of 3" and tapping it stops the run; the playlist in flight goes back to idle.

New strings are translated for all ten languages. Tested with the new PlaylistBatchSelectionTests plus the existing PlaylistSyncStateTests on an iPhone 17 Pro sim, and a tvOS build to type-check the tvOS pane.

Since 402d923 only the playlist on screen syncs at launch, which fixed the
row of blocking covers but left the others to go stale until you switch to
them. With three or four playlists, getting them all current meant opening
each one's detail page and tapping Sync Now, one after another.

The Playlists page now has a Sync Out-of-Date Playlists button once there's
more than one playlist. It picks up anything never synced, past the refresh
interval (active or not) or whose last sync failed, and leaves alone the
ones that are syncing or have sync turned off. If everything is already
fresh it turns into Sync All Playlists rather than sitting there disabled.

They run in the background, no cover, one at a time — Xtream panels
usually allow one connection per account and playlists often share one.
The whole run counts as a single content sync to the guide refresh, so it
doesn't slip in between two playlists only to get cancelled by the next.
Each playlist is checked again when its turn comes, in case switching to it
already brought it up to date. Stop cancels the one in flight, which goes
back to idle rather than failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant