mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
chore: disable reading/writing audiotags in macOS for as unsupported platform for metadata_god
build: bump version to 2.4.0 for next release fix: playlist view, album view, local track view play another track of already playing album/playlist behavior
This commit is contained in:
parent
d9addcda8e
commit
56ed536130
@ -75,6 +75,14 @@ class AlbumView extends HookConsumerWidget {
|
|||||||
onPlay: ([track]) {
|
onPlay: ([track]) {
|
||||||
if (tracksSnapshot.asData?.value != null) {
|
if (tracksSnapshot.asData?.value != null) {
|
||||||
if (!isAlbumPlaying) {
|
if (!isAlbumPlaying) {
|
||||||
|
playPlaylist(
|
||||||
|
playback,
|
||||||
|
tracksSnapshot.asData!.value
|
||||||
|
.map((track) =>
|
||||||
|
TypeConversionUtils.simpleTrack_X_Track(track, album))
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
} else if (isAlbumPlaying && track != null) {
|
||||||
playPlaylist(
|
playPlaylist(
|
||||||
playback,
|
playback,
|
||||||
tracksSnapshot.asData!.value
|
tracksSnapshot.asData!.value
|
||||||
|
@ -13,6 +13,7 @@ import 'package:spotube/models/CurrentPlaylist.dart';
|
|||||||
import 'package:spotube/models/Logger.dart';
|
import 'package:spotube/models/Logger.dart';
|
||||||
import 'package:spotube/provider/Playback.dart';
|
import 'package:spotube/provider/Playback.dart';
|
||||||
import 'package:spotube/provider/UserPreferences.dart';
|
import 'package:spotube/provider/UserPreferences.dart';
|
||||||
|
import 'package:spotube/utils/platform.dart';
|
||||||
import 'package:spotube/utils/primitive_utils.dart';
|
import 'package:spotube/utils/primitive_utils.dart';
|
||||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||||
|
|
||||||
@ -44,6 +45,17 @@ final localTracksProvider = FutureProvider<List<Track>>((ref) async {
|
|||||||
}
|
}
|
||||||
final entities = downloadDir.listSync(recursive: true);
|
final entities = downloadDir.listSync(recursive: true);
|
||||||
|
|
||||||
|
// TODO: Add MacOS audiotag reading support
|
||||||
|
if (kIsMacOS) {
|
||||||
|
return entities
|
||||||
|
.map(
|
||||||
|
(entity) => TypeConversionUtils.localTrack_X_Track(
|
||||||
|
File(entity.path),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
final filesWithMetadata = (await Future.wait(
|
final filesWithMetadata = (await Future.wait(
|
||||||
entities.map((e) => File(e.path)).where((file) {
|
entities.map((e) => File(e.path)).where((file) {
|
||||||
final mimetype = lookupMimeType(file.path);
|
final mimetype = lookupMimeType(file.path);
|
||||||
@ -81,9 +93,9 @@ final localTracksProvider = FutureProvider<List<Track>>((ref) async {
|
|||||||
final tracks = filesWithMetadata
|
final tracks = filesWithMetadata
|
||||||
.map(
|
.map(
|
||||||
(fileWithMetadata) => TypeConversionUtils.localTrack_X_Track(
|
(fileWithMetadata) => TypeConversionUtils.localTrack_X_Track(
|
||||||
fileWithMetadata["metadata"] as Metadata,
|
fileWithMetadata["file"],
|
||||||
fileWithMetadata["file"] as File,
|
metadata: fileWithMetadata["metadata"],
|
||||||
fileWithMetadata["art"] as String?,
|
art: fileWithMetadata["art"],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
@ -184,17 +196,11 @@ class UserLocalTracks extends HookConsumerWidget {
|
|||||||
: "assets/album-placeholder.png",
|
: "assets/album-placeholder.png",
|
||||||
isLocal: true,
|
isLocal: true,
|
||||||
onTrackPlayButtonPressed: (currentTrack) {
|
onTrackPlayButtonPressed: (currentTrack) {
|
||||||
if (tracks.isNotEmpty) {
|
return playLocalTracks(
|
||||||
if (!isPlaylistPlaying) {
|
playback,
|
||||||
playLocalTracks(
|
tracks,
|
||||||
playback,
|
currentTrack: track,
|
||||||
tracks,
|
);
|
||||||
currentTrack: track,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
playback.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -84,6 +84,11 @@ class PlaylistView extends HookConsumerWidget {
|
|||||||
onPlay: ([track]) {
|
onPlay: ([track]) {
|
||||||
if (tracksSnapshot.asData?.value != null) {
|
if (tracksSnapshot.asData?.value != null) {
|
||||||
if (!isPlaylistPlaying) {
|
if (!isPlaylistPlaying) {
|
||||||
|
playPlaylist(
|
||||||
|
playback,
|
||||||
|
tracksSnapshot.asData!.value,
|
||||||
|
);
|
||||||
|
} else if (isPlaylistPlaying && track != null) {
|
||||||
playPlaylist(
|
playPlaylist(
|
||||||
playback,
|
playback,
|
||||||
tracksSnapshot.asData!.value,
|
tracksSnapshot.asData!.value,
|
||||||
|
@ -26,7 +26,7 @@ class About extends HookWidget {
|
|||||||
final info = usePackageInfo(
|
final info = usePackageInfo(
|
||||||
appName: "Spotube",
|
appName: "Spotube",
|
||||||
packageName: "oss.krtirtho.Spotube",
|
packageName: "oss.krtirtho.Spotube",
|
||||||
version: "2.3.0");
|
version: "2.4.0");
|
||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: Icon(Icons.info_outline_rounded),
|
leading: Icon(Icons.info_outline_rounded),
|
||||||
|
@ -13,6 +13,7 @@ import 'package:spotube/models/SpotubeTrack.dart';
|
|||||||
import 'package:spotube/provider/Playback.dart';
|
import 'package:spotube/provider/Playback.dart';
|
||||||
import 'package:spotube/provider/UserPreferences.dart';
|
import 'package:spotube/provider/UserPreferences.dart';
|
||||||
import 'package:spotube/provider/YouTube.dart';
|
import 'package:spotube/provider/YouTube.dart';
|
||||||
|
import 'package:spotube/utils/platform.dart';
|
||||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||||
import 'package:youtube_explode_dart/youtube_explode_dart.dart' hide Comment;
|
import 'package:youtube_explode_dart/youtube_explode_dart.dart' hide Comment;
|
||||||
|
|
||||||
@ -93,6 +94,9 @@ class Downloader with ChangeNotifier {
|
|||||||
"[addToQueue] Download of ${file.path} is done successfully",
|
"[addToQueue] Download of ${file.path} is done successfully",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: Add MacOS audiotag writing support
|
||||||
|
if (kIsMacOS) return;
|
||||||
|
|
||||||
logger.v(
|
logger.v(
|
||||||
"[addToQueue] Writing metadata to ${file.path}",
|
"[addToQueue] Writing metadata to ${file.path}",
|
||||||
);
|
);
|
||||||
|
@ -107,15 +107,15 @@ abstract class TypeConversionUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static SpotubeTrack localTrack_X_Track(
|
static SpotubeTrack localTrack_X_Track(
|
||||||
Metadata metadata,
|
File file, {
|
||||||
File file,
|
Metadata? metadata,
|
||||||
String? art,
|
String? art,
|
||||||
) {
|
}) {
|
||||||
final track = SpotubeTrack(
|
final track = SpotubeTrack(
|
||||||
Video(
|
Video(
|
||||||
VideoId("dQw4w9WgXcQ"),
|
VideoId("dQw4w9WgXcQ"),
|
||||||
basenameWithoutExtension(file.path),
|
basenameWithoutExtension(file.path),
|
||||||
metadata.artist ?? "",
|
metadata?.artist ?? "",
|
||||||
ChannelId(
|
ChannelId(
|
||||||
"https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
|
"https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
|
||||||
),
|
),
|
||||||
@ -123,8 +123,8 @@ abstract class TypeConversionUtils {
|
|||||||
"",
|
"",
|
||||||
DateTime.now(),
|
DateTime.now(),
|
||||||
"",
|
"",
|
||||||
Duration(milliseconds: metadata.durationMs?.toInt() ?? 0),
|
Duration(milliseconds: metadata?.durationMs?.toInt() ?? 0),
|
||||||
ThumbnailSet(metadata.title ?? ""),
|
ThumbnailSet(metadata?.title ?? ""),
|
||||||
[],
|
[],
|
||||||
const Engagement(0, 0, 0),
|
const Engagement(0, 0, 0),
|
||||||
false,
|
false,
|
||||||
@ -133,28 +133,28 @@ abstract class TypeConversionUtils {
|
|||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
track.album = Album()
|
track.album = Album()
|
||||||
..name = metadata.album ?? "Spotube"
|
..name = metadata?.album ?? "Spotube"
|
||||||
..images = [if (art != null) Image()..url = art]
|
..images = [if (art != null) Image()..url = art]
|
||||||
..genres = [if (metadata.genre != null) metadata.genre!]
|
..genres = [if (metadata?.genre != null) metadata!.genre!]
|
||||||
..artists = [
|
..artists = [
|
||||||
Artist()
|
Artist()
|
||||||
..name = metadata.albumArtist ?? "Spotube"
|
..name = metadata?.albumArtist ?? "Spotube"
|
||||||
..id = metadata.albumArtist ?? "Spotube"
|
..id = metadata?.albumArtist ?? "Spotube"
|
||||||
..type = "artist",
|
..type = "artist",
|
||||||
]
|
]
|
||||||
..id = metadata.album
|
..id = metadata?.album
|
||||||
..releaseDate = metadata.year?.toString();
|
..releaseDate = metadata?.year?.toString();
|
||||||
track.artists = [
|
track.artists = [
|
||||||
Artist()
|
Artist()
|
||||||
..name = metadata.artist ?? "Spotube"
|
..name = metadata?.artist ?? "Spotube"
|
||||||
..id = metadata.artist ?? "Spotube"
|
..id = metadata?.artist ?? "Spotube"
|
||||||
];
|
];
|
||||||
|
|
||||||
track.id = metadata.title ?? basenameWithoutExtension(file.path);
|
track.id = metadata?.title ?? basenameWithoutExtension(file.path);
|
||||||
track.name = metadata.title ?? basenameWithoutExtension(file.path);
|
track.name = metadata?.title ?? basenameWithoutExtension(file.path);
|
||||||
track.type = "track";
|
track.type = "track";
|
||||||
track.uri = file.path;
|
track.uri = file.path;
|
||||||
track.durationMs = metadata.durationMs?.toInt();
|
track.durationMs = metadata?.durationMs?.toInt();
|
||||||
|
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import audio_service
|
|||||||
import audio_session
|
import audio_session
|
||||||
import audioplayers_darwin
|
import audioplayers_darwin
|
||||||
import bitsdojo_window_macos
|
import bitsdojo_window_macos
|
||||||
import metadata_god
|
|
||||||
import package_info_plus_macos
|
import package_info_plus_macos
|
||||||
import path_provider_macos
|
import path_provider_macos
|
||||||
import shared_preferences_macos
|
import shared_preferences_macos
|
||||||
@ -21,7 +20,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||||
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
|
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
|
||||||
BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin"))
|
BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin"))
|
||||||
MetadataGodPlugin.register(with: registry.registrar(forPlugin: "MetadataGodPlugin"))
|
|
||||||
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
|
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
|
@ -723,7 +723,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: HEAD
|
ref: HEAD
|
||||||
resolved-ref: "4801fcfc690203871b9ee2d3bf1b9c32ce52a7ca"
|
resolved-ref: "7f7e4d8edecc194ca0c7a265f8aa273cd7a22022"
|
||||||
url: "https://github.com/KRTirtho/metadata_god.git"
|
url: "https://github.com/KRTirtho/metadata_god.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 2.3.0+12
|
version: 2.4.0+13
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.0 <3.0.0"
|
sdk: ">=2.17.0 <3.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user