mirror of
https://github.com/austinried/subtracks.git
synced 2025-12-27 09:09:29 +01:00
audio playback error logging
subsonic error logging source save error logging
This commit is contained in:
parent
e410dcb2eb
commit
121af2bca3
@ -8,6 +8,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
import '../../database/database.dart';
|
import '../../database/database.dart';
|
||||||
|
import '../../log.dart';
|
||||||
import '../../models/settings.dart';
|
import '../../models/settings.dart';
|
||||||
import '../../services/settings_service.dart';
|
import '../../services/settings_service.dart';
|
||||||
import '../items.dart';
|
import '../items.dart';
|
||||||
@ -161,8 +162,9 @@ class SourcePage extends HookConsumerWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (e, st) {
|
||||||
// TOOD: toast the error or whatever
|
// TOOD: toast the error or whatever
|
||||||
|
log.severe('Saving source', e, st);
|
||||||
error = true;
|
error = true;
|
||||||
} finally {
|
} finally {
|
||||||
isSaving.value = false;
|
isSaving.value = false;
|
||||||
|
|||||||
@ -440,7 +440,7 @@ LazyDatabase _openConnection() {
|
|||||||
|
|
||||||
return ErrorLoggingDatabase(
|
return ErrorLoggingDatabase(
|
||||||
NativeDatabase.createInBackground(file),
|
NativeDatabase.createInBackground(file),
|
||||||
(e, s) => log.severe('SQL Error', e, s),
|
(e, s) => log.severe('SQL error', e, s),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,32 +95,36 @@ class AudioControl extends BaseAudioHandler with QueueHandler, SeekHandler {
|
|||||||
int get _sourceId => _ref.read(sourceIdProvider);
|
int get _sourceId => _ref.read(sourceIdProvider);
|
||||||
|
|
||||||
AudioControl(this._player, this._ref) {
|
AudioControl(this._player, this._ref) {
|
||||||
_player.playbackEventStream.listen((PlaybackEvent event) {
|
_player.playbackEventStream.listen(
|
||||||
final playing = _player.playing;
|
(PlaybackEvent event) {
|
||||||
playbackState.add(playbackState.value.copyWith(
|
final playing = _player.playing;
|
||||||
controls: [
|
playbackState.add(playbackState.value.copyWith(
|
||||||
MediaControl.skipToPrevious,
|
controls: [
|
||||||
if (playing) MediaControl.pause else MediaControl.play,
|
MediaControl.skipToPrevious,
|
||||||
MediaControl.stop,
|
if (playing) MediaControl.pause else MediaControl.play,
|
||||||
MediaControl.skipToNext,
|
MediaControl.stop,
|
||||||
],
|
MediaControl.skipToNext,
|
||||||
systemActions: const {
|
],
|
||||||
MediaAction.seek,
|
systemActions: const {
|
||||||
},
|
MediaAction.seek,
|
||||||
androidCompactActionIndices: const [0, 1, 3],
|
},
|
||||||
processingState: const {
|
androidCompactActionIndices: const [0, 1, 3],
|
||||||
ProcessingState.idle: AudioProcessingState.idle,
|
processingState: const {
|
||||||
ProcessingState.loading: AudioProcessingState.loading,
|
ProcessingState.idle: AudioProcessingState.idle,
|
||||||
ProcessingState.buffering: AudioProcessingState.buffering,
|
ProcessingState.loading: AudioProcessingState.loading,
|
||||||
ProcessingState.ready: AudioProcessingState.ready,
|
ProcessingState.buffering: AudioProcessingState.buffering,
|
||||||
ProcessingState.completed: AudioProcessingState.completed,
|
ProcessingState.ready: AudioProcessingState.ready,
|
||||||
}[_player.processingState]!,
|
ProcessingState.completed: AudioProcessingState.completed,
|
||||||
playing: playing,
|
}[_player.processingState]!,
|
||||||
updatePosition: _player.position,
|
playing: playing,
|
||||||
bufferedPosition: _player.bufferedPosition,
|
updatePosition: _player.position,
|
||||||
queueIndex: event.currentIndex,
|
bufferedPosition: _player.bufferedPosition,
|
||||||
));
|
queueIndex: event.currentIndex,
|
||||||
});
|
));
|
||||||
|
},
|
||||||
|
onError: (e, st) => log.warning('Audio playback error', e, st),
|
||||||
|
cancelOnError: false,
|
||||||
|
);
|
||||||
|
|
||||||
shuffleIndicies.listen((value) {
|
shuffleIndicies.listen((value) {
|
||||||
playbackState.add(playbackState.value.copyWith(
|
playbackState.add(playbackState.value.copyWith(
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'package:crypto/crypto.dart';
|
|||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:xml/xml.dart';
|
import 'package:xml/xml.dart';
|
||||||
|
|
||||||
|
import '../../log.dart';
|
||||||
import '../../models/settings.dart';
|
import '../../models/settings.dart';
|
||||||
import 'xml.dart';
|
import 'xml.dart';
|
||||||
|
|
||||||
@ -89,7 +90,9 @@ class SubsonicClient {
|
|||||||
final subsonicResponse =
|
final subsonicResponse =
|
||||||
SubsonicResponse(XmlDocument.parse(utf8.decode(res.bodyBytes)));
|
SubsonicResponse(XmlDocument.parse(utf8.decode(res.bodyBytes)));
|
||||||
if (subsonicResponse.status == Status.failed) {
|
if (subsonicResponse.status == Status.failed) {
|
||||||
throw SubsonicException(subsonicResponse.xml);
|
final error = SubsonicException(subsonicResponse.xml);
|
||||||
|
log.severe('Subsonic error', error);
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return subsonicResponse;
|
return subsonicResponse;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user