mirror of
https://github.com/madari-media/madari-oss.git
synced 2026-03-11 17:15:39 +00:00
fix: remove cache as we watch some video
This commit is contained in:
parent
111fe55d4f
commit
9af15fbdb0
3 changed files with 12 additions and 2 deletions
|
|
@ -180,6 +180,8 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
|
|
||||||
bool canCallOnce = false;
|
bool canCallOnce = false;
|
||||||
|
|
||||||
|
int? traktId;
|
||||||
|
|
||||||
Future<void> setDurationFromTrakt() async {
|
Future<void> setDurationFromTrakt() async {
|
||||||
if (player.state.duration.inSeconds < 2) {
|
if (player.state.duration.inSeconds < 2) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -203,10 +205,12 @@ class _VideoViewerState extends State<VideoViewer> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
traktId = progress!.first.traktId;
|
||||||
|
|
||||||
final duration = Duration(
|
final duration = Duration(
|
||||||
seconds: calculateSecondsFromProgress(
|
seconds: calculateSecondsFromProgress(
|
||||||
player.state.duration.inSeconds.toDouble(),
|
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,
|
meta: widget.meta as types.Meta,
|
||||||
progress: currentProgressInPercentage,
|
progress: currentProgressInPercentage,
|
||||||
shouldClearCache: true,
|
shouldClearCache: true,
|
||||||
|
traktId: traktId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -755,6 +755,7 @@ class TraktService {
|
||||||
required Meta meta,
|
required Meta meta,
|
||||||
required double progress,
|
required double progress,
|
||||||
bool shouldClearCache = false,
|
bool shouldClearCache = false,
|
||||||
|
int? traktId,
|
||||||
}) async {
|
}) async {
|
||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
_logger.info('Trakt integration is not enabled');
|
_logger.info('Trakt integration is not enabled');
|
||||||
|
|
@ -783,6 +784,7 @@ class TraktService {
|
||||||
_cache.remove('$_baseUrl/sync/playback');
|
_cache.remove('$_baseUrl/sync/playback');
|
||||||
|
|
||||||
final keys = [
|
final keys = [
|
||||||
|
if (traktId != null) "$_baseUrl/shows/$traktId/progress/watched",
|
||||||
"continue_watching",
|
"continue_watching",
|
||||||
if (meta.type == "series") "up_next_series",
|
if (meta.type == "series") "up_next_series",
|
||||||
];
|
];
|
||||||
|
|
@ -821,7 +823,7 @@ class TraktService {
|
||||||
}
|
}
|
||||||
|
|
||||||
final isShow =
|
final isShow =
|
||||||
item["show"]["ids"]["imdb"] == (meta.imdbId ?? meta.id);
|
item["show"]?["ids"]?["imdb"] == (meta.imdbId ?? meta.id);
|
||||||
|
|
||||||
final currentEpisode = item["episode"]["number"];
|
final currentEpisode = item["episode"]["number"];
|
||||||
final currentSeason = item["episode"]["season"];
|
final currentSeason = item["episode"]["season"];
|
||||||
|
|
@ -835,6 +837,7 @@ class TraktService {
|
||||||
progress: item["progress"]!,
|
progress: item["progress"]!,
|
||||||
episode: currentEpisode,
|
episode: currentEpisode,
|
||||||
season: currentSeason,
|
season: currentSeason,
|
||||||
|
traktId: item["show"]["ids"]["trakt"],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@ class TraktProgress {
|
||||||
final int? episode;
|
final int? episode;
|
||||||
final int? season;
|
final int? season;
|
||||||
final double progress;
|
final double progress;
|
||||||
|
final int? traktId;
|
||||||
|
|
||||||
TraktProgress({
|
TraktProgress({
|
||||||
required this.id,
|
required this.id,
|
||||||
this.episode,
|
this.episode,
|
||||||
this.season,
|
this.season,
|
||||||
required this.progress,
|
required this.progress,
|
||||||
|
this.traktId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue