Beispiel #1
0
    def get_best_result(self, api_result) -> list:
        name = api_result['query']

        if self.is_search:
            logger.debug("Waiting for user input...")
            prompt = self.prompt_search(name, api_result['results'])
            if prompt:
                logger.debug(f"User selected {prompt}")
                return [prompt]

        matches = [r for r in api_result['results'] if r['name'].lower() == name.lower()]
        self.debugger("Matches", matches)

        if len(matches) == 1:
            return [matches[0]]
        elif len(matches) > 1:
            logger.debug(f"Multiple matches were found for artist \"{api_result['query']}\"")
            if config.prompt_duplicates():
                logger.debug("Waiting for user input...")
                prompt = self.prompt_search(name, matches)
                if prompt:
                    logger.debug(f"User selected {prompt}")
                    return [prompt]
                else:
                    logger.info(f"No selection made, skipping {name}...")
                    return []
            else:
                self.duplicates += 1
                return [matches[0]]
        elif not len(matches):
            logger.debug(f"   [!] No matches were found for artist \"{api_result['query']}\"")
            if config.prompt_no_matches() and len(api_result['results']):
                logger.debug("Waiting for user input...")
                prompt = self.prompt_search(name, api_result['results'])
                if prompt:
                    logger.debug(f"User selected {prompt}")
                    return [prompt]
                else:
                    logger.info(f"No selection made, skipping {name}...")
                    return []
            else:
                logger.info(f"   [!] Artist {name} not found")
                return []
Beispiel #2
0
 def get_specified_artist(self, artist):
     values = {'artist': artist, 'profile_id': config.profile_id()}
     if type(artist) is int:
         return self.query(
             "SELECT * FROM monitor WHERE artist_id = :artist "
             "AND profile_id = :profile_id", values).fetchone()
     else:
         return self.query(
             "SELECT * FROM monitor WHERE artist_name = ':artist' "
             "AND profile_id = :profile_id COLLATE NOCASE",
             values).fetchone()
Beispiel #3
0
 def show_new_releases(self, from_date_ts, now_ts):
     today_date = datetime.utcfromtimestamp(now_ts).strftime('%Y-%m-%d')
     from_date = datetime.utcfromtimestamp(from_date_ts).strftime(
         '%Y-%m-%d')
     values = {
         'from': from_date,
         'today': today_date,
         'profile_id': config.profile_id()
     }
     sql = "SELECT * FROM 'releases' WHERE album_release >= :from AND album_release <= :today AND profile_id = :profile_id"
     return self.query(sql, values).fetchall()
Beispiel #4
0
 def build_playlist_query(self, api_result: list):
     existing = self.db.get_all_monitored_playlist_ids() or []
     playlists_to_add = []
     pbar = tqdm(api_result, total=len(api_result), desc="Setting up playlists for monitoring...", ascii=" #",
                 bar_format=ui.TQDM_FORMAT)
     for i, playlist in enumerate(pbar):
         if not playlist:
             continue
         if playlist['id'] in existing:
             logger.info(f"   Already monitoring {playlist['title']}, skipping...")
         else:
             playlist.update({'bitrate': self.bitrate, 'alerts': self.alerts, 'download_path': self.download_path,
                              'profile_id': config.profile_id(), 'trans_id': config.transaction_id()})
             playlists_to_add.append(playlist)
     if len(playlists_to_add):
         logger.debug("New playlists have been monitored. Saving changes to the database...")
         self.db.new_transaction()
         self.db.fast_monitor_playlist(playlists_to_add)
         self.db.commit()
         return True
