How to use the spotdl.internals.format_string 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_check_track_exists_before_download(tmpdir):
    expect_check = False
    const.args.folder = str(tmpdir)
    # prerequisites for determining filename
    songname = internals.format_string(const.args.file_format, meta_tags)
    global file_name
    file_name = internals.sanitize_title(songname)
    track_existence = downloader.CheckExists(file_name, meta_tags)
    check = track_existence.already_exists(TRACK_URL)
    assert check == expect_check
github ritiek / spotify-downloader / test / test_download_with_metadata.py View on Github external
def filename_fixture(metadata_fixture):
    songname = internals.format_string(const.args.file_format, metadata_fixture)
    filename = internals.sanitize_title(songname)
    return filename
github ritiek / spotify-downloader / test / test_download_with_metadata.py View on Github external
def test_without_spaces(self, metadata_fixture):
        const.args.no_spaces = True
        title = internals.format_string(const.args.file_format, metadata_fixture)
        assert title == EXPECTED_SPOTIFY_TITLE.replace(" ", "_")
github ritiek / spotify-downloader / test / test_with_metadata.py View on Github external
def test_with_spaces(self):
        title = internals.format_string(const.args.file_format, meta_tags)
        assert title == EXPECTED_TITLE
github ritiek / spotify-downloader / spotdl / downloader.py View on Github external
def refine_songname(self, songname):
        if self.meta_tags is not None:
            refined_songname = internals.format_string(
                const.args.file_format,
                self.meta_tags,
                slugification=True,
                total_songs=self.total_songs,
            )
            log.debug(
                'Refining songname from "{0}" to "{1}"'.format(
                    songname, refined_songname
                )
            )
            if not refined_songname == " - ":
                songname = refined_songname
        else:
            songname = internals.sanitize_title(songname)

        return songname
github ritiek / spotify-downloader / spotdl / youtube_tools.py View on Github external
def __init__(self, raw_song, meta_tags):
        self.raw_song = raw_song
        self.meta_tags = meta_tags

        if meta_tags is None:
            self.search_query = raw_song
        else:
            self.search_query = internals.format_string(
                const.args.search_format, meta_tags, force_spaces=True
            )