mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Fix prompt when using '/' to create sub-directories (#503)
* Fix prompt when using '/' to create sub-directories * Fix and update CHANGES.md
This commit is contained in:
10
CHANGES.md
10
CHANGES.md
@@ -7,12 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
|
||||
## [Unreleased]
|
||||
### Added
|
||||
-
|
||||
- Set custom Spotify Client ID and Client Secret via config.yml ([@ManveerBasra](https://github.com/ManveerBasra)) (#502)
|
||||
- Use YouTube as fallback metadata if track not found on Spotify. Also added `--no-fallback-metadata`
|
||||
to preserve old behaviour ([@ritiek](https://github.com/ritiek)) (#457)
|
||||
|
||||
### Changed
|
||||
-
|
||||
|
||||
### Fixed
|
||||
- Fix already downloaded prompt when using "/" in `--file-format` to create sub-directories ([@ritiek](https://github.com/ritiek)) (#503)
|
||||
- Fix writing playlist tracks to file ([@ritiek](https://github.com/ritiek)) (#506)
|
||||
|
||||
## [1.1.2] - 2019-02-10
|
||||
@@ -27,14 +30,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
|
||||
## [1.1.1] - 2019-01-03
|
||||
### Added
|
||||
- Use YouTube as fallback metadata if track not found on Spotify. Also added `--no-fallback-metadata`
|
||||
to preserve old behaviour ([@ritiek](https://github.com/ritiek)) (#457)
|
||||
- Output informative message in case of no result found in YouTube search ([@Amit-L](https://github.com/Amit-L)) (#452)
|
||||
- Ability to pass multiple tracks with `-s` option ([@ritiek](https://github.com/ritiek)) (#442)
|
||||
|
||||
### Changed
|
||||
- Allowed to fetch metadata from Spotify upon searching Spotify-URL and `--no-metadata` to gather YouTube
|
||||
custom-search fields ([@Amit-L](https://github.com/Amit-L)) (#452)
|
||||
- Allowed to fetch metadata from Spotify upon searching Spotify-URL and `--no-metadata` to gather YouTube custom-search fields ([@Amit-L](https://github.com/Amit-L)) (#452)
|
||||
- Change FFmpeg to use the built-in encoder `aac` instead of 3rd party `libfdk-aac` which does not
|
||||
ship with the apt package ([@ritiek](https://github.com/ritiek)) (#448)
|
||||
- Monkeypatch ever-changing network-relying tests ([@ritiek](https://github.com/ritiek)) (#448)
|
||||
|
||||
@@ -14,16 +14,20 @@ from spotdl import youtube_tools
|
||||
|
||||
class CheckExists:
|
||||
def __init__(self, music_file, meta_tags=None):
|
||||
self.music_file = music_file
|
||||
self.meta_tags = meta_tags
|
||||
basepath, filename = os.path.split(music_file)
|
||||
filepath = os.path.join(const.args.folder, basepath)
|
||||
os.makedirs(filepath, exist_ok=True)
|
||||
self.filepath = filepath
|
||||
self.filename = filename
|
||||
|
||||
def already_exists(self, raw_song):
|
||||
""" Check if the input song already exists in the given folder. """
|
||||
log.debug(
|
||||
"Cleaning any temp files and checking "
|
||||
'if "{}" already exists'.format(self.music_file)
|
||||
'if "{}" already exists'.format(self.filename)
|
||||
)
|
||||
songs = os.listdir(const.args.folder)
|
||||
songs = os.listdir(self.filepath)
|
||||
self._remove_temp_files(songs)
|
||||
|
||||
for song in songs:
|
||||
@@ -45,17 +49,17 @@ class CheckExists:
|
||||
def _remove_temp_files(self, songs):
|
||||
for song in songs:
|
||||
if song.endswith(".temp"):
|
||||
os.remove(os.path.join(const.args.folder, song))
|
||||
os.remove(os.path.join(self.filepath, song))
|
||||
|
||||
def _has_metadata(self, song):
|
||||
# check if the already downloaded song has correct metadata
|
||||
# if not, remove it and download again without prompt
|
||||
already_tagged = metadata.compare(
|
||||
os.path.join(const.args.folder, song), self.meta_tags
|
||||
os.path.join(self.filepath, song), self.meta_tags
|
||||
)
|
||||
log.debug("Checking if it is already tagged correctly? {}", already_tagged)
|
||||
if not already_tagged:
|
||||
os.remove(os.path.join(const.args.folder, song))
|
||||
os.remove(os.path.join(self.filepath, song))
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -80,7 +84,7 @@ class CheckExists:
|
||||
return True
|
||||
|
||||
def _match_filenames(self, song):
|
||||
if os.path.splitext(song)[0] == self.music_file:
|
||||
if os.path.splitext(song)[0] == self.filename:
|
||||
log.debug('Found an already existing song: "{}"'.format(song))
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user