mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-08 16:27:31 +00:00
fix: no audio-tags in Linux and duration not showing up for local tracks
This commit is contained in:
parent
b31933f31d
commit
79b9c57932
@ -283,7 +283,7 @@ class TrackOptions extends HookConsumerWidget {
|
||||
),
|
||||
PopSheetEntry(
|
||||
value: TrackOptionValue.download,
|
||||
enabled: isInQueue,
|
||||
enabled: !isInQueue,
|
||||
leading: isInQueue
|
||||
? HookBuilder(builder: (context) {
|
||||
final progress = useListenable(progressNotifier!);
|
||||
|
||||
@ -118,7 +118,7 @@ class DownloadManager {
|
||||
savePath: partialFilePath,
|
||||
onReceiveProgress: createCallback(url, 0),
|
||||
cancelToken: cancelToken,
|
||||
deleteOnError: false,
|
||||
deleteOnError: true,
|
||||
);
|
||||
|
||||
if (response.statusCode == HttpStatus.ok) {
|
||||
|
||||
@ -162,15 +162,13 @@ class YoutubeEndpoints {
|
||||
}
|
||||
|
||||
String _pipedStreamResponseToStreamUrl(PipedStreamResponse stream) {
|
||||
final streamFormat = DesktopTools.platform.isLinux
|
||||
? PipedAudioStreamFormat.webm
|
||||
: PipedAudioStreamFormat.m4a;
|
||||
|
||||
return switch (preferences.audioQuality) {
|
||||
AudioQuality.high =>
|
||||
stream.highestBitrateAudioStreamOfFormat(streamFormat)!.url,
|
||||
AudioQuality.low =>
|
||||
stream.lowestBitrateAudioStreamOfFormat(streamFormat)!.url,
|
||||
AudioQuality.high => stream
|
||||
.highestBitrateAudioStreamOfFormat(PipedAudioStreamFormat.m4a)!
|
||||
.url,
|
||||
AudioQuality.low => stream
|
||||
.lowestBitrateAudioStreamOfFormat(PipedAudioStreamFormat.m4a)!
|
||||
.url,
|
||||
};
|
||||
}
|
||||
|
||||
@ -180,15 +178,7 @@ class YoutubeEndpoints {
|
||||
() => youtube!.videos.streams.getManifest(id),
|
||||
);
|
||||
final audioOnlyManifests = res.audioOnly.where((info) {
|
||||
final isMp4a = info.codec.mimeType == "audio/mp4";
|
||||
if (DesktopTools.platform.isLinux) {
|
||||
return !isMp4a;
|
||||
} else if (DesktopTools.platform.isMacOS ||
|
||||
DesktopTools.platform.isIOS) {
|
||||
return isMp4a;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return info.codec.mimeType == "audio/mp4";
|
||||
});
|
||||
|
||||
return switch (preferences.audioQuality) {
|
||||
|
||||
@ -167,7 +167,7 @@ abstract class TypeConversionUtils {
|
||||
track.name = metadata?.title ?? basenameWithoutExtension(file.path);
|
||||
track.type = "track";
|
||||
track.uri = file.path;
|
||||
track.durationMs = metadata?.durationMs?.toInt();
|
||||
track.durationMs = (metadata?.durationMs?.toInt() ?? 0) * 1000;
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
20
pubspec.lock
20
pubspec.lock
@ -330,14 +330,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
colorize:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: colorize
|
||||
sha256: "584746cd6ba1cba0633b6720f494fe6f9601c4170f0666c1579d2aa2a61071ba"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
connectivity_plus:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -510,10 +502,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ffi
|
||||
sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978
|
||||
sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "2.0.2"
|
||||
file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -734,10 +726,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_rust_bridge
|
||||
sha256: "34f5becca2df35955b2ec5e875349028ea609a826de7aade4de80534cf876b27"
|
||||
sha256: ff90d5ddd0cda6d94ed048cc9c4a4d993d1a4bb11605d60a1282fc1bbf173c77
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.72.1"
|
||||
version: "1.80.1"
|
||||
flutter_secure_storage:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1466,10 +1458,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: puppeteer
|
||||
sha256: "1304d8044054a8c89df648ef12352cf840ed2d34bbfbfa03d91537c72ae0f2c7"
|
||||
sha256: "59e723cc5b69537159a7c34efd645dc08a6a1ac4647d7d7823606802c0f93cdb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.22.0"
|
||||
version: "3.2.0"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user