Skip to content

Commit

Permalink
chore: history import wont remove old listens in same time range
Browse files Browse the repository at this point in the history
and will only remove duplicates after finishing, extremely useful for when u already listened to videos in namida and want to import more
  • Loading branch information
MSOB7YY committed Nov 13, 2023
1 parent ed91f91 commit 0f5670c
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions lib/controller/json_to_history_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,23 +274,6 @@ class JsonToHistoryParser {

final isytsource = source == TrackSource.youtube || source == TrackSource.youtubeMusic;

// -- Removing previous source tracks.
if (isytsource) {
HistoryController.inst.removeSourcesTracksFromHistory(
[TrackSource.youtube, TrackSource.youtubeMusic],
oldestDate: oldestDate,
newestDate: newestDate,
andSave: false,
);
} else {
HistoryController.inst.removeSourcesTracksFromHistory(
[source],
oldestDate: oldestDate,
newestDate: newestDate,
andSave: false,
);
}

await Future.delayed(Duration.zero);

final startTime = DateTime.now();
Expand Down Expand Up @@ -335,11 +318,13 @@ class JsonToHistoryParser {
isParsing.value = false;

// -- local history --
HistoryController.inst.removeDuplicatedItems(datesAdded);
HistoryController.inst.sortHistoryTracks(datesAdded);
await HistoryController.inst.saveHistoryToStorage(datesAdded);
HistoryController.inst.updateMostPlayedPlaylist();

// -- youtube history --
YoutubeHistoryController.inst.removeDuplicatedItems(datesAddedYoutube);
YoutubeHistoryController.inst.sortHistoryTracks(datesAddedYoutube);
await YoutubeHistoryController.inst.saveHistoryToStorage(datesAddedYoutube);
YoutubeHistoryController.inst.updateMostPlayedPlaylist();
Expand Down

0 comments on commit 0f5670c

Please sign in to comment.