Beispiel #5
0
 def rollback_last_refresh(self, rollback: int):
     vals = {'rollback': rollback, 'profile_id': config.profile_id()}
     transactions = self.query(
         "SELECT id FROM transactions WHERE profile_id = :profile_id "
         f"ORDER BY id DESC LIMIT {rollback}", vals).fetchall()
     for t in transactions:
         vals = {'id': t['id'], 'profile_id': config.profile_id()}
         self.query(
             f"DELETE FROM monitor WHERE trans_id = :id AND profile_id = :profile_id",
             vals)
         self.query(
             f"DELETE FROM releases WHERE trans_id = :id AND profile_id = :profile_id",
             vals)
         self.query(
             f"DELETE FROM playlist_tracks WHERE trans_id = :id AND profile_id = :profile_id",
             vals)
         self.query(
             f"DELETE FROM transactions WHERE id = :id AND profile_id = :profile_id",
             vals)
         self.commit()
Beispiel #6
0
 def monitor_artist(self, artist: dict, artist_config: dict):
     self.new_transaction()
     vals = {
         'artist_id': artist['id'],
         'artist_name': artist['name'],
         'bitrate': artist_config['bitrate'],
         'record_type': artist_config['record_type'],
         'alerts': artist_config['alerts'],
         'download_path': artist_config['download_path'],
         'profile_id': config.profile_id(),
         'trans_id': config.transaction_id()
     }
     query = (
         "INSERT INTO monitor "
         "(artist_id, artist_name, bitrate, record_type, alerts, download_path, profile_id, trans_id) "
         "VALUES "
         "(:artist_id, :artist_name, :bitrate, :record_type, :alerts, :download_path, :profile_id, :trans_id)"
     )
     self.query(query, vals)
     self.commit()
Beispiel #7
0
 def get_account_type(self):
     temp_dz = Deezer()
     temp_dz.login_via_arl(config.arl())
     if temp_dz.get_session()['current_user'].get('can_stream_lossless'):
         logger.debug(f"Deezer account type is \"Hi-Fi\"")
         return "hifi"
     elif temp_dz.get_session()['current_user'].get('can_stream_hq'):
         logger.debug(f"Deezer account type is \"Premium\"")
         return "premium"
     else:
         logger.debug(f"Deezer account type is \"Free\"")
         return "free"
Beispiel #8
0
 def build_artist_query(self, api_result: list):
     existing = self.db.get_all_monitored_artist_ids()
     artists_to_add = []
     pbar = tqdm(api_result, total=len(api_result), desc="Setting up artists for monitoring...", ascii=" #",
                 bar_format=ui.TQDM_FORMAT)
     for artist in pbar:
         if artist is None:
             continue
         if artist['id'] in existing:
             logger.info(f"   - Already monitoring {artist['name']}, skipping...")
         else:
             artist.update({'bitrate': self.bitrate, 'alerts': self.alerts, 'record_type': self.record_type,
                            'download_path': self.download_path, 'profile_id': config.profile_id(),
                            'trans_id': config.transaction_id()})
             artists_to_add.append(artist)
     if len(artists_to_add):
         logger.debug("New artists have been monitored. Saving changes to the database...")
         self.db.new_transaction()
         self.db.fast_monitor(artists_to_add)
         self.db.commit()
         return True
Beispiel #9
0
def refresh_plex(plexobj):
    try:
        plexobj.library.section(config.plex_library()).update()
        logger.debug("Plex library refreshed successfully")
    except plexapi.exceptions.BadRequest as e:
        logger.error(
            "Error occurred while refreshing your library. See logs for additional info."
        )
        logger.debug(f"Error during Plex refresh: {e}")
    except plexapi.exceptions.NotFound as e:
        logger.error(
            "Error: Plex library not found. See logs for additional info.")
        logger.debug(f"Error during Plex refresh: {e}")
Beispiel #10
0
 def new_transaction(self):
     check_exists = self.query(
         f"SELECT * FROM transactions WHERE id = {config.transaction_id()}"
     ).fetchone()
     if not check_exists:
         current_time = int(time.time())
         vals = {
             'timestamp': current_time,
             'profile_id': config.profile_id()
         }
         self.query(
             f"INSERT INTO transactions ('timestamp', 'profile_id') "
             f"VALUES (:timestamp, :profile_id)", vals)
         self.commit()
