Merge branch 'master' into fix-m4a-when-encoder-not-found

This commit is contained in:
Ritiek Malhotra
2019-01-14 19:48:33 -08:00
committed by GitHub
2 changed files with 8 additions and 2 deletions

View File

@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [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)
### Fixed
- Fix renaming files when encoder is not found ([@ritiek](https://github.com/ritiek)) (#475)

View File

@@ -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):