mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-10 17:07:30 +00:00
Store alternative source resources in cache; implements https://github.com/KRTirtho/spotube/issues/1195
https://github.com/KRTirtho/spotube/issues/1195
This commit is contained in:
parent
56219c43d2
commit
24955aa213
@ -14,6 +14,7 @@ import 'package:spotube/models/local_track.dart';
|
||||
import 'package:spotube/models/logger.dart';
|
||||
|
||||
import 'package:spotube/models/skip_segment.dart';
|
||||
import 'package:spotube/models/source_match.dart';
|
||||
|
||||
import 'package:spotube/provider/blacklist_provider.dart';
|
||||
import 'package:spotube/provider/palette_provider.dart';
|
||||
@ -448,6 +449,18 @@ class ProxyPlaylistNotifier extends PersistedStateNotifier<ProxyPlaylist>
|
||||
audioPlayer.currentSource!,
|
||||
makeAppropriateSource(newTrack),
|
||||
);
|
||||
|
||||
// update cache: first remove track, then add the new source
|
||||
await SourceMatch.box.delete(state.activeTrack?.id);
|
||||
await SourceMatch.box.put(
|
||||
newTrack.id,
|
||||
SourceMatch(
|
||||
id: newTrack.id!,
|
||||
sourceType: SourceType.youtube,
|
||||
createdAt: DateTime.now(),
|
||||
sourceId: sibling.id,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user