Skip to content

Commit db6febe

Browse files
partly removed ffmpeg deps due to new metadata parsing
1 parent ee9b975 commit db6febe

File tree

7 files changed

+55
-472
lines changed

7 files changed

+55
-472
lines changed

lib/main.dart

+9-17
Original file line numberDiff line numberDiff line change
@@ -1213,19 +1213,13 @@ Future<void> _loadSongs() async {
12131213
final prefs = await SharedPreferences.getInstance();
12141214
int currentCount = 0;
12151215
List<Song> loadedSongs = [];
1216+
if (prefs.getBool('autoConvert') ?? false) {
12161217
do {
12171218
final metadata = await rust_api.scanMusicDirectory(
12181219
dirPath: currentMusicDirectory,
1219-
autoConvert: prefs.getBool('autoConvert') ?? true,
1220+
autoConvert: prefs.getBool('autoConvert') ?? false,
12201221
);
1221-
final paths = metadata.map((m) => m.path).toList();
1222-
final cacheDir = await getTemporaryDirectory();
1223-
final artistCacheDir = '${cacheDir.path}/artist_cache';
1224-
final artistMap = await rust_api.batchGetArtists(
1225-
paths: paths,
1226-
cacheDir: artistCacheDir,
1227-
);
1228-
loadedSongs = metadata.map((m) => Song.fromMetadata(m, artists: artistMap[m.path] ?? [m.artist])).toList();
1222+
loadedSongs = metadata.map((m) => Song.fromMetadata(m)).toList();
12291223
currentCount = loadedSongs.length;
12301224
setState(() {
12311225
songs = loadedSongs;
@@ -1240,6 +1234,7 @@ Future<void> _loadSongs() async {
12401234
await Future.delayed(const Duration(seconds: 1));
12411235
}
12421236
} while (currentCount >= expectedCount);
1237+
}
12431238
loadedSongs.sort((a, b) => a.title.compareTo(b.title));
12441239
} catch (e) {
12451240
print('Error loading songs: $e');
@@ -2998,7 +2993,7 @@ Widget _buildSettingsSwitch(
29982993
final textColor =
29992994
_currentColor.computeLuminance() > 0.007 ? _currentColor : Colors.white;
30002995
final buttonTextColor =
3001-
_currentColor.computeLuminance() > 0.5 ? Colors.black : Colors.white;
2996+
_currentColor.computeLuminance() > 0.007 ? Colors.black : Colors.white;
30022997

30032998
return RawKeyboardListener(
30042999
focusNode: FocusNode(),
@@ -3534,7 +3529,7 @@ Widget _buildSettingsSwitch(
35343529
required VoidCallback onPressed,
35353530
}) {
35363531
final textColor =
3537-
_currentColor.computeLuminance() > 0.5 ? Colors.black : Colors.white;
3532+
_currentColor.computeLuminance() > 0.007 ? Colors.black : Colors.white;
35383533

35393534
return Material(
35403535
color: Colors.transparent,
@@ -5573,10 +5568,7 @@ class _DownloadScreenState extends State<DownloadScreen>
55735568
);
55745569

55755570
if (metadata.isNotEmpty) {
5576-
final artists = await rust_api.getArtistViaFfprobe(
5577-
filePath: downloadedPath,
5578-
);
5579-
_tempSong = Song.fromMetadata(metadata.first, artists: artists);
5571+
_tempSong = Song.fromMetadata(metadata.first);
55805572

55815573
if (_tempSong!.albumArt != null) {
55825574
try {
@@ -5600,8 +5592,8 @@ class _DownloadScreenState extends State<DownloadScreen>
56005592
onReloadLibrary: widget.onReloadLibrary,
56015593
musicFolder: widget.musicFolder,
56025594
service: widget.service,
5603-
song: Song.fromMetadata(metadata.first, artists: artists),
5604-
songList: [Song.fromMetadata(metadata.first, artists: artists)],
5595+
song: Song.fromMetadata(metadata.first),
5596+
songList: [Song.fromMetadata(metadata.first)],
56055597
currentIndex: 0,
56065598
isTemp: true,
56075599
tempPath: downloadedPath,

lib/src/rust/api/music_handler.dart

-9
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ Float64List extractWaveformFromMp3(
6565
RustLib.instance.api.crateApiMusicHandlerExtractWaveformFromMp3(
6666
mp3Path: mp3Path, sampleCount: sampleCount, channels: channels);
6767

68-
List<String> getArtistViaFfprobe({required String filePath}) =>
69-
RustLib.instance.api
70-
.crateApiMusicHandlerGetArtistViaFfprobe(filePath: filePath);
71-
7268
void addSeparator({required String separator}) =>
7369
RustLib.instance.api.crateApiMusicHandlerAddSeparator(separator: separator);
7470

@@ -81,11 +77,6 @@ List<String> getCurrentSeparators() =>
8177
void resetSeparators() =>
8278
RustLib.instance.api.crateApiMusicHandlerResetSeparators();
8379

84-
Map<String, List<String>> batchGetArtists(
85-
{required List<String> paths, required String cacheDir}) =>
86-
RustLib.instance.api
87-
.crateApiMusicHandlerBatchGetArtists(paths: paths, cacheDir: cacheDir);
88-
8980
Future<String> downloadToTemp({required String query}) =>
9081
RustLib.instance.api.crateApiMusicHandlerDownloadToTemp(query: query);
9182

0 commit comments

Comments
 (0)