From 77e0259ebc8f41e3d09a1d189eb805a81d82a5f9 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Fri, 2 May 2025 18:02:29 +0400 Subject: Download songs from the command line --- pamus | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'pamus') diff --git a/pamus b/pamus index 6cc3570..bdde8cd 100755 --- a/pamus +++ b/pamus @@ -123,18 +123,27 @@ def main(): default="mp3", help="Audio format to download (default: mp3)" ) + parser.add_argument( + "-s", "--song", + type=str, + nargs="*", + help="Song names to download (can provide multiple songs separated by space)" + ) args = parser.parse_args() output_dir = args.output_dir verbose = args.verbose input_file = args.input_file audio_format = args.audio_format + song_names = args.song # Replace $HOME with the actual home directory path for input file and output directory output_dir = output_dir.replace("$HOME", os.environ["HOME"]) input_file = input_file.replace("$HOME", os.environ["HOME"]) - song_names = read_song_names(input_file) + # If no songs are provided via command line, use the ones from the input file + if not song_names: + song_names = read_song_names(input_file) with ThreadPoolExecutor(max_workers=MAX_THREADS) as executor: futures = [executor.submit(process_song, name, output_dir, audio_format, verbose) for name in song_names] -- cgit v1.2.3