fix: remove cache as we watch some video

This commit is contained in:
omkar 2025-01-11 14:10:36 +05:30
parent 111fe55d4f
commit 9af15fbdb0
3 changed files with 12 additions and 2 deletions

View file

@ -180,6 +180,8 @@ class _VideoViewerState extends State<VideoViewer> {
bool canCallOnce = false;
int? traktId;
Future<void> setDurationFromTrakt() async {
if (player.state.duration.inSeconds < 2) {
return;
@ -203,10 +205,12 @@ class _VideoViewerState extends State<VideoViewer> {
return;
}
traktId = progress!.first.traktId;
final duration = Duration(
seconds: calculateSecondsFromProgress(
player.state.duration.inSeconds.toDouble(),
progress!.first.progress,
progress.first.progress,
),
);
@ -406,6 +410,7 @@ class _VideoViewerState extends State<VideoViewer> {
meta: widget.meta as types.Meta,
progress: currentProgressInPercentage,
shouldClearCache: true,
traktId: traktId,
);
}

View file

@ -755,6 +755,7 @@ class TraktService {
required Meta meta,
required double progress,
bool shouldClearCache = false,
int? traktId,
}) async {
if (!isEnabled()) {
_logger.info('Trakt integration is not enabled');
@ -783,6 +784,7 @@ class TraktService {
_cache.remove('$_baseUrl/sync/playback');
final keys = [
if (traktId != null) "$_baseUrl/shows/$traktId/progress/watched",
"continue_watching",
if (meta.type == "series") "up_next_series",
];
@ -821,7 +823,7 @@ class TraktService {
}
final isShow =
item["show"]["ids"]["imdb"] == (meta.imdbId ?? meta.id);
item["show"]?["ids"]?["imdb"] == (meta.imdbId ?? meta.id);
final currentEpisode = item["episode"]["number"];
final currentSeason = item["episode"]["season"];
@ -835,6 +837,7 @@ class TraktService {
progress: item["progress"]!,
episode: currentEpisode,
season: currentSeason,
traktId: item["show"]["ids"]["trakt"],
),
);
}

View file

@ -3,11 +3,13 @@ class TraktProgress {
final int? episode;
final int? season;
final double progress;
final int? traktId;
TraktProgress({
required this.id,
this.episode,
this.season,
required this.progress,
this.traktId,
});
}