Initial commit

This commit is contained in:
admin1
2026-07-14 11:11:36 +08:00
commit 656499cf94
604 changed files with 119518 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import '../../core/contracts/library.dart';
TmdbLibraryHit? selectPrimaryTmdbHit(
List<TmdbLibraryHit> hits, {
String? activeServerId,
}) {
if (hits.isEmpty) return null;
int score(TmdbLibraryHit h) {
var s = 0;
if ((h.playbackPositionTicks ?? 0) > 0) s += 2;
if (activeServerId != null && h.serverId == activeServerId) s += 1;
return s;
}
var best = hits.first;
var bestScore = score(best);
for (final h in hits.skip(1)) {
final s = score(h);
if (s > bestScore) {
best = h;
bestScore = s;
}
}
return best;
}