forked from Foxyz/sync_replay_project
Jellyfin: a watched episode leaves Continue (resume point cleared); watched at 70 %, or reaching the ending or last 15 % after 40 %
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7487b4deb1
commit
197fe113a1
5 files changed
+39
-17
No files matched your search
@@ -110,8 +110,10 @@ class WatchSession {
|
||||
/// The rule, for an item [runtime] seconds long whose ending starts at
|
||||
/// [endingStart] (an Outro segment or ED chapter; null = the real end):
|
||||
/// - played before: [WatchOutcome.keepPlayed];
|
||||
/// - [covered] >= 80 % of the runtime, or the ending was reached
|
||||
/// ([furthest]) with [covered] >= 50 %: [WatchOutcome.played];
|
||||
/// - [covered] >= 70 % of the runtime, or the ending was reached
|
||||
/// ([furthest]) with [covered] >= 40 %: [WatchOutcome.played]. The
|
||||
/// ending is the earlier of [endingStart] and the last 15 % (at most
|
||||
/// 4 min): someone who watched that far and stops is done with it;
|
||||
/// - [covered] under max(2 min, 5 %) (at most a quarter of a short
|
||||
/// item): [WatchOutcome.peek];
|
||||
/// - else [WatchOutcome.partial] at [lastPosition].
|
||||
@@ -120,8 +122,9 @@ class WatchSession {
|
||||
if (playedBefore) return const WatchVerdict(WatchOutcome.keepPlayed);
|
||||
final c = covered;
|
||||
if (runtime > 0) {
|
||||
final end = endingStart != null && endingStart > 0 && endingStart < runtime ? endingStart : runtime - 2;
|
||||
if (c >= 0.8 * runtime || (furthest >= end && c >= 0.5 * runtime)) {
|
||||
final tail = runtime - math.min(240.0, 0.15 * runtime);
|
||||
final end = endingStart != null && endingStart > 0 && endingStart < tail ? endingStart : tail;
|
||||
if (c >= 0.7 * runtime || (furthest >= end && c >= 0.4 * runtime)) {
|
||||
return const WatchVerdict(WatchOutcome.played);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ void main() {
|
||||
expect(w.watched, closeTo(400, 1));
|
||||
});
|
||||
|
||||
test('played: 80 % covered, or the ending reached after 50 %', () {
|
||||
test('played: 70 % covered, or the ending (or the last 15 %) reached after 40 %', () {
|
||||
final full = WatchSession();
|
||||
play(full, 0, 0, 1200); // 83 %
|
||||
expect(full.verdict(runtime: ep, endingStart: ed).outcome, WatchOutcome.played);
|
||||
@@ -50,8 +50,14 @@ void main() {
|
||||
final t = play(skipped, 0, 0, 800); // 56 %, then skipped to the ED
|
||||
play(skipped, t, ed, ed + 5);
|
||||
expect(skipped.verdict(runtime: ep, endingStart: ed).outcome, WatchOutcome.played);
|
||||
// Without a known ending only the real end counts.
|
||||
expect(skipped.verdict(runtime: ep).outcome, WatchOutcome.partial);
|
||||
// Without a known ending the last 15 % (at most 4 min) counts.
|
||||
expect(skipped.verdict(runtime: ep).outcome, WatchOutcome.played);
|
||||
|
||||
// Watched with the opening skipped, stopped 3 min before the end.
|
||||
final early = WatchSession();
|
||||
final u = play(early, 0, 0, 90);
|
||||
play(early, u, 180, ep - 180);
|
||||
expect(early.verdict(runtime: ep).outcome, WatchOutcome.played);
|
||||
|
||||
final jumped = WatchSession();
|
||||
play(jumped, 0, 0, 400); // 28 %, then jumped to the end
|
||||
|
||||
Reference in new issue
Block a user