(
        self, session_key: str, archive: bool = True, manually_requested: bool = True
    )
Tries to request this resource.
        Uses the local cache if possible, otherwise tries to retrieve it online.
Tries to request this resource.
        Uses the local cache if possible, otherwise tries to retrieve it online.
Tries to request this resource . Uses the local cache if possible otherwise tries to retrieve it online .
def request(
        self, session_key: str, archive: bool = True, manually_requested: bool = True
    ) -> None:
        """Tries to request this resource.
        Uses the local cache if possible, otherwise tries to retrieve it online."""

        if 0 < storage.get("max_queue_length") <= playback.queue.count():
            self.error = "Queue limit reached"
            raise ProviderError(self.error)

        enqueue_function = enqueue

        if not self.check_cached():
            if self.query is not None and storage.get("additional_keywords"):
                # add the additional keywords from the settings before checking
                self.query += " " + storage.get("additional_keywords")
            if not self.check_available():
                raise ProviderError(self.error)

            # overwrite the enqueue function and make the resource available before calling it
            enqueue_function = fetch_enqueue

        from core.musiq.song_provider import SongProvider

        if storage.get("new_music_only") and isinstance(self, SongProvider):
            try:
                archived_song = ArchivedSong.objects.get(url=self.get_external_url())
                if archived_song.counter > 0:
                    self.error = "Only new music is allowed!"
                    raise ProviderError(self.error)
            except ArchivedSong.DoesNotExist:
                pass

        self.enqueue_placeholder(manually_requested)

        enqueue_function.delay(self, session_key, archive)
def request ( self , session_key : str , archive : bool = True , manually_requested : bool = True ) -> None : if 0 < storage . get ( "max_queue_length" ) <= playback . queue . count ( ) : self . error = "Queue limit reached" raise ProviderError ( self . error ) enqueue_function = enqueue if not self . check_cached ( ) : if self . query is not None and storage . get ( "additional_keywords" ) : # add the additional keywords from the settings before checking self . query += " " + storage . get ( "additional_keywords" ) if not self . check_available ( ) : raise ProviderError ( self . error ) # overwrite the enqueue function and make the resource available before calling it enqueue_function = fetch_enqueue from core . musiq . song_provider import SongProvider if storage . get ( "new_music_only" ) and isinstance ( self , SongProvider ) : try : archived_song = ArchivedSong . objects . get ( url = self . get_external_url ( ) ) if archived_song . counter > 0 : self . error = "Only new music is allowed!" raise ProviderError ( self . error ) except ArchivedSong . DoesNotExist : pass self . enqueue_placeholder ( manually_requested ) enqueue_function . delay ( self , session_key , archive )