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:
spotframework.net.user.NetworkUser
Adding Music Tools username to spotframework network user
-
user_id
: str = None¶
-
-
music.db.database.
get_authed_lastfm_network
(user: music.model.user.User) → Optional[fmframework.net.network.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: music.model.user.User) → Optional[spotframework.net.network.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: music.model.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[music.model.user.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: google.cloud.firestore_v1.document.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
-