Beispiel #11
0
 def filter_artist_by_record_type(artist):
     album_api = self.api.get_artist_albums(query={
         'artist_name': '',
         'artist_id': artist['id']
     })
     filtered_albums = []
     for album in album_api['releases']:
         if (album['record_type'] == config.record_type()
             ) or config.record_type() == "all":
             album_date = dates.str_to_datetime_obj(
                 album['release_date'])
             if self.release_from and self.release_to:
                 if album_date > self.release_from and album_date < self.release_to:
                     filtered_albums.append(album)
             elif self.release_from:
                 if album_date > self.release_from:
                     filtered_albums.append(album)
             elif self.release_to:
                 if album_date < self.release_to:
                     filtered_albums.append(album)
             else:
                 filtered_albums.append(album)
     return filtered_albums
Beispiel #12
0
def artist_lookup(query):
    result = get_artist(query)
    if not result:
        return
    print_header(
        f"Configuring '{result['artist_name']}' (Artist ID: {result['artist_id']})"
    )
    modified = 0
    for property in result:
        if property not in [
                'alerts', 'bitrate', 'record_type', 'download_path'
        ]:
            continue
        allowed_opts = config.allowed_values(property)
        if isinstance(allowed_opts, dict):
            allowed_opts = [str(x.lower()) for x in allowed_opts.values()]

        while True:
            friendly_text = property.replace("_", " ").title()
            user_input = input(f"{friendly_text} [{result[property]}]: ")

            if property != "download_path":
                user_input = user_input.lower()

            if user_input == "":
                break
            elif user_input == "false" or user_input == "0":
                user_input = False
            elif user_input == "true" or user_input == "1":
                user_input = True
            if user_input == "none":
                user_input = None
            elif allowed_opts:
                if user_input not in allowed_opts:
                    print(f"Allowed options: " +
                          ', '.join(str(x) for x in allowed_opts))
                    continue
            logger.debug(f"User set {property} to {user_input}")
            result[property] = user_input
            modified += 1
            break
    if modified > 0:
        i = input("\n:: Save these settings? [y|N] ")
        if i.lower() != "y":
            logger.info("No changes made, exiting...")
        else:
            db.update_artist(result)
            print(f"\nArtist '{result['artist_name']}' has been updated!")
    else:
        print("No changes made, exiting...")
Beispiel #13
0
 def rollback_refresh(self, rollback: int):
     vals = {'rollback': rollback, 'profile_id': config.profile_id()}
     self.query(
         f"DELETE FROM monitor WHERE trans_id = {rollback} AND profile_id = :profile_id",
         vals)
     self.query(
         f"DELETE FROM releases WHERE trans_id = {rollback} AND profile_id = :profile_id",
         vals)
     self.query(
         f"DELETE FROM playlist_tracks WHERE trans_id = {rollback} AND profile_id = :profile_id",
         vals)
     self.query(
         f"DELETE FROM transactions WHERE id = {rollback} AND profile_id = :profile_id",
         vals)
     self.commit()
Beispiel #14
0
    def login(self):
        failed_logins = 0
        logger.debug("Looking for ARL...")
        if config.arl():
            logger.debug("ARL found in deemon config")
            print(":: Found ARL in deemon config, checking... ", end="")
            if self.verify_arl(config.arl()):
                return True
            else:
                logger.error("Unable to login using ARL found in deemon config")
                failed_logins += 1
        else:
            logger.debug("ARL was not found in deemon config, checking if deemix has it...")

        if self.config_dir.is_dir():
            if Path(self.config_dir / '.arl').is_file():
                with open(self.config_dir / '.arl', 'r') as f:
                    arl_from_file = f.readline().rstrip("\n")
                    logger.debug("ARL found in deemix config")
                    print(":: Found ARL in deemix .arl file, checking... ", end="")
                    if self.verify_arl(arl_from_file):
                        return True
                    else:
                        logger.error("Unable to login using ARL found in deemix config directory")
                        failed_logins += 1
            else:
                logger.debug(f"ARL not found in {self.config_dir}")
        else:
            logger.error(f"ARL directory {self.config_dir} was not found")

        if failed_logins > 1:
            notification = notifier.Notify()
            notification.expired_arl()
        else:
            logger.error("No ARL was found, aborting...")
            return False
