You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Episode IDs deliberately use the immutable local series ID and numeric season/episode tuple. Plugin metadata refreshes therefore cannot change watched state or progress IDs.
660
+
Episode IDs use the series IMDb ID and numeric season/episode tuple so watched state follows the same show across libraries. Series without an IMDb ID temporarily use the RedSeat fallback; if IMDb metadata is added later, the server migrates watched state and progress immediately.
660
661
661
662
### REST API Endpoints
662
663
@@ -752,79 +753,24 @@ function isMatchingUnwatchedEvent(movie: LocalMovie, eventIds: string[]): boolea
752
753
753
754
## Offline Sync for Watch History
754
755
755
-
When clients are offline or disconnected from SSE, they can miss `unwatched` events. The REST API provides a mechanism to sync these missed deletions.
756
-
757
-
### How It Works
758
-
759
-
-**`date > 0`**: Item is actively watched (timestamp indicates when it was watched)
760
-
-**`date = 0`**: Item was unwatched/deleted (soft-deleted, kept for sync purposes)
761
-
762
-
When content is marked as unwatched, instead of being deleted from the database, the `date` field is set to `0` and the `modified` timestamp is updated. This allows clients to fetch all changes (including deletions) via the history API.
756
+
Unwatching content permanently deletes its history row. The server does not retain deletion tombstones.
763
757
764
758
### Client Sync Flow
765
759
766
760
```typescript
767
-
// 1. Store last sync timestamp locally
768
-
let lastSyncTimestamp =localStorage.getItem('lastHistorySync') ||'0';
769
-
770
-
// 2. Fetch all history changes since last sync, including deleted items
761
+
// Replace local watched state with a complete server snapshot.
// 3. Call on app startup and periodically while online
796
-
syncHistory();
797
767
```
798
768
769
+
Connected clients can apply live `watched` and `unwatched` SSE events. After being offline, clients must perform this full reload because incremental history queries cannot report deletions.
770
+
799
771
### API Query Parameters
800
772
801
773
| Parameter | Type | Description |
802
774
|-----------|------|-------------|
803
-
|`after`| number | Only return items modified after this timestamp (milliseconds) |
804
-
|`includeDeleted`| boolean | Include items with `date=0` (unwatched). Default: `false`|
775
+
|`after`| number | Only return watched items modified after this timestamp (milliseconds). This does not report deletions. |
805
776
|`types`| string[]| Filter by content types (e.g., `movie`, `episode`) |
806
-
807
-
### Example Response with Deleted Items
808
-
809
-
```json
810
-
[
811
-
{
812
-
"type": "movie",
813
-
"id": "movie:imdb/tt1234567",
814
-
"userRef": "user123",
815
-
"date": 1705766400000,
816
-
"modified": 1705852800000
817
-
},
818
-
{
819
-
"type": "movie",
820
-
"id": "movie:imdb/tt9876543",
821
-
"userRef": "user123",
822
-
"date": 0,
823
-
"modified": 1705939200000
824
-
}
825
-
]
826
-
```
827
-
828
-
In this response:
829
-
- First item: Movie was watched at timestamp `1705766400000`
830
-
- Second item: Movie was unwatched (`date=0`), client should remove it from local state
0 commit comments