mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-22 09:04:32 +01:00
Metadata TrackNumber Inclusion when Available
This commit is contained in:
parent
f323021bac
commit
67a07dba49
@ -30,6 +30,7 @@ data class TrackDetails(
|
||||
var albumName: String? = null,
|
||||
var albumArtists: List<String> = emptyList(),
|
||||
var genre: List<String> = emptyList(),
|
||||
var trackNumber: Int? = null,
|
||||
var year: String? = null,
|
||||
var comment: String? = null,
|
||||
var lyrics: String? = null,
|
||||
|
@ -40,6 +40,8 @@ fun Mp3File.setId3v1Tags(track: TrackDetails): Mp3File {
|
||||
album = track.albumName
|
||||
year = track.year
|
||||
comment = "Genres:${track.comment}"
|
||||
if(track.trackNumber != null)
|
||||
this.track = track.trackNumber.toString()
|
||||
}
|
||||
this.id3v1Tag = id3v1Tag
|
||||
return this
|
||||
@ -53,10 +55,13 @@ suspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails) {
|
||||
title = track.title
|
||||
album = track.albumName
|
||||
year = track.year
|
||||
|
||||
genreDescription = "Genre: " + track.genre.joinToString(", ")
|
||||
comment = track.comment
|
||||
lyrics = track.lyrics ?: ""
|
||||
url = track.trackUrl
|
||||
if(track.trackNumber != null)
|
||||
this.track = track.trackNumber.toString()
|
||||
}
|
||||
try {
|
||||
val art = File(track.albumArtPath)
|
||||
|
@ -200,6 +200,7 @@ class SpotifyProvider(
|
||||
private fun List<Track>.toTrackDetailsList(type: String, subFolder: String) = this.map {
|
||||
TrackDetails(
|
||||
title = it.name.toString(),
|
||||
trackNumber = it.track_number,
|
||||
genre = it.album?.genres?.filterNotNull() ?: emptyList(),
|
||||
artists = it.artists?.map { artist -> artist?.name.toString() } ?: listOf(),
|
||||
albumArtists = it.album?.artists?.mapNotNull { artist -> artist?.name } ?: emptyList(),
|
||||
|
Loading…
Reference in New Issue
Block a user