How to use the spotdl.const.args 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_youtube_tools.py View on Github external
def test_custom(self):
        const.args.youtube_api_key = EXPECTED_YT_API_KEY_CUSTOM
        youtube_tools.set_api_key()
        key = youtube_tools.pafy.g.api_key
        assert key == EXPECTED_YT_API_KEY_CUSTOM
github ritiek / spotify-downloader / test / test_youtube_tools.py View on Github external
def test_custom(self):
        const.args.youtube_api_key = EXPECTED_YT_API_KEY_CUSTOM
        youtube_tools.set_api_key()
        key = youtube_tools.pafy.g.api_key
        assert key == EXPECTED_YT_API_KEY_CUSTOM
github ritiek / spotify-downloader / spotdl / downloader.py View on Github external
)
        songs = os.listdir(self.filepath)
        self._remove_temp_files(songs)

        for song in songs:
            # check if a song with the same name is already present in the given folder
            if self._match_filenames(song):
                if internals.is_spotify(raw_song) and not self._has_metadata(song):
                    return False

                log.warning('"{}" already exists'.format(song))
                if const.args.overwrite == "prompt":
                    return self._prompt_song(song)
                elif const.args.overwrite == "force":
                    return self._force_overwrite_song(song)
                elif const.args.overwrite == "skip":
                    return self._skip_song(song)

        return False
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
            )
github ritiek / spotify-downloader / spotdl / youtube_tools.py View on Github external
def generate_youtube_url(raw_song, meta_tags):
    url_fetch = GenerateYouTubeURL(raw_song, meta_tags)
    if const.args.youtube_api_key:
        url = url_fetch.api()
    else:
        url = url_fetch.scrape()
    return url
github ritiek / spotify-downloader / spotdl / spotdl.py View on Github external
list_dl = downloader.ListDownloader(
                tracks_file=const.args.list,
                skip_file=const.args.skip,
                write_successful_file=const.args.write_successful,
            )
            list_dl.download_list()
    elif const.args.playlist:
        spotify_tools.write_playlist(playlist_url=const.args.playlist,
                                     text_file=const.args.write_to)
    elif const.args.album:
        spotify_tools.write_album(album_url=const.args.album,
                                  text_file=const.args.write_to)
    elif const.args.all_albums:
        spotify_tools.write_all_albums_from_artist(artist_url=const.args.all_albums,
                                                   text_file=const.args.write_to)
    elif const.args.username:
        spotify_tools.write_user_playlist(username=const.args.username,
                                          text_file=const.args.write_to)
github ritiek / spotify-downloader / spotdl / spotdl.py View on Github external
def match_args():
    if const.args.song:
        for track in const.args.song:
            track_dl = downloader.Downloader(raw_song=track)
            track_dl.download_single()
    elif const.args.list:
        if const.args.write_m3u:
            youtube_tools.generate_m3u(track_file=const.args.list,
                                       text_file=const.args.write_to)
        else:
            list_dl = downloader.ListDownloader(
                tracks_file=const.args.list,
                skip_file=const.args.skip,
                write_successful_file=const.args.write_successful,
            )
            list_dl.download_list()
    elif const.args.playlist:
        spotify_tools.write_playlist(playlist_url=const.args.playlist,
                                     text_file=const.args.write_to)