def init_config(self, tmpdir):
        config_file = os.path.join(tmpdir.dirname, "config.yml")
        os.environ['CONFIG_FILE_PATH'] = config_file

        if os.path.isfile(config_file):
            os.remove(config_file)

        cfg.init_config()

        return config_file
Ejemplo n.º 2
0
def put_settings():
    if not request.json or 'settings' not in request.json:
        abort(400, 'Error Saving settings: settings obligatory')

    log.info("Saving settings")

    try:
        config.save_config(request.json['settings'])

        config.init_config()

        return jsonify({'status': 'OK'})
    except Exception:
        log.error("Error Saving settings", exc_info=True)

        abort(500, 'Error Saving settings')
from core import config, const, internals, spotdl, spotify_tools, youtube_tools

config.init_config()
raw_song = "Tony's Videos VERY SHORT VIDEO 28.10.2016"
raw_song_spotify = 'https://open.spotify.com/track/33IOhptvC2Qoy2UhjiHXLV'
meta_tags = spotify_tools.generate_metadata(raw_song_spotify)

file_format = '{artist} - {track_name}'


class TestArgsManualResultCount:
    # Regresson test for issue #264
    def test_scrape(self):
        const.config.manual = True
        url = youtube_tools.GenerateYouTubeURL("she is still sleeping SAO",
                                               meta_tags=None)
        video_ids = url.scrape(bestmatch=False)
        # Web scraping gives us all videos on the 1st page
        assert len(video_ids) == 20

    def test_api(self):
        url = youtube_tools.GenerateYouTubeURL("she is still sleeping SAO",
                                               meta_tags=None)
        video_ids = url.api(bestmatch=False)
        const.config.manual = False
        # API gives us 50 videos (or as requested)
        assert len(video_ids) == 50


class TestYouTubeURL:
    def test_only_music_category(self):
Ejemplo n.º 4
0
def init():
    log.info("Launching Spotify-Downloader")

    config.init_config()