🐛 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), const Gap(20),
SizedBox( SizedBox(
height: 40, height: 40,
child: Wrap( child: ListView(
alignment: WrapAlignment.center, scrollDirection: Axis.horizontal,
spacing: 4, shrinkWrap: true,
runSpacing: 4,
children: [ children: [
TextButton.icon( TextButton.icon(
icon: const Icon(Icons.queue_music), icon: const Icon(Icons.queue_music),

View File

@ -1,5 +1,6 @@
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:get/get.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/providers/user_preferences.dart';
import 'package:rhythm_box/services/database/database.dart'; import 'package:rhythm_box/services/database/database.dart';
import 'package:rhythm_box/services/sourced_track/sources/netease.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 PipedSourcedTrack.fetchFromTrack(track: track),
_ => await YoutubeSourcedTrack.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) { return switch (preferences.audioSource) {
AudioSource.piped || AudioSource.piped ||
AudioSource.youtube => AudioSource.youtube =>

View File

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