Beispiel #15
0
 def get_transactions(self):
     vals = {
         'profile_id': config.profile_id(),
         'trans_limit': config.rollback_view_limit()
     }
     transaction_list = self.query(
         "SELECT id, timestamp FROM transactions WHERE profile_id = :profile_id "
         "ORDER BY id DESC LIMIT :trans_limit", vals).fetchall()
     results = []
     for tid in transaction_list:
         vals = {'tid': tid['id'], 'profile_id': config.profile_id()}
         transaction = {}
         transaction['id'] = tid['id']
         transaction['timestamp'] = tid['timestamp']
         transaction['releases'] = self.query(
             "SELECT album_id "
             "FROM releases "
             "WHERE trans_id = :tid "
             "AND profile_id = :profile_id", vals).fetchall()
         transaction['playlist_tracks'] = self.query(
             "SELECT track_id "
             "FROM playlist_tracks "
             "WHERE trans_id = :tid "
             "AND profile_id = :profile_id", vals).fetchall()
         transaction['playlists'] = self.query(
             "SELECT title "
             "FROM playlists "
             "WHERE trans_id = :tid "
             "AND profile_id = :profile_id", vals).fetchall()
         transaction['monitor'] = self.query(
             "SELECT artist_name "
             "FROM monitor "
             "WHERE trans_id = :tid "
             "AND profile_id = :profile_id", vals).fetchall()
         results.append(transaction)
     return results
Beispiel #16
0
    def edit(self):
        profile = self.db.get_profile(self.profile_name)
        self.print_header(
            f"Configuring '{profile['name']}' (Profile ID: {profile['id']})")
        modified = 0
        for property in profile:
            if property == "id":
                continue
            allowed_opts = config.allowed_values(property)
            if isinstance(allowed_opts, dict):
                allowed_opts = [str(x.lower()) for x in allowed_opts.values()]

            while True:
                friendly_text = property.replace("_", " ").title()
                user_input = input(
                    f"{friendly_text} [{profile[property]}]: ").lower()
                if user_input == "":
                    break
                # TODO move to function to share with Config.set()?
                elif user_input == "false" or user_input == "0":
                    user_input = False
                elif user_input == "true" or user_input == "1":
                    user_input = True
                elif property == "name" and self.profile_name != user_input:
                    if self.db.get_profile(user_input):
                        print("Name already in use")
                        continue
                if user_input == "none" and property != "name":
                    user_input = None
                elif allowed_opts:
                    if user_input not in allowed_opts:
                        print(f"Allowed options: " +
                              ', '.join(str(x) for x in allowed_opts))
                        continue
                logger.debug(f"User set {property} to {user_input}")
                profile[property] = user_input
                modified += 1
                break

        if modified > 0:
            user_input = input("\n:: Save these settings? [y|N] ")
            if user_input.lower() != "y":
                logger.info("No changes made, exiting...")
            else:
                self.db.update_profile(profile)
                print(f"\nProfile '{profile['name']}' has been updated!")
        else:
            print("No changes made, exiting...")
Beispiel #17
0
 def deezer_acct_type(self):
     user_session = self.dz.get_session()['current_user']
 
     if user_session.get('can_stream_lossless'):
         logger.debug("Deezer account connected and supports lossless")
         config.set('deezer_quality', 'lossless', validate=False)
     elif user_session.get('can_stream_hq'):
         logger.debug("Deezer account connected and supports high quality")
         config.set('deezer_quality', 'hq', validate=False)
     else:
         logger.warning("Deezer account connected but only supports 128k")
         config.set('deezer_quality', 'lq', validate=False)
