通知中心封面图显示
部分界面的信息更新 缓存系统初步引入 即将进入播放列表更新
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// lib/metadata/metadata_service.dart
|
||||
import 'dart:io'; // ⭐ 添加这一行
|
||||
import 'dart:typed_data'; // ⭐ 如果已经有更好
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../database/song_database.dart';
|
||||
import 'metadata_model.dart';
|
||||
@@ -32,6 +32,17 @@ class MetadataService {
|
||||
return LocalFileProvider();
|
||||
}
|
||||
|
||||
/// 公开给 AudioService 使用(用于清除缓存时获取文件)
|
||||
FileProvider getProviderForUrl(String url) {
|
||||
return _getProvider(url);
|
||||
}
|
||||
|
||||
/// 清除内存缓存
|
||||
Future<void> clearCache(String fileId) async {
|
||||
await _memoryCache.remove(fileId);
|
||||
debugPrint('🗑️ [MetadataService] memory cache cleared: $fileId');
|
||||
}
|
||||
|
||||
Future<FinalMetadata> getMetadata({
|
||||
required String url,
|
||||
required String fileName,
|
||||
@@ -111,6 +122,8 @@ class MetadataService {
|
||||
final history = await _db.getSongsByArtist(normalized.artist, limit: 10);
|
||||
final candidate = _normalizer.evaluate(normalized, history);
|
||||
final finalMetadata = _normalizer.decide(candidate);
|
||||
debugPrint(
|
||||
'📢 [MetadataService] finalMetadata.artwork is ${finalMetadata.artwork != null ? 'not null (${finalMetadata.artwork!.length} bytes)' : 'null'}');
|
||||
|
||||
// 7. 保存封面图到本地
|
||||
String? artworkPath;
|
||||
|
||||
Reference in New Issue
Block a user