@@ -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,
|
||||
|
||||
@@ -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)
|
||||
26
app/src/main/kotlin/it/vfsfitvnm/vimusic/models/Format.kt
Normal file
26
app/src/main/kotlin/it/vfsfitvnm/vimusic/models/Format.kt
Normal 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
|
||||
)
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user