mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 15:35:17 +00:00
fix(web): not building due to metadata_god ffi
chore: update metadata_god and remove win32v3 override
This commit is contained in:
parent
7371cccba6
commit
1191bf232d
3
.gitignore
vendored
3
.gitignore
vendored
@ -32,7 +32,6 @@
|
||||
/build/
|
||||
|
||||
# Web related
|
||||
lib/generated_plugin_registrant.dart
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
@ -75,4 +74,4 @@ dist
|
||||
appimage-build
|
||||
|
||||
android/key.properties
|
||||
.fvm/flutter_sdk
|
||||
.fvm/flutter_sdk
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:metadata_god/metadata_god.dart';
|
||||
@ -35,6 +36,7 @@ const imgMimeToExt = {
|
||||
|
||||
final localTracksProvider = FutureProvider<List<Track>>((ref) async {
|
||||
try {
|
||||
if (kIsWeb) return [];
|
||||
final downloadLocation = ref.watch(
|
||||
userPreferencesProvider.select((s) => s.downloadLocation),
|
||||
);
|
||||
@ -53,7 +55,7 @@ final localTracksProvider = FutureProvider<List<Track>>((ref) async {
|
||||
}).map(
|
||||
(f) async {
|
||||
try {
|
||||
final metadata = await MetadataGod.getMetadata(f);
|
||||
final metadata = await MetadataGod.getMetadata(f.path);
|
||||
|
||||
final imageFile = File(join(
|
||||
(await getTemporaryDirectory()).path,
|
||||
@ -203,6 +205,5 @@ class UserLocalTracks extends HookConsumerWidget {
|
||||
)
|
||||
],
|
||||
);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class UniversalImage extends HookWidget {
|
||||
placeholder: placeholder,
|
||||
cacheKey: path,
|
||||
);
|
||||
} else if (Uri.tryParse(path) != null) {
|
||||
} else if (Uri.tryParse(path) != null && !path.startsWith("assets")) {
|
||||
return Image.file(
|
||||
File(path),
|
||||
width: width,
|
||||
@ -74,7 +74,28 @@ class UniversalImage extends HookWidget {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else if (path.startsWith("assets")) {
|
||||
return Image.asset(
|
||||
path,
|
||||
width: width,
|
||||
height: height,
|
||||
cacheHeight: height?.toInt(),
|
||||
cacheWidth: width?.toInt(),
|
||||
scale: scale,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return placeholder?.call(context, error.toString()) ??
|
||||
Image.asset(
|
||||
"assets/placeholder.png",
|
||||
width: width,
|
||||
height: height,
|
||||
cacheHeight: height?.toInt(),
|
||||
cacheWidth: width?.toInt(),
|
||||
scale: scale,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return Image.memory(
|
||||
base64Decode(path),
|
||||
width: width,
|
||||
|
@ -19,16 +19,18 @@ class _SpotubeLogger extends Logger {
|
||||
|
||||
@override
|
||||
void log(Level level, message, [error, StackTrace? stackTrace]) {
|
||||
(kIsAndroid
|
||||
? getExternalStorageDirectory()
|
||||
: getApplicationDocumentsDirectory())
|
||||
.then((dir) async {
|
||||
final file = File(path.join(dir!.path, ".spotube_logs"));
|
||||
if (level == Level.error) {
|
||||
await file.writeAsString("[${DateTime.now()}]\n$message\n$stackTrace",
|
||||
mode: FileMode.writeOnlyAppend);
|
||||
}
|
||||
});
|
||||
if (!kIsWeb) {
|
||||
(kIsAndroid
|
||||
? getExternalStorageDirectory()
|
||||
: getApplicationDocumentsDirectory())
|
||||
.then((dir) async {
|
||||
final file = File(path.join(dir!.path, ".spotube_logs"));
|
||||
if (level == Level.error) {
|
||||
await file.writeAsString("[${DateTime.now()}]\n$message\n$stackTrace",
|
||||
mode: FileMode.writeOnlyAppend);
|
||||
}
|
||||
});
|
||||
}
|
||||
super.log(level, "[$owner] $message", error, stackTrace);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/widgets.dart' hide Image;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:http/http.dart';
|
||||
import 'package:metadata_god/metadata_god.dart';
|
||||
@ -42,6 +42,7 @@ class Downloader with ChangeNotifier {
|
||||
Playback get _playback => ref.read(playbackProvider);
|
||||
|
||||
void addToQueue(Track baseTrack) async {
|
||||
if (kIsWeb) return;
|
||||
if (inQueue.any((t) => t.id == baseTrack.id!)) return;
|
||||
inQueue.add(baseTrack);
|
||||
currentlyRunning++;
|
||||
@ -103,7 +104,7 @@ class Downloader with ChangeNotifier {
|
||||
final response = await get(Uri.parse(imageUri));
|
||||
|
||||
await MetadataGod.writeMetadata(
|
||||
file,
|
||||
file.path,
|
||||
Metadata(
|
||||
title: track.name,
|
||||
artist: track.artists?.map((a) => a.name).join(", "),
|
||||
|
16
pubspec.lock
16
pubspec.lock
@ -426,12 +426,10 @@ packages:
|
||||
file_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: f9133f6d5dbf33191fc9b58655aebfd15445045a
|
||||
url: "https://github.com/KRTirtho/flutter_file_picker.git"
|
||||
source: git
|
||||
version: "5.0.1"
|
||||
name: file_picker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.2.0"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -726,7 +724,7 @@ packages:
|
||||
name: metadata_god
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
version: "0.2.0"
|
||||
mime:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -796,7 +794,7 @@ packages:
|
||||
name: package_info_plus_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.0"
|
||||
palette_generator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1279,7 +1277,7 @@ packages:
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
win32:
|
||||
dependency: "direct overridden"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
|
12
pubspec.yaml
12
pubspec.yaml
@ -47,21 +47,13 @@ dependencies:
|
||||
path: packages/audioplayers/
|
||||
introduction_screen: ^3.0.2
|
||||
audio_session: ^0.1.10
|
||||
# This is temporary until the win32v3 update PR is merged and released
|
||||
file_picker:
|
||||
git:
|
||||
url: https://github.com/KRTirtho/flutter_file_picker.git
|
||||
file_picker: ^5.2.0
|
||||
popover: ^0.2.6+3
|
||||
queue: ^3.1.0+1
|
||||
auto_size_text: ^3.0.0
|
||||
badges: ^2.0.3
|
||||
mime: ^1.0.2
|
||||
metadata_god: ^0.1.1
|
||||
|
||||
# Temporary before [package_info_plus_windows] is updated to support
|
||||
# win32v3
|
||||
dependency_overrides:
|
||||
win32: 3.0.0
|
||||
metadata_god: ^0.2.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
Reference in New Issue
Block a user