From 463cb9870f4da877fefa578eb219b0360d3eba17 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Fri, 6 Sep 2024 13:26:20 +0800 Subject: [PATCH] :bug: Fixes --- lib/screens/player/view.dart | 7 +++---- lib/services/sourced_track/sourced_track.dart | 5 ++++- lib/services/sourced_track/sources/netease.dart | 10 +++------- pubspec.yaml | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/screens/player/view.dart b/lib/screens/player/view.dart index 2595299..a4ce4d1 100644 --- a/lib/screens/player/view.dart +++ b/lib/screens/player/view.dart @@ -311,10 +311,9 @@ class _PlayerScreenState extends State { 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), diff --git a/lib/services/sourced_track/sourced_track.dart b/lib/services/sourced_track/sourced_track.dart index 1cf6a1c..211e785 100755 --- a/lib/services/sourced_track/sourced_track.dart +++ b/lib/services/sourced_track/sourced_track.dart @@ -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() + .showError('${err.toString()} via ${preferences.audioSource.label}'); return switch (preferences.audioSource) { AudioSource.piped || AudioSource.youtube => diff --git a/lib/services/sourced_track/sources/netease.dart b/lib/services/sourced_track/sources/netease.dart index d5f654e..c319bd4 100755 --- a/lib/services/sourced_track/sources/netease.dart +++ b/lib/services/sourced_track/sources/netease.dart @@ -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( diff --git a/pubspec.yaml b/pubspec.yaml index 402d8a3..0d72279 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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