🐛 Fixes

This commit is contained in:
LittleSheep 2024-09-06 13:26:20 +08:00
parent 2cee7ee958
commit 463cb9870f
4 changed files with 11 additions and 13 deletions

View File

@ -311,10 +311,9 @@ class _PlayerScreenState extends State<PlayerScreen> {
const Gap(20),
SizedBox(
height: 40,
child: Wrap(
alignment: WrapAlignment.center,
spacing: 4,
runSpacing: 4,
child: ListView(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
children: [
TextButton.icon(
icon: const Icon(Icons.queue_music),

View File

@ -1,5 +1,6 @@
import 'package:collection/collection.dart';
import 'package:get/get.dart';
import 'package:rhythm_box/providers/error_notifier.dart';
import 'package:rhythm_box/providers/user_preferences.dart';
import 'package:rhythm_box/services/database/database.dart';
import 'package:rhythm_box/services/sourced_track/sources/netease.dart';
@ -107,7 +108,9 @@ abstract class SourcedTrack extends Track {
await PipedSourcedTrack.fetchFromTrack(track: track),
_ => await YoutubeSourcedTrack.fetchFromTrack(track: track),
};
} on TrackNotFoundError catch (_) {
} on TrackNotFoundError catch (err) {
Get.find<ErrorNotifier>()
.showError('${err.toString()} via ${preferences.audioSource.label}');
return switch (preferences.audioSource) {
AudioSource.piped ||
AudioSource.youtube =>

View File

@ -47,7 +47,7 @@ class NeteaseSourcedTrack extends SourcedTrack {
client.baseUrl = getBaseUrl();
client.httpClient.addRequestModifier((Request request) async {
final AuthenticationProvider auth = Get.find();
if (auth.auth.value!.neteaseCookie != null) {
if (auth.auth.value?.neteaseCookie != null) {
final cookie =
'MUSIC_U=${auth.auth.value!.getNeteaseCookie('MUSIC_U')}';
if (request.headers['Cookie'] == null) {
@ -87,17 +87,12 @@ class NeteaseSourcedTrack extends SourcedTrack {
.get()
.then((s) => s.firstOrNull);
if (cachedSource == null) {
if (cachedSource == null || cachedSource.sourceType != SourceType.netease) {
final siblings = await fetchSiblings(track: track);
if (siblings.isEmpty) {
throw TrackNotFoundError(track);
}
final client = getClient();
final checkResp =
await client.get('/check/music?id=${siblings.first.info.id}');
if (checkResp.body['success'] != true) throw TrackNotFoundError(track);
await db.database.into(db.database.sourceMatchTable).insert(
SourceMatchTableCompanion.insert(
trackId: track.id!,
@ -116,6 +111,7 @@ class NeteaseSourcedTrack extends SourcedTrack {
final client = getClient();
final resp = await client.get('/song/detail?ids=${cachedSource.sourceId}');
print(resp.body);
final item = resp.body['songs'][0];
return NeteaseSourcedTrack(

View File

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+9
version: 1.0.0+10
environment:
sdk: ^3.5.0