(self)
return True
Fetches metadata for this song's uri from Soundcloud.
Fetches metadata for this song's uri from Soundcloud.
Fetches metadata for this song s uri from Soundcloud .
def gather_metadata(self) -> bool:
        """Fetches metadata for this song's uri from Soundcloud."""
        if not self.id:
            results = self.web_client.get("/tracks", q=self.query, limit=20)

            # apply the filterlist from the settings
            for item in results:
                artist = item.user["username"]
                title = item.title
                if song_utils.is_forbidden(artist) or song_utils.is_forbidden(title):
                    continue
                result = item
                break
            else:
                # all tracks got filtered
                return False
            self.id = result.id
        else:
            result = self.web_client.get(f"tracks/{self.id}")
        self.metadata["artist"] = result.user["username"]
        self.metadata["title"] = result.title
        self.metadata["duration"] = result.duration / 1000
        self.metadata["internal_url"] = self.get_internal_url()
        self.metadata["external_url"] = result.permalink_url
        self.metadata["stream_url"] = None
        self.metadata["cached"] = False
        return True
def gather_metadata ( self ) -> bool : if not self . id : results = self . web_client . get ( "/tracks" , q = self . query , limit = 20 ) # apply the filterlist from the settings for item in results : artist = item . user [ "username" ] title = item . title if song_utils . is_forbidden ( artist ) or song_utils . is_forbidden ( title ) : continue result = item break else : # all tracks got filtered return False self . id = result . id else : result = self . web_client . get ( f"tracks/{self.id}" ) self . metadata [ "artist" ] = result . user [ "username" ] self . metadata [ "title" ] = result . title self . metadata [ "duration" ] = result . duration / 1000 self . metadata [ "internal_url" ] = self . get_internal_url ( ) self . metadata [ "external_url" ] = result . permalink_url self . metadata [ "stream_url" ] = None self . metadata [ "cached" ] = False return True