Beispiel #18
0
    def search_menu(self, query: str = None):
        exit_search: bool = False
        quick_search: bool = False
        while exit_search is False:
            self.clear()
            print("deemon Interactive Search Client\n")
            if len(self.queue_list) > 0:
                self.display_options(
                    options="(d) Download Queue  (Q) Show Queue")
            if query:
                search_query = query
            else:
                search_query = input(
                    f":: Enter an artist to search for{self.show_mini_queue()}: "
                )
                if search_query == "exit":
                    if self.exit_search():
                        sys.exit()
                    continue
                if search_query == "d":
                    if len(self.queue_list) > 0:
                        self.start_queue()
                        continue
                if search_query == "Q":
                    if len(self.queue_list) > 0:
                        self.queue_menu()
                    else:
                        self.status_message = "Queue is empty"
                    continue
                if search_query == "":
                    continue
            self.search_results = self.api.search_artist(
                search_query, config.query_limit())
            if len(self.search_results['results']) == 0:
                self.status_message = "No results found for: " + search_query
                continue

            artist_selected = self.artist_menu(self.search_results['query'],
                                               self.search_results['results'],
                                               quick_search)
            if artist_selected:
                return [artist_selected]
Beispiel #19
0
    def album_menu(self, artist: dict):
        exit_album_menu: bool = False
        # Rewrite DICT to follow old format used by get_artist_albums
        artist_tmp = {'artist_id': artist['id'], 'artist_name': artist['name']}

        artist_albums = self.api.get_artist_albums(artist_tmp)['releases']
        while exit_album_menu is False:
            self.clear()
            self.album_menu_header(artist['name'])
            filtered_choices = self.filter_choices(artist_albums)
            for idx, album in enumerate(filtered_choices, start=1):
                print(
                    f"{self.item_selected(album['id'])}{idx}. ({dates.get_year(album['release_date'])}) "
                    f"{album['title']} {self.explicit_lyrics(album['explicit_lyrics'])}"
                )
            monitored = self.db.get_monitored_artist_by_id(artist['id'])
            self.album_menu_options(monitored)

            prompt = input(
                f":: {self.show_mode()}Please choose an option or type 'exit'{self.show_mini_queue()}: "
            )
            if prompt == "a":
                self.filter = "album"
            elif prompt == "e":
                self.filter = "ep"
            elif prompt == "s":
                self.filter = "single"
            elif prompt == "*":
                self.filter = None
            elif prompt == "E":
                self.explicit_only ^= True
            elif prompt == "r":
                self.filter = None
                self.explicit_only = False
                self.sort = "release_date"
                self.desc = True
            elif prompt == "y":
                self.sort = "release_date"
                self.desc = True
            elif prompt == "Y":
                self.sort = "release_date"
                self.desc = False
            elif prompt == "t":
                self.sort = "title"
                self.desc = True
            elif prompt == "T":
                self.sort = "title"
                self.desc = False
            elif prompt == "S":
                self.select_mode ^= True
            elif prompt == "m":
                if monitored:
                    stop = True
                else:
                    stop = False
                record_type = self.filter or config.record_type()
                self.clear()
                monitor = mon.Monitor()
                monitor.set_config(None, None, record_type, None)
                monitor.set_options(stop, False, False)
                monitor.artist_ids([artist['id']])
            elif prompt == "f":
                if len(filtered_choices) > 0:
                    for item in filtered_choices:
                        self.send_to_queue(item)
                else:
                    self.status_message = "No items to add"
            elif prompt == "d":
                if len(self.queue_list) > 0:
                    self.start_queue()
            elif prompt == "Q":
                if len(self.queue_list) > 0:
                    self.queue_menu()
                else:
                    self.status_message = "Queue is empty"
            elif prompt == "b":
                break
            elif prompt == "":
                self.status_message = "Hint: to exit, type 'exit'!"
                continue
            elif prompt == "exit":
                if self.exit_search():
                    sys.exit()
            else:
                try:
                    selected_index = (int(prompt) - 1)
                except ValueError:
                    self.status_message = "Invalid filter, sort or option provided"
                    continue
                except IndexError:
                    self.status_message = "Invalid selection, please choose from above"
                    continue

                if selected_index in range(len(filtered_choices)):
                    if self.select_mode:
                        selected_item = filtered_choices[selected_index]
                        self.send_to_queue(selected_item)
                        continue
                    else:
                        self.track_menu(filtered_choices[selected_index])
                else:
                    self.status_message = "Invalid selection, please choose from above"
                    continue
