Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sys.exit("Failed to authenticate client.")
if no_recursion:
max_depth = 0
elif max_depth is None:
max_depth = float('inf')
to_upload = get_local_songs(input_paths, filters=filters, max_depth=max_depth)
to_upload.sort()
if not to_upload:
logger.info("No songs to upload")
elif dry_run:
logger.info(f"Found {len(to_upload)} songs to upload")
if logger.level <= 10:
for song in to_upload:
logger.debug(song)
else:
upload_songs(
mm,
to_upload,
album_art=album_art,
no_sample=no_sample,
delete_on_success=delete_on_success
)
mm.logout()
logger.info("All done!")
to_download = filter_songs(mm.songs(), filters)
to_download.sort(
key=lambda song: (
song.get('artist', ''),
song.get('album', ''),
song.get('track_number', 0)
)
)
if not to_download:
logger.info("No songs to download")
elif dry_run:
logger.info(f"Found {len(to_download)} songs to download")
if logger.level <= 10:
for song in to_download:
title = song.get('title', "<title>")
artist = song.get('artist', "<artist>")
album = song.get('album', "<album>")
song_id = song['id']
logger.debug(f"{title} -- {artist} -- {album} ({song_id})")
else:
download_songs(mm, to_download, template=output)
mm.logout()
logger.info("All done!")
</title>
def with_ffmpeg(self, trim_silence=False):
ffmpeg_pre = (
"ffmpeg -y -nostdin "
) # -nostdin is necessary for spotdl to be able to run in the backgroung.
if not log.level == 10:
ffmpeg_pre += "-hide_banner -nostats -v panic "
ffmpeg_params = ""
if self.input_ext == ".m4a":
if self.output_ext == ".mp3":
ffmpeg_params = "-codec:v copy -codec:a libmp3lame -ar 44100 "
elif self.output_ext == ".webm":
ffmpeg_params = "-codec:a libopus -vbr on "
elif self.output_ext == ".m4a":
ffmpeg_params = "-acodec copy "
elif self.input_ext == ".webm":
if self.output_ext == ".mp3":
ffmpeg_params = "-codec:a libmp3lame -ar 44100 "
elif self.output_ext == ".m4a":
logger.info("Comparing song collections")
to_upload = sorted(
gm_utils.find_missing_items(
local_songs,
google_songs,
fields=['artist', 'album', 'title', 'tracknumber'],
normalize_values=True
)
)
if not to_upload:
logger.info("No songs to upload")
elif dry_run:
logger.info(f"Found {len(to_upload)} songs to upload")
if logger.level <= 10:
for song in to_upload:
logger.debug(song)
else:
upload_songs(
mm,
to_upload,
album_art=album_art,
no_sample=no_sample,
delete_on_success=delete_on_success
)
mm.logout()
logger.info("All done!")