Closed cyberboysumanjay closed 5 years ago
There isn't a proper way to get this information via command-line. Not a very pleasant experience but you can also use this tool as a python library to achieve this.
from spotdl import handle
from spotdl import const
from spotdl import downloader
import os
# modify attributes on `const.args` to change any default arguments
# https://github.com/ritiek/spotify-downloader/blob/67ae7d5c4c9ed289f278a3ad6bfae658b812196f/spotdl/handle.py#L15-L36
const.args = handle.get_arguments(to_group=False)
# loglevel can be one of `logging.NOTSET`, `logging.INFO`, `logging.WARNING`, `logging.ERROR`, `logging.DEBUG`
const.logzero.setup_default_logger(
formatter=const._formatter,
level=const.logzero.logging.INFO)
# raw_song can take Spotify/Youtube URLs or a string
track = downloader.Downloader(raw_song="NCS - Panda")
# you probably need one of these variables
track_title = track.refine_songname(track.content.title)
track_filename = track_title + const.args.output_ext
track_download_path = os.path.join(const.args.folder, track_filename)
print(track_download_path)
# download, convert and embed metadata
track.download_single()
What is the purpose of your issue?
Description
I want to download the song from spotify url and get the filename of the downloaded file so that I can programatically forward files. I'm not able to extract the name of the downloaded file through
subprocess.check_output()
Any other way to get the filename will be very helpful.