diff --git a/lib/class/track.dart b/lib/class/track.dart index 08dada8e..a5823587 100644 --- a/lib/class/track.dart +++ b/lib/class/track.dart @@ -181,12 +181,6 @@ extension SelectableListUtils on Iterable { } class Track extends Selectable { - Folder get folder => Folder.explicit(folderPath); - - bool hasInfoInLibrary() => toTrackExtOrNull() != null; - TrackExtended toTrackExt() => toTrackExtOrNull() ?? kDummyExtendedTrack.copyWith(title: path.getFilenameWOExt, path: path); - TrackExtended? toTrackExtOrNull() => Indexer.inst.allTracksMappedByPath[path]; - @override Track get track => this; @@ -628,6 +622,12 @@ extension TrackExtUtils on TrackExtended { } extension TrackUtils on Track { + Folder get folder => Folder.explicit(folderPath); + + bool hasInfoInLibrary() => toTrackExtOrNull() != null; + TrackExtended toTrackExt() => toTrackExtOrNull() ?? kDummyExtendedTrack.copyWith(title: path.getFilenameWOExt, path: path); + TrackExtended? toTrackExtOrNull() => Indexer.inst.allTracksMappedByPath[path]; + String get yearPreferyyyyMMdd => toTrackExt().yearPreferyyyyMMdd; String get title => toTrackExt().title; diff --git a/lib/controller/ffmpeg_controller.dart b/lib/controller/ffmpeg_controller.dart index 7f2dab41..b0a98d20 100644 --- a/lib/controller/ffmpeg_controller.dart +++ b/lib/controller/ffmpeg_controller.dart @@ -339,20 +339,18 @@ class NamidaFFMPEG { }) async { assert(quality >= 1 && quality <= 31, 'quality ranges only between 1 & 31'); + final didExecute = await _ffmpegExecute('-i "$videoPath" -map 0:v -map -0:V -c copy -y "$thumbnailSavePath"'); + if (didExecute) return true; + int? atMillisecond = atDuration?.inMilliseconds; if (atMillisecond == null) { final duration = await getMediaDuration(videoPath); if (duration != null) atMillisecond = duration.inMilliseconds; } - final didExecute = await _ffmpegExecute('-i "$videoPath" -map 0:v -map -0:V -c copy -y "$thumbnailSavePath"'); - if (didExecute) { - return true; - } else { - final totalSeconds = (atMillisecond ?? 0) / 1000; // converting to decimal seconds. - final extractFromSecond = totalSeconds * 0.1; // thumbnail at 10% of duration. - return await _ffmpegExecute('-ss $extractFromSecond -i "$videoPath" -frames:v 1 -q:v $quality -y "$thumbnailSavePath"'); - } + final totalSeconds = (atMillisecond ?? 0) / 1000; // converting to decimal seconds. + final extractFromSecond = totalSeconds * 0.1; // thumbnail at 10% of duration. + return await _ffmpegExecute('-ss $extractFromSecond -i "$videoPath" -frames:v 1 -q:v $quality -y "$thumbnailSavePath"'); } Future getMediaDuration(String path) async { diff --git a/lib/controller/settings_controller.dart b/lib/controller/settings_controller.dart index 76524ce5..6055d7f0 100644 --- a/lib/controller/settings_controller.dart +++ b/lib/controller/settings_controller.dart @@ -115,6 +115,7 @@ class _SettingsController with SettingsFileWriter { final heatmapListensView = false.obs; final RxList backupItemslist = [ AppPaths.TRACKS, + AppPaths.TRACKS_STATS_OLD, AppPaths.TRACKS_STATS_DB_INFO.file.path, AppPaths.TOTAL_LISTEN_TIME, AppPaths.VIDEOS_CACHE, @@ -131,6 +132,7 @@ class _SettingsController with SettingsFileWriter { AppDirs.YT_PLAYLISTS, AppDirs.YT_HISTORY_PLAYLIST, AppPaths.YT_LIKES_PLAYLIST, + AppDirs.YT_DOWNLOAD_TASKS, ].obs; final enableVideoPlayback = true.obs; final enableLyrics = false.obs; diff --git a/lib/core/extensions.dart b/lib/core/extensions.dart index 49b60506..53b585e3 100644 --- a/lib/core/extensions.dart +++ b/lib/core/extensions.dart @@ -446,13 +446,10 @@ extension CloseDialogIfTrueFuture on FutureOr { } } -extension ThreadOpener on ComputeCallback { - /// Executes function on a separate thread using compute(). +extension IsolateOpener on ComputeCallback { + /// Executes function on a separate isolate using compute(). /// Must be `static` or `global` function. Future thready(M parameter) async { - try { - WidgetsFlutterBinding.ensureInitialized(); - } catch (_) {} return await compute(this, parameter); } } diff --git a/lib/packages/miniplayer_base.dart b/lib/packages/miniplayer_base.dart index fe6ef80b..84fca809 100644 --- a/lib/packages/miniplayer_base.dart +++ b/lib/packages/miniplayer_base.dart @@ -748,7 +748,7 @@ class _NamidaMiniPlayerBaseState extends State=3.4.0 <4.0.0"