Skip to main content

Overview

Deeztracker Mobile supports two types of playlists:
  1. Deezer Playlist - Playlists from the Deezer API with rich metadata
  2. Local Playlist - User-created playlists stored locally on the device

Deezer Playlist Model

Defined in app/src/main/java/com/crowstar/deeztrackermobile/features/deezer/DeezerModels.kt The Deezer Playlist model represents playlists fetched from the Deezer API.

Properties

id
Long
required
Unique identifier for the Deezer playlist
title
String
required
Title of the playlist
description
String?
Optional description of the playlist
duration
Int?
Total duration of all tracks in the playlist (in seconds)
public
Boolean?
Whether the playlist is public or private
isLovedTrack
Boolean?
Indicates if this is a “Loved Tracks” playlist (serialized as is_loved_track)
collaborative
Boolean?
Whether the playlist is collaborative
nbTracks
Int?
Number of tracks in the playlist (serialized as nb_tracks)
fans
Int?
Number of fans/followers of the playlist
URL link to the playlist on Deezer
share
String?
Shareable URL for the playlist
picture
String?
URL to the playlist cover image (default size)
pictureSmall
String?
URL to the small playlist cover image (serialized as picture_small)
pictureMedium
String?
URL to the medium playlist cover image (serialized as picture_medium)
pictureBig
String?
URL to the large playlist cover image (serialized as picture_big)
pictureXl
String?
URL to the extra-large playlist cover image (serialized as picture_xl)
checksum
String?
Checksum value for the playlist
tracklist
String?
API endpoint URL to fetch the playlist’s tracks
creationDate
String?
Date when the playlist was created (serialized as creation_date)
creator
UserMini?
User object representing the creator of the playlist
type
String?
Type identifier (typically “playlist”)
tracks
TrackListResponse?
Response object containing the list of tracks in the playlist

Local Playlist Model

Defined in app/src/main/java/com/crowstar/deeztrackermobile/features/localmusic/LocalPlaylist.kt The LocalPlaylist model represents user-created playlists stored locally on the device.

Properties

id
String
default:"UUID.randomUUID().toString()"
Unique identifier for the local playlist. Automatically generated as a UUID if not provided.
name
String
required
Name of the playlist
trackIds
List<Long>
default:"emptyList()"
List of Deezer track IDs contained in the playlist. Defaults to an empty list.

Example Usage

Deezer Playlist Example

import com.crowstar.deeztrackermobile.features.deezer.Playlist
import com.crowstar.deeztrackermobile.features.deezer.UserMini

val deezerPlaylist = Playlist(
    id = 123456789L,
    title = "Top Hits 2024",
    description = "The best hits of 2024",
    duration = 7200, // 2 hours in seconds
    public = true,
    isLovedTrack = false,
    collaborative = false,
    nbTracks = 50,
    fans = 125000,
    link = "https://www.deezer.com/playlist/123456789",
    picture = "https://api.deezer.com/playlist/123456789/image",
    pictureMedium = "https://e-cdns-images.dzcdn.net/images/playlist/medium.jpg",
    creationDate = "2024-01-01",
    creator = UserMini(
        id = 987654321L,
        name = "DJ Music Lover"
    ),
    type = "playlist"
)

Local Playlist Example

import com.crowstar.deeztrackermobile.features.localmusic.LocalPlaylist

// Create a new empty playlist
val newPlaylist = LocalPlaylist(
    name = "My Favorites"
)
// id is auto-generated, trackIds defaults to emptyList()

// Create a playlist with tracks
val playlistWithTracks = LocalPlaylist(
    id = "custom-id-123",
    name = "Workout Mix",
    trackIds = listOf(111111L, 222222L, 333333L, 444444L)
)

Adding Tracks to Local Playlist

val playlist = LocalPlaylist(
    name = "Chill Vibes",
    trackIds = listOf(123L, 456L)
)

// Add a new track
val updatedPlaylist = playlist.copy(
    trackIds = playlist.trackIds + 789L
)

// Remove a track
val playlistWithoutTrack = playlist.copy(
    trackIds = playlist.trackIds.filter { it != 456L }
)

Source Code

Deezer Playlist

data class Playlist(
    val id: Long,
    val title: String,
    val description: String? = null,
    val duration: Int? = null,
    val public: Boolean? = null,
    @SerializedName("is_loved_track") val isLovedTrack: Boolean? = null,
    val collaborative: Boolean? = null,
    @SerializedName("nb_tracks") val nbTracks: Int? = null,
    val fans: Int? = null,
    val link: String? = null,
    val share: String? = null,
    val picture: String? = null,
    @SerializedName("picture_small") val pictureSmall: String? = null,
    @SerializedName("picture_medium") val pictureMedium: String? = null,
    @SerializedName("picture_big") val pictureBig: String? = null,
    @SerializedName("picture_xl") val pictureXl: String? = null,
    @SerializedName("checksum") val checksum: String? = null,
    val tracklist: String? = null,
    @SerializedName("creation_date") val creationDate: String? = null,
    @SerializedName("creator") val creator: UserMini? = null,
    val type: String? = null,
    val tracks: TrackListResponse? = null
)

Local Playlist

data class LocalPlaylist(
    val id: String = java.util.UUID.randomUUID().toString(),
    val name: String,
    val trackIds: List<Long> = emptyList()
)

Differences Between Playlist Types

FeatureDeezer PlaylistLocal Playlist
ID TypeLongString (UUID)
Track StorageFull Track objects via APITrack IDs only
MetadataRich (description, fans, creator)Minimal (name only)
ImagesMultiple sizes availableNone
SourceDeezer APILocal storage
MutabilityRead-only from APIFully editable by user
  • Track - Track model referenced by playlists
  • Album - Album model, another way to organize tracks

Build docs developers (and LLMs) love