How to use the spotdl.spotify_tools.generate_metadata function in spotdl

To help you get started, we’ve selected a few spotdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ritiek / spotify-downloader / test / test_with_metadata.py View on Github external
def test_metadata():
    expect_number = 23
    global meta_tags
    meta_tags = spotify_tools.generate_metadata(TRACK_URL)
    assert len(meta_tags) == expect_number
github ritiek / spotify-downloader / test / test_download_with_metadata.py View on Github external
def metadata_fixture():
    meta_tags = spotify_tools.generate_metadata(SPOTIFY_TRACK_URL)
    return meta_tags
github ritiek / spotify-downloader / test / test_spotify_tools.py View on Github external
def metadata_fixture(self):
        metadata = spotify_tools.generate_metadata("ncs - spectre")
        return metadata
github ritiek / spotify-downloader / test / test_spotify_tools.py View on Github external
def test_correct_token(self):
        assert spotify_tools.generate_metadata("ncs - spectre")
github ritiek / spotify-downloader / test / test_spotify_tools.py View on Github external
def test_fake_token_generator(self, monkeypatch):
        spotify_tools.spotify = None
        monkeypatch.setattr(spotify_tools, "generate_token", lambda: 123123)

        with pytest.raises(spotipy.client.SpotifyException):
            spotify_tools.generate_metadata("ncs - spectre")
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def metadata_fixture():
    metadata = spotify_tools.generate_metadata(TRACK_SEARCH)
    return metadata
github ritiek / spotify-downloader / spotdl / youtube_tools.py View on Github external
meta_tags = fallback_metadata(meta_tags)

    elif internals.is_spotify(track):
        log.debug("Input song is a Spotify URL")
        # Let it generate metadata, YouTube doesn't know Spotify slang
        meta_tags = spotify_tools.generate_metadata(track)
        content = go_pafy(track, meta_tags)
        if const.args.no_metadata:
            meta_tags = None

    else:
        log.debug("Input song is plain text based")
        if const.args.no_metadata:
            content = go_pafy(track, meta_tags=None)
        else:
            meta_tags = spotify_tools.generate_metadata(track)
            content = go_pafy(track, meta_tags=meta_tags)
            meta_tags = fallback_metadata(meta_tags)

    return content, meta_tags
github ritiek / spotify-downloader / spotdl / youtube_tools.py View on Github external
"Fallback condition not met, shall not embed metadata"
        )
        if meta_tags is None:
            if const.args.no_fallback_metadata:
                log.warning(skip_fallback_metadata_warning)
            else:
                log.info(fallback_metadata_info)
                meta_tags = generate_metadata(content)
        return meta_tags

    if internals.is_youtube(track):
        log.debug("Input song is a YouTube URL")
        content = go_pafy(track, meta_tags=None)
        track = slugify(content.title).replace("-", " ")
        if not const.args.no_metadata:
            meta_tags = spotify_tools.generate_metadata(track)
            meta_tags = fallback_metadata(meta_tags)

    elif internals.is_spotify(track):
        log.debug("Input song is a Spotify URL")
        # Let it generate metadata, YouTube doesn't know Spotify slang
        meta_tags = spotify_tools.generate_metadata(track)
        content = go_pafy(track, meta_tags)
        if const.args.no_metadata:
            meta_tags = None

    else:
        log.debug("Input song is plain text based")
        if const.args.no_metadata:
            content = go_pafy(track, meta_tags=None)
        else:
            meta_tags = spotify_tools.generate_metadata(track)