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 albumName: String? = null,
|
||||||
var albumArtists: List<String> = emptyList(),
|
var albumArtists: List<String> = emptyList(),
|
||||||
var genre: List<String> = emptyList(),
|
var genre: List<String> = emptyList(),
|
||||||
|
var trackNumber: Int? = null,
|
||||||
var year: String? = null,
|
var year: String? = null,
|
||||||
var comment: String? = null,
|
var comment: String? = null,
|
||||||
var lyrics: String? = null,
|
var lyrics: String? = null,
|
||||||
|
@ -40,6 +40,8 @@ fun Mp3File.setId3v1Tags(track: TrackDetails): Mp3File {
|
|||||||
album = track.albumName
|
album = track.albumName
|
||||||
year = track.year
|
year = track.year
|
||||||
comment = "Genres:${track.comment}"
|
comment = "Genres:${track.comment}"
|
||||||
|
if(track.trackNumber != null)
|
||||||
|
this.track = track.trackNumber.toString()
|
||||||
}
|
}
|
||||||
this.id3v1Tag = id3v1Tag
|
this.id3v1Tag = id3v1Tag
|
||||||
return this
|
return this
|
||||||
@ -53,10 +55,13 @@ suspend fun Mp3File.setId3v2TagsAndSaveFile(track: TrackDetails) {
|
|||||||
title = track.title
|
title = track.title
|
||||||
album = track.albumName
|
album = track.albumName
|
||||||
year = track.year
|
year = track.year
|
||||||
|
|
||||||
genreDescription = "Genre: " + track.genre.joinToString(", ")
|
genreDescription = "Genre: " + track.genre.joinToString(", ")
|
||||||
comment = track.comment
|
comment = track.comment
|
||||||
lyrics = track.lyrics ?: ""
|
lyrics = track.lyrics ?: ""
|
||||||
url = track.trackUrl
|
url = track.trackUrl
|
||||||
|
if(track.trackNumber != null)
|
||||||
|
this.track = track.trackNumber.toString()
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
val art = File(track.albumArtPath)
|
val art = File(track.albumArtPath)
|
||||||
|
@ -200,6 +200,7 @@ class SpotifyProvider(
|
|||||||
private fun List<Track>.toTrackDetailsList(type: String, subFolder: String) = this.map {
|
private fun List<Track>.toTrackDetailsList(type: String, subFolder: String) = this.map {
|
||||||
TrackDetails(
|
TrackDetails(
|
||||||
title = it.name.toString(),
|
title = it.name.toString(),
|
||||||
|
trackNumber = it.track_number,
|
||||||
genre = it.album?.genres?.filterNotNull() ?: emptyList(),
|
genre = it.album?.genres?.filterNotNull() ?: emptyList(),
|
||||||
artists = it.artists?.map { artist -> artist?.name.toString() } ?: listOf(),
|
artists = it.artists?.map { artist -> artist?.name.toString() } ?: listOf(),
|
||||||
albumArtists = it.album?.artists?.mapNotNull { artist -> artist?.name } ?: emptyList(),
|
albumArtists = it.album?.artists?.mapNotNull { artist -> artist?.name } ?: emptyList(),
|
||||||
|
Loading…
Reference in New Issue
Block a user