From 6c07267312542a3f5e94a78493018c73fb3eeefd Mon Sep 17 00:00:00 2001 From: Silverfeelin Date: Sun, 13 Jan 2019 17:12:05 +0100 Subject: [PATCH 1/2] Use folder argument as base for album/playlist file exports. --- spotdl/spotify_tools.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spotdl/spotify_tools.py b/spotdl/spotify_tools.py index d26855d..2ba0396 100644 --- a/spotdl/spotify_tools.py +++ b/spotdl/spotify_tools.py @@ -7,7 +7,9 @@ from titlecase import titlecase from logzero import logger as log import pprint import sys +import os +from spotdl import const from spotdl import internals @@ -146,7 +148,8 @@ def write_playlist(playlist_url, text_file=None): tracks = playlist["tracks"] if not text_file: text_file = u"{0}.txt".format(slugify(playlist["name"], ok="-_()[]{}")) - return write_tracks(tracks, text_file) + filepath = os.path.join(const.args.folder if const.args.folder else "", text_file) + return write_tracks(tracks, filepath) def fetch_album(album): @@ -217,7 +220,8 @@ def write_album(album_url, text_file=None): tracks = spotify.album_tracks(album["id"]) if not text_file: text_file = u"{0}.txt".format(slugify(album["name"], ok="-_()[]{}")) - return write_tracks(tracks, text_file) + filepath = os.path.join(const.args.folder if const.args.folder else "", text_file) + return write_tracks(tracks, filepath) def write_tracks(tracks, text_file): From a18f888e977fa80401d5de2420e6be01e85bac96 Mon Sep 17 00:00:00 2001 From: Silverfeelin Date: Sun, 13 Jan 2019 20:25:05 +0100 Subject: [PATCH 2/2] Update CHANGES.md --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 825d65e..53932ff 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed +- Option `-f` (`--folder`) is used when exporting text files using `-p` (`--playlist`) for playlists or `-b` (`--album`) for albums ([@Silverfeelin](https://github.com/Silverfeelin)) (#476) + ## [1.1.1] - 2019-01-03 ### Added - Output informative message in case of no result found in YouTube search ([@Amit-L](https://github.com/Amit-L)) (#452)