def __init__(self, title=None, artist=None, url=None):
        """
        Create a song.

        You can EITHER provide a URL for the song lyrics, OR provide the song
        title and artist (which will be slugified). If both are provided, the
        URL is preferred.
        """
        self._lyrics = None
        if url is not None:
            self._url = url
            self.title, self.artist = re.match(SONG_RE, url).groups()
        elif title is not None and artist is not None:
            self.title = title
            self.artist = artist
            self._url = SONG_URL.format(
                title=slugify(title),
                artist=slugify(artist),
            )
        else:
            raise ValueError('Must provide either title & artist or URL.')

        self.title = deslugify(self.title)
        self.artist = deslugify(self.artist)
def __init__ ( self , title = None , artist = None , url = None ) : self . _lyrics = None if url is not None : self . _url = url self . title , self . artist = re . match ( SONG_RE , url ) . groups ( ) elif title is not None and artist is not None : self . title = title self . artist = artist self . _url = SONG_URL . format ( title = slugify ( title ) , artist = slugify ( artist ) , ) else : raise ValueError ( 'Must provide either title & artist or URL.' ) self . title = deslugify ( self . title ) self . artist = deslugify ( self . artist )
Create a song.

        You can EITHER provide a URL for the song lyrics, OR provide the song
        title and artist (which will be slugified). If both are provided, the
        URL is preferred.