Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import com.theveloper.pixelplay.data.database.NeteasePlaylistEntity
import com.theveloper.pixelplay.data.database.NeteaseSongEntity
import com.theveloper.pixelplay.data.database.SongArtistCrossRef
import com.theveloper.pixelplay.data.database.SongEntity
import com.theveloper.pixelplay.data.database.SourceType
import com.theveloper.pixelplay.data.database.serializeArtistRefs
import com.theveloper.pixelplay.data.database.toSong
import com.theveloper.pixelplay.data.model.ArtistRef
import com.theveloper.pixelplay.data.model.Song
import com.theveloper.pixelplay.data.network.netease.NeteaseApiService
import com.theveloper.pixelplay.data.preferences.PlaylistPreferencesRepository
Expand Down Expand Up @@ -486,7 +489,7 @@ class NeteaseRepository @Inject constructor(

// ─── Song URL Resolution ───────────────────────────────────────────

suspend fun getSongUrl(songId: Long, quality: String = "exhigh"): Result<String> {
suspend fun getSongUrl(songId: Long, quality: String = "lossless"): Result<String> {
val now = System.currentTimeMillis()
val lastAttempt = lastSongUrlAttemptAtMs[songId]
if (lastAttempt != null && now - lastAttempt < songUrlRequestCooldownMs) {
Expand All @@ -507,7 +510,9 @@ class NeteaseRepository @Inject constructor(

val result = withContext(Dispatchers.IO) {
runCatching {
val qualityFallbacks = linkedSetOf(quality, "higher", "standard")
// Try the requested level first (e.g. "lossless" for SVIP accounts),
// then degrade gracefully so non-privileged accounts still resolve a URL.
val qualityFallbacks = linkedSetOf(quality, "exhigh", "higher", "standard")
var lastFailure: String? = null

for (level in qualityFallbacks) {
Expand Down Expand Up @@ -685,6 +690,14 @@ class NeteaseRepository @Inject constructor(
)
}

val neteaseArtistRefs = artistNames.mapIndexed { index, artistName ->
ArtistRef(
id = toUnifiedArtistId(artistName),
name = artistName,
isPrimary = index == 0
)
}

val albumId = toUnifiedAlbumId(neteaseSong.albumId, neteaseSong.album)
val albumName = neteaseSong.album.ifBlank { "Unknown Album" }
albums.putIfAbsent(
Expand Down Expand Up @@ -725,7 +738,9 @@ class NeteaseRepository @Inject constructor(
bitrate = neteaseSong.bitrate,
sampleRate = null,
telegramChatId = null,
telegramFileId = null
telegramFileId = null,
artistsJson = serializeArtistRefs(neteaseArtistRefs),
sourceType = SourceType.NETEASE
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,10 @@ fun FullPlayerContent(
onDismissLyricsSearch = { playerViewModel.resetLyricsSearchState() },
lyricsSyncOffset = lyricsSyncOffset,
onLyricsSyncOffsetChange = { currentSong?.id?.let { songId -> playerViewModel.setLyricsSyncOffset(songId, it) } },
lyricsTextStyle = MaterialTheme.typography.titleLarge,
// Use the platform default font (fontFamily = null) for lyrics so extended
// Unicode glyphs (e.g. Icelandic æ ð þ) render instead of tofu. The bundled
// Google Sans Rounded variable font drops these codepoints at runtime. (#2427)
lyricsTextStyle = MaterialTheme.typography.titleLarge.copy(fontFamily = null),
colorScheme = LocalMaterialTheme.current,
onBackClick = { showLyricsSheet = false },
onSaveLyricsToFile = playerViewModel::saveLyricsToFile,
Expand Down
Loading