Beispiel #20
0
 def get_unrefreshed_playlists(self):
     values = {"profile_id": config.profile_id()}
     return self.query(
         "SELECT * FROM playlists WHERE profile_id = :profile_id AND refreshed = 0",
         values).fetchall()
Beispiel #21
0
 def get_monitored(self):
     values = {"profile_id": config.profile_id()}
     query = self.query(
         "SELECT artist_id, artist_name FROM monitor WHERE profile_id = :profile_id",
         values).fetchall()
     return query
Beispiel #22
0
 def get_all_monitored_artist_ids(self):
     values = {"profile_id": config.profile_id()}
     query = self.query(
         "SELECT artist_id FROM monitor WHERE profile_id = :profile_id",
         values).fetchall()
     return [v for x in query for v in x.values()]
Beispiel #23
0
 def get_platform(self):
     if config.fast_api():
         return "deezer-gw"
     return "deezer-api"
Beispiel #24
0
 def set_artist_refreshed(self, id):
     vals = {'id': id, 'profile_id': config.profile_id()}
     return self.query(
         "UPDATE monitor SET refreshed = 1 WHERE artist_id = :id AND profile_id = :profile_id",
         vals)
Beispiel #25
0
 def get_album_by_id(self, album_id):
     values = {'id': album_id, 'profile_id': config.profile_id()}
     sql = "SELECT * FROM 'releases' WHERE album_id = :id AND profile_id = :profile_id"
     return self.query(sql, values).fetchone()
Beispiel #26
0
    def get_artist_albums(self, query: dict, limit: int = -1):
        """
        Return a list of dictionaries from API containing
        """
        self.debugger("RefreshArtist", query['artist_name'])
        if self.platform == "deezer-gw":
            try:
                result = self.api.get_artist_discography(art_id=query['artist_id'], limit=limit)['data']
            except deezer.errors.GWAPIError as e:
                if "UNKNOWN" in str(e):
                    logger.debug(e)
                    logger.warning(f"   [!] Artist discography is not available for "
                                 f"{query['artist_name']} ({query['artist_id']})")
                else:
                    logger.debug(e)
                    logger.error(f"An error occured while attempting to get the discography for "
                                 f"{query['artist_name']} ({query['artist_id']})")
                query['releases'] = []
                return query
            except json.decoder.JSONDecodeError:
                logger.error(f"   [!] Empty response from API while getting data for discography for {query['artist_name']}, retrying...")
                try:
                    result = self.api.get_artist_discography(art_id=query['artist_id'], limit=limit)['data']
                except json.decoder.JSONDecodeError:
                    logger.error(f"   [!] API still sending empty response for discography for {query['artist_name']}")
                    query['releases'] = []
                    return query
            api_result = []
            for r in result:
                # Remove ID check to get compilations
                if (r['ART_ID'] == str(query['artist_id']) and r['ARTISTS_ALBUMS_IS_OFFICIAL']) or (r['ART_ID'] == str(query['artist_id']) and config.allow_unofficial()) or config.allow_compilations():
                    # TYPE 0 - single, TYPE 1 - album, TYPE 2 - compilation, TYPE 3 - ep
                    if r['TYPE'] == '0':
                        r['TYPE'] = "single"
                    elif r['TYPE'] == '1' and r['ART_ID'] != str(query['artist_id']):
                        if not config.allow_featured_in():
                            logger.debug(f"Featured In for {query['artist_name']} detected but are disabled in config")
                            continue
                        else:
                            logger.debug(f"Featured In detected for artist {query['artist_name']}: {r['ALB_TITLE']}")
                            r['TYPE'] = "album"
                            # TODO set unique r['TYPE'] for FEATURED IN
                    elif r['TYPE'] == '2':
                        if not config.allow_compilations():
                            logger.debug(f"Compilation for {query['artist_name']} detected but are disabled in config")
                            continue
                        else:
                            logger.debug(f"Compilation detected for artist {query['artist_name']}: {r['ALB_TITLE']}")
                            r['TYPE'] = "album"
                            # TODO set unique r['TYPE'] for COMPILATIONS
                    elif r['TYPE'] == '3':
                        r['TYPE'] = "ep"
                    else:
                        r['TYPE'] = "album"

                    if r['ORIGINAL_RELEASE_DATE'] != "0000-00-00":
                        release_date = r['ORIGINAL_RELEASE_DATE']
                    elif r['PHYSICAL_RELEASE_DATE'] != "0000-00-00":
                        release_date = r['PHYSICAL_RELEASE_DATE']
                    elif r['DIGITAL_RELEASE_DATE'] != "0000-00-00":
                        release_date = r['DIGITAL_RELEASE_DATE']
                    else:
                        # In the event of an unknown release date, set it to today's date
                        # See album ID: 417403
                        logger.warning(f"   [!] Found release without release date, assuming today: "
                                       f"{query['artist_name']} - {r['ALB_TITLE']}")
                        release_date = datetime.strftime(datetime.today(), "%Y-%m-%d")
                    
                    cover_art = f"https://e-cdns-images.dzcdn.net/images/cover/{r['ALB_PICTURE']}/500x500-00000-80-0-0.jpg"
                    album_url = f"https://www.deezer.com/album/{r['ALB_ID']}"
                    
                    api_result.append(
                        {
                            'id': int(r['ALB_ID']),
                            'title': r['ALB_TITLE'],
                            'release_date': release_date,
                            'explicit_lyrics': r['EXPLICIT_ALBUM_CONTENT']['EXPLICIT_LYRICS_STATUS'],
                            'record_type': r['TYPE'],
                            'cover_big': cover_art,
                            'link': album_url,
                            'nb_tracks': r['NUMBER_TRACK'],
                            }
                    )
        else:
            api_result = self.api.get_artist_albums(artist_id=query['artist_id'], limit=limit)['data']

        query['releases'] = api_result
        return query
Beispiel #27
0
 def debugger(self, message: str, payload = None):
     if config.debug_mode():
         if not payload:
             payload = ""
         logger.debug(f"DEBUG_MODE: {message} {str(payload)}")
Beispiel #28
0
 def get_monitored_playlist_by_name(self, title):
     values = {'title': title, 'profile_id': config.profile_id()}
     return self.query(
         "SELECT * FROM playlists WHERE title = :title COLLATE NOCASE "
         "AND profile_id = :profile_id", values).fetchone()
Beispiel #29
0
 def set_playlist_refreshed(self, id):
     vals = {'id': id, 'profile_id': config.profile_id()}
     return self.query(
         "UPDATE playlists SET refreshed = 1 WHERE id = :id AND profile_id = :profile_id",
         vals)
Beispiel #30
0
 def get_future_releases(self):
     vals = {'profile_id': config.profile_id()}
     return self.query(
         "SELECT * FROM releases "
         "WHERE future_release = 1 AND profile_id = :profile_id",
         vals).fetchall()