mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix: local track metadata timeout
This commit is contained in:
parent
0d9fb1d388
commit
bd511584e7
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:spotube/services/logger/logger.dart';
|
import 'package:spotube/services/logger/logger.dart';
|
||||||
@ -49,7 +50,7 @@ final localTracksProvider =
|
|||||||
userPreferencesProvider.select((s) => s.localLibraryLocation),
|
userPreferencesProvider.select((s) => s.localLibraryLocation),
|
||||||
);
|
);
|
||||||
|
|
||||||
for (var location in [downloadLocation, ...localLibraryLocations]) {
|
for (final location in [downloadLocation, ...localLibraryLocations]) {
|
||||||
if (location.isEmpty) continue;
|
if (location.isEmpty) continue;
|
||||||
final entities = <FileSystemEntity>[];
|
final entities = <FileSystemEntity>[];
|
||||||
if (await Directory(location).exists()) {
|
if (await Directory(location).exists()) {
|
||||||
@ -67,7 +68,8 @@ final localTracksProvider =
|
|||||||
}).map(
|
}).map(
|
||||||
(file) async {
|
(file) async {
|
||||||
try {
|
try {
|
||||||
final metadata = await MetadataGod.readMetadata(file: file.path);
|
final metadata = await MetadataGod.readMetadata(file: file.path)
|
||||||
|
.timeout(const Duration(seconds: 10));
|
||||||
|
|
||||||
final imageFile = File(join(
|
final imageFile = File(join(
|
||||||
(await getTemporaryDirectory()).path,
|
(await getTemporaryDirectory()).path,
|
||||||
@ -89,7 +91,7 @@ final localTracksProvider =
|
|||||||
"art": imageFile.path
|
"art": imageFile.path
|
||||||
};
|
};
|
||||||
} catch (e, stack) {
|
} catch (e, stack) {
|
||||||
if (e is FfiException) {
|
if (e case FfiException() || TimeoutException()) {
|
||||||
return {"file": file};
|
return {"file": file};
|
||||||
}
|
}
|
||||||
AppLogger.reportError(e, stack);
|
AppLogger.reportError(e, stack);
|
||||||
|
@ -29,7 +29,7 @@ class AudioServices with WidgetsBindingObserver {
|
|||||||
androidNotificationChannelId:
|
androidNotificationChannelId:
|
||||||
kIsLinux ? 'spotube' : 'com.krtirtho.Spotube',
|
kIsLinux ? 'spotube' : 'com.krtirtho.Spotube',
|
||||||
androidNotificationChannelName: 'Spotube',
|
androidNotificationChannelName: 'Spotube',
|
||||||
androidNotificationOngoing: true,
|
androidNotificationOngoing: false,
|
||||||
androidNotificationIcon: "drawable/ic_launcher_monochrome",
|
androidNotificationIcon: "drawable/ic_launcher_monochrome",
|
||||||
androidStopForegroundOnPause: false,
|
androidStopForegroundOnPause: false,
|
||||||
androidNotificationChannelDescription: "Spotube Media Controls",
|
androidNotificationChannelDescription: "Spotube Media Controls",
|
||||||
|
Loading…
Reference in New Issue
Block a user