Skip to content

Commit

Permalink
fix: #137
Browse files Browse the repository at this point in the history
  • Loading branch information
ch0nker committed Sep 2, 2024
1 parent 87f3625 commit 2e06574
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/modules/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const getProgress = (animeEntry: Media): number | undefined => {
const lastWatched = getLastWatchedEpisode(animeId);

if(lastWatched !== undefined && lastWatched.data !== undefined) {
const progress = (lastWatched.data.episodeNumber as number) - 1;
const progress = (lastWatched.data.episodeNumber as number) - ((lastWatched.duration as number * 0.85) > lastWatched.time ? 1 : 0);
return Number.isNaN(progress) ? 0 : progress;
}

Expand Down
4 changes: 1 addition & 3 deletions src/renderer/components/modals/AnimeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ const AnimeModal: React.FC<AnimeModalProps> = ({
const fetchEpisodesInfo = async () => {
const animeId = listAnimeData.media.id as number;

const lastWatched = getLastWatchedEpisode(animeId);
if(lastWatched && lastWatched.data)
setLocalProgress((lastWatched.data.episodeNumber as number) - 1);
setLocalProgress(getProgress(listAnimeData.media));

axios
.get(`${EPISODES_INFO_URL}${animeId}`)
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/player/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
data: listAnimeData,
};

console.log(episodeNumber, (episodesInfo as EpisodeInfo[])[episodeNumber]);

entry.history[episodeNumber] = {
time: cTime,
timestamp: Date.now(),
Expand Down

0 comments on commit 2e06574

Please sign in to comment.