mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix(macos): crashing on startup
This issue was caused metadata_god which was incorrectly loading dynamic library
This commit is contained in:
parent
17d19e9584
commit
c46b4284b1
3
.env.example
Normal file
3
.env.example
Normal file
@ -0,0 +1,3 @@
|
||||
POCKETBASE_URL=
|
||||
USERNAME=
|
||||
PASSWORD=
|
@ -77,18 +77,18 @@ final localTracksProvider = FutureProvider<List<LocalTrack>>((ref) async {
|
||||
}).map(
|
||||
(f) async {
|
||||
try {
|
||||
final metadata = await MetadataGod.getMetadata(f.path);
|
||||
final metadata = await MetadataGod.readMetadata(file: f.path);
|
||||
|
||||
final imageFile = File(join(
|
||||
(await getTemporaryDirectory()).path,
|
||||
"spotube",
|
||||
basenameWithoutExtension(f.path) +
|
||||
imgMimeToExt[metadata?.picture?.mimeType ?? "image/jpeg"]!,
|
||||
imgMimeToExt[metadata.picture?.mimeType ?? "image/jpeg"]!,
|
||||
));
|
||||
if (!await imageFile.exists() && metadata?.picture != null) {
|
||||
if (!await imageFile.exists() && metadata.picture != null) {
|
||||
await imageFile.create(recursive: true);
|
||||
await imageFile.writeAsBytes(
|
||||
metadata?.picture?.data ?? [],
|
||||
metadata.picture?.data ?? [],
|
||||
mode: FileMode.writeOnly,
|
||||
);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:metadata_god/metadata_god.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:platform_ui/platform_ui.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@ -68,6 +69,7 @@ void main(List<String> rawArgs) async {
|
||||
}
|
||||
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
MetadataGod.initialize();
|
||||
await QueryClient.initialize(cachePrefix: "oss.krtirtho.spotube");
|
||||
Hive.registerAdapter(CacheTrackAdapter());
|
||||
Hive.registerAdapter(CacheTrackEngagementAdapter());
|
||||
|
@ -108,8 +108,8 @@ class Downloader with ChangeNotifier {
|
||||
final response = await get(Uri.parse(imageUri));
|
||||
|
||||
await MetadataGod.writeMetadata(
|
||||
file.path,
|
||||
Metadata(
|
||||
file: file.path,
|
||||
metadata: Metadata(
|
||||
title: track.name,
|
||||
artist: track.artists?.map((a) => a.name).join(", "),
|
||||
album: track.album?.name,
|
||||
@ -123,7 +123,7 @@ class Downloader with ChangeNotifier {
|
||||
fileSize: file.lengthSync(),
|
||||
trackTotal: track.album?.tracks?.length,
|
||||
picture: response.headers['content-type'] != null
|
||||
? Image(
|
||||
? Picture(
|
||||
data: response.bodyBytes,
|
||||
mimeType: response.headers['content-type']!,
|
||||
)
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <audioplayers_linux/audioplayers_linux_plugin.h>
|
||||
#include <catcher/catcher_plugin.h>
|
||||
#include <metadata_god/metadata_god_plugin.h>
|
||||
#include <screen_retriever/screen_retriever_plugin.h>
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
#include <window_manager/window_manager_plugin.h>
|
||||
@ -21,9 +20,6 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) catcher_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "CatcherPlugin");
|
||||
catcher_plugin_register_with_registrar(catcher_registrar);
|
||||
g_autoptr(FlPluginRegistrar) metadata_god_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "MetadataGodPlugin");
|
||||
metadata_god_plugin_register_with_registrar(metadata_god_registrar);
|
||||
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
|
||||
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
|
||||
|
@ -5,7 +5,6 @@
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
audioplayers_linux
|
||||
catcher
|
||||
metadata_god
|
||||
screen_retriever
|
||||
url_launcher_linux
|
||||
window_manager
|
||||
@ -13,6 +12,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
metadata_god
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
@ -11,7 +11,6 @@ import audioplayers_darwin
|
||||
import catcher
|
||||
import device_info_plus
|
||||
import macos_ui
|
||||
import metadata_god
|
||||
import package_info_plus
|
||||
import path_provider_foundation
|
||||
import screen_retriever
|
||||
@ -28,7 +27,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
CatcherPlugin.register(with: registry.registrar(forPlugin: "CatcherPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin"))
|
||||
MetadataGodPlugin.register(with: registry.registrar(forPlugin: "MetadataGodPlugin"))
|
||||
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
|
||||
|
10
pubspec.lock
10
pubspec.lock
@ -704,10 +704,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_rust_bridge
|
||||
sha256: aedbf045f72c7ed778d1cfc8bff0ceae28519d258e3f477abd70ce375ae8cdda
|
||||
sha256: "34f5becca2df35955b2ec5e875349028ea609a826de7aade4de80534cf876b27"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.62.1"
|
||||
version: "1.72.1"
|
||||
flutter_svg:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1002,10 +1002,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: metadata_god
|
||||
sha256: a2a54285d363f15baa261abc16eb5f1b95397c7838a29c9c98d2a684e6fe052c
|
||||
sha256: "02de939fc2dcfdc959ed34768eecc97038b6e95ebaa3415f9f7582d71a2ad047"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.2"
|
||||
version: "0.4.1"
|
||||
mime:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1807,5 +1807,5 @@ packages:
|
||||
source: hosted
|
||||
version: "1.12.3"
|
||||
sdks:
|
||||
dart: ">=2.19.0 <3.0.0"
|
||||
dart: ">=2.19.2 <3.0.0"
|
||||
flutter: ">=3.7.0"
|
||||
|
@ -52,7 +52,7 @@ dependencies:
|
||||
logger: ^1.1.0
|
||||
macos_ui: ^1.9.0
|
||||
marquee: ^2.2.3
|
||||
metadata_god: ^0.3.2
|
||||
metadata_god: ^0.4.1
|
||||
mime: ^1.0.2
|
||||
package_info_plus: ^3.0.2
|
||||
palette_generator: ^0.3.3
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <audioplayers_windows/audioplayers_windows_plugin.h>
|
||||
#include <catcher/catcher_plugin.h>
|
||||
#include <metadata_god/metadata_god_plugin_c_api.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <screen_retriever/screen_retriever_plugin.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
@ -20,8 +19,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin"));
|
||||
CatcherPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("CatcherPlugin"));
|
||||
MetadataGodPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("MetadataGodPluginCApi"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||
ScreenRetrieverPluginRegisterWithRegistrar(
|
||||
|
@ -5,7 +5,6 @@
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
audioplayers_windows
|
||||
catcher
|
||||
metadata_god
|
||||
permission_handler_windows
|
||||
screen_retriever
|
||||
url_launcher_windows
|
||||
@ -14,6 +13,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
metadata_god
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
Loading…
Reference in New Issue
Block a user