Skip to content

Commit

Permalink
day limit in refreash function
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantKArya committed Mar 30, 2024
1 parent c538230 commit 2788817
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/services/db/bloomee_db_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,13 @@ class BloomeeDBService {
}
}

static Future<void> refreshRecentlyPlayed() async {
static Future<void> refreshRecentlyPlayed({int days = 7}) async {
Isar isarDB = await db;

List<RecentlyPlayedDB> _recentlyPlayed =
isarDB.recentlyPlayedDBs.where().findAllSync();
for (var element in _recentlyPlayed) {
if (DateTime.now().difference(element.lastPlayed).inDays > 7) {
if (DateTime.now().difference(element.lastPlayed).inDays > days) {
removeMediaItemFromPlaylist(element.mediaItem.value!,
MediaPlaylistDB(playlistName: "recently_played"));
isarDB.writeTxnSync(
Expand Down

0 comments on commit 2788817

Please sign in to comment.