This commit is contained in:
vfsfitvnm
2022-07-18 13:29:44 +02:00
parent 06b4fcdc63
commit 61eeeb07c0
13 changed files with 1355 additions and 55 deletions

View File

@@ -5,7 +5,7 @@ import androidx.room.Junction
import androidx.room.Relation
data class DetailedSong(
open class DetailedSong(
@Embedded val song: Song,
@Relation(
entity = SongAlbumMap::class,

View File

@@ -0,0 +1,17 @@
package it.vfsfitvnm.vimusic.models
import androidx.room.Relation
class DetailedSongWithContentLength(
song: Song,
albumId: String?,
artists: List<Artist>?,
@Relation(
entity = Format::class,
entityColumn = "songId",
parentColumn = "id",
projection = ["contentLength"]
)
val contentLength: Long?
) : DetailedSong(song, albumId, artists)

View File

@@ -0,0 +1,26 @@
package it.vfsfitvnm.vimusic.models
import androidx.compose.runtime.Immutable
import androidx.room.*
@Immutable
@Entity(
foreignKeys = [
ForeignKey(
entity = Song::class,
parentColumns = ["id"],
childColumns = ["songId"],
onDelete = ForeignKey.CASCADE
)
]
)
data class Format(
@PrimaryKey val songId: String,
val itag: Int? = null,
val mimeType: String? = null,
val bitrate: Long? = null,
val contentLength: Long? = null,
val lastModified: Long? = null,
val loudnessDb: Float? = null
)

View File

@@ -12,9 +12,7 @@ data class Song(
val thumbnailUrl: String?,
val lyrics: String? = null,
val likedAt: Long? = null,
val totalPlayTimeMs: Long = 0,
val loudnessDb: Float? = null,
val contentLength: Long? = null,
val totalPlayTimeMs: Long = 0
) {
val formattedTotalPlayTime: String
get() {