music.db

Module contents

Database interfacing components aside from the music.model ORM layer

db.database

class music.db.database.DatabaseUser(client_id: str, client_secret: str, access_token: Optional[str] = None, refresh_token: Optional[str] = None, user_id: Optional[str] = None)

Bases: NetworkUser

Adding Mixonomer username to spotframework network user

user_id: str = None
music.db.database.get_authed_lastfm_network(user: User) Optional[Network]

Get an authenticated fmframework network for a given user

Parameters:

user (User) – Subject user to retrieve a network for

Returns:

Authenticated fmframework network

Return type:

Optional[FmNetwork]

music.db.database.get_authed_spotify_network(user: User) Optional[Network]

Get an authenticated spotframework network for a given user

Parameters:

user (User) – Subject user to retrieve a network for

Returns:

Authenticated spotframework network

Return type:

Optional[SpotifyNetwork]

music.db.database.refresh_token_database_callback(user: User) None

Callback for handling when a spotframework network updates user credemtials

Used to store newly authenticated credentials

Parameters:

user (User) – Subject user

db.part_generator

class music.db.part_generator.PartGenerator(user: Optional[User] = None, username: Optional[str] = None)

Bases: object

Resolve a playlists components from other referenced smart playlists

get_recursive_parts(name: str) List[str]

Resolve and return a playlist’s component Spotify playlist names

Parameters:

name (str) – Subject smart playlist name

Returns:

Resolved list of component playlists

Return type:

List[str]

process_reference_by_name(name: str) None

Resolve a smart playlist by name, recurses into process_reference_by_reference

Parameters:

name (str) – Subject playlist name

process_reference_by_reference(ref: DocumentReference)

Recursive resolution function for walking a playlist’s dependencies by DocumentReference

Parameters:

ref (DocumentReference) – Subject Firestore document for resolving

reset()

Reset internal state for resolved playlists