0.5.2 - Download fixes, translation updates, system theme

This commit is contained in:
exttex 2020-10-11 22:06:29 +02:00
parent b9474ffdeb
commit 9585adf528
20 changed files with 1028 additions and 331 deletions

View file

@ -428,7 +428,7 @@ class DownloadManager {
//Album folder / with disk number
if (settings.albumFolder) {
if (settings.albumDiscFolder) {
path = p.join(path, '%album%' + ' - Disk ' + track.diskNumber.toString());
path = p.join(path, '%album%' + ' - Disk ' + (track.diskNumber??null).toString());
} else {
path = p.join(path, '%album%');
}

View file

@ -34,7 +34,7 @@ class PlayerHelper {
int get queueIndex => AudioService.queue.indexWhere((mi) => mi.id == AudioService.currentMediaItem?.id??'Random string so it returns -1');
Future start() async {
//Subscribe to custom events
//Subscribe to custom events
_customEventSubscription = AudioService.customEventStream.listen((event) async {
if (!(event is Map)) return;
if (event['action'] == 'onLoad') {
@ -78,11 +78,10 @@ class PlayerHelper {
}
});
_mediaItemSubscription = AudioService.currentMediaItemStream.listen((event) {
if (event == null) return;
//Save queue
AudioService.customAction('saveQueue');
//Add to history
if (event == null) return;
if (cache.history == null) cache.history = [];
if (cache.history.length > 0 && cache.history.last.id == event.id) return;
cache.history.add(Track.fromMediaItem(event));
@ -90,21 +89,24 @@ class PlayerHelper {
});
//Start audio_service
startService();
await startService();
}
Future startService() async {
if (AudioService.running) return;
await AudioService.start(
backgroundTaskEntrypoint: backgroundTaskEntrypoint,
androidEnableQueue: true,
androidStopForegroundOnPause: false,
androidNotificationOngoing: false,
androidNotificationClickStartsActivity: false,
androidNotificationChannelDescription: 'Freezer',
androidNotificationChannelName: 'Freezer',
androidNotificationIcon: 'drawable/ic_logo',
);
if (AudioService.running && AudioService.connected) return;
if (!AudioService.connected)
await AudioService.connect();
if (!AudioService.running)
await AudioService.start(
backgroundTaskEntrypoint: backgroundTaskEntrypoint,
androidEnableQueue: true,
androidStopForegroundOnPause: false,
androidNotificationOngoing: false,
androidNotificationClickStartsActivity: true,
androidNotificationChannelDescription: 'Freezer',
androidNotificationChannelName: 'Freezer',
androidNotificationIcon: 'drawable/ic_logo',
);
}
Future toggleShuffle() async {