src/bbc_meet_spotify/spotify.py
def create_playlist(self, playlist_name: str, add_date_prefix: bool = True, public_playlist: bool = True) -> str:
        """
        Creates playlist if it doesn't already exist, otherwise get the playlist id
        :param playlist_name: name for the playlist
        :param add_date_prefix: if true, add ISO date
        :param public_playlist: if true, make the playlist public
        :return: the playlist id
        """
        if add_date_prefix:
            playlist_name = f"{time.strftime('%Y-%m-%d')}_{playlist_name}"
        current_playlists = self.spotify.user_playlists(self.username)

        playlist = {}
        for current_playlist in current_playlists["items"]:
            if playlist_name == current_playlist["name"]:
                playlist["id"] = current_playlist["id"]
                logger.info(f"Playlist '{playlist_name}' already exists, reusing playlist")

        if not playlist:
            logger.info(f"Creating playlist '{playlist_name}' for user '{self.username}'")
            playlist = self.spotify.user_playlist_create(self.username, playlist_name, public=public_playlist)

        return playlist["id"]

        Creates playlist if it doesn't already exist, otherwise get the playlist id
        :param playlist_name: name for the playlist
        :param add_date_prefix: if true, add ISO date
        :param public_playlist: if true, make the playlist public
        :return: the playlist id
        
Creates playlist if it doesn't already exist, otherwise get the playlist id
Creates playlist if it doesn ' t already exist otherwise get the playlist id
def create_playlist(self, playlist_name: str, add_date_prefix: bool = True, public_playlist: bool = True) -> str:
        if add_date_prefix:
            playlist_name = f"{time.strftime('%Y-%m-%d')}_{playlist_name}"
        current_playlists = self.spotify.user_playlists(self.username)
        playlist = {}
        for current_playlist in current_playlists["items"]:
            if playlist_name == current_playlist["name"]:
                playlist["id"] = current_playlist["id"]
                logger.info(f"Playlist '{playlist_name}' already exists, reusing playlist")
        if not playlist:
            logger.info(f"Creating playlist '{playlist_name}' for user '{self.username}'")
            playlist = self.spotify.user_playlist_create(self.username, playlist_name, public=public_playlist)
        return playlist["id"]
def create_playlist ( self , playlist_name : str , add_date_prefix : bool = True , public_playlist : bool = True ) -> str : if add_date_prefix : playlist_name = f"{time.strftime('%Y-%m-%d')}_{playlist_name}" current_playlists = self . spotify . user_playlists ( self . username ) playlist = { } for current_playlist in current_playlists [ "items" ] : if playlist_name == current_playlist [ "name" ] : playlist [ "id" ] = current_playlist [ "id" ] logger . info ( f"Playlist '{playlist_name}' already exists, reusing playlist" ) if not playlist : logger . info ( f"Creating playlist '{playlist_name}' for user '{self.username}'" ) playlist = self . spotify . user_playlist_create ( self . username , playlist_name , public = public_playlist ) return playlist [ "id" ]
Creates playlist if it doesn't already exist, otherwise get the playlist id
Creates playlist if it doesn ' t already exist otherwise get the playlist id
"""
        Creates playlist if it doesn't already exist, otherwise get the playlist id
        :param playlist_name: name for the playlist
        :param add_date_prefix: if true, add ISO date
        :param public_playlist: if true, make the playlist public
        :return: the playlist id
        """
the playlist id
the playlist id
self
playlist_name
str
name for the playlist
name for the playlist
add_date_prefix
bool
if true, add ISO date
if true add ISO date
public_playlist
bool
if true, make the playlist public
if true make the playlist public