mirror of
				https://github.com/KevinMidboe/spotify-downloader.git
				synced 2025-10-29 18:00:15 +00:00 
			
		
		
		
	Support reading & writing to STDIN & STDOUT respectively
This commit is contained in:
		| @@ -1,31 +1,31 @@ | ||||
| from spotdl.authorize.services import AuthorizeSpotify | ||||
| from spotdl import command_line | ||||
|  | ||||
| import sys | ||||
|  | ||||
| def match_arguments(arguments): | ||||
|     if arguments.tracks: | ||||
|         # TODO: Also support reading from stdin for -t parameter | ||||
|         # Also supported writing to stdout for all parameters | ||||
|         if len(arguments.tracks) > 1: | ||||
|             # log.warning("download multiple tracks with optimized list instead") | ||||
|             pass | ||||
|         for track in arguments.tracks: | ||||
|             command_line.helpers.download_track(track, arguments) | ||||
|             if track == "-": | ||||
|                 for line in sys.stdin: | ||||
|                     command_line.helpers.download_track(line, arguments) | ||||
|             else: | ||||
|                 command_line.helpers.download_track(track, arguments) | ||||
|     elif arguments.list: | ||||
|         if arguments.write_m3u: | ||||
|             youtube_tools.generate_m3u( | ||||
|                 track_file=arguments.list | ||||
|             ) | ||||
|         else: | ||||
|             command_line.helpers.download_tracks_from_file( | ||||
|             list_download = { | ||||
|                 "sequential": command_line.helpers.download_tracks_from_file, | ||||
|                 "threaded"  : command_line.helpers.download_tracks_from_file_threaded, | ||||
|             }[arguments.processor] | ||||
|  | ||||
|             list_download( | ||||
|                 arguments.list, | ||||
|                 arguments, | ||||
|             ) | ||||
|             # list_dl = downloader.ListDownloader( | ||||
|             #     tracks_file=arguments.list, | ||||
|             #     skip_file=arguments.skip, | ||||
|             #     write_successful_file=arguments.write_successful, | ||||
|             # ) | ||||
|             # list_dl.download_list() | ||||
|     elif arguments.playlist: | ||||
|         spotify_tools.write_playlist( | ||||
|             playlist_url=arguments.playlist, text_file=arguments.write_to | ||||
|   | ||||
		Reference in New Issue
	
	Block a user