mirror of
				https://github.com/KevinMidboe/spotify-downloader.git
				synced 2025-10-29 18:00:15 +00:00 
			
		
		
		
	Join threads before exitting
This commit is contained in:
		
							
								
								
									
										10
									
								
								spotdl.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								spotdl.py
									
									
									
									
									
								
							| @@ -375,9 +375,9 @@ def grab_single(raw_song, number=None): | |||||||
|     if not check_exists(file_name, raw_song, islist=islist): |     if not check_exists(file_name, raw_song, islist=islist): | ||||||
|         if download_song(file_name, content): |         if download_song(file_name, content): | ||||||
|             print('') |             print('') | ||||||
|             t = threading.Thread(target=finalize, args=(file_name, meta_tags)) |             thread = threading.Thread(target=finalize, args=(file_name, meta_tags)) | ||||||
|             #finalize(file_name, meta_tags) |             threads.append(thread) | ||||||
|             t.start() |             thread.start() | ||||||
|         else: |         else: | ||||||
|             print('No audio streams available') |             print('No audio streams available') | ||||||
|  |  | ||||||
| @@ -410,6 +410,7 @@ if __name__ == '__main__': | |||||||
|     args = misc.get_arguments() |     args = misc.get_arguments() | ||||||
|  |  | ||||||
|     misc.filter_path(args.folder) |     misc.filter_path(args.folder) | ||||||
|  |     threads = [] | ||||||
|  |  | ||||||
|     if args.song: |     if args.song: | ||||||
|         grab_single(raw_song=args.song) |         grab_single(raw_song=args.song) | ||||||
| @@ -419,6 +420,9 @@ if __name__ == '__main__': | |||||||
|         grab_playlist(playlist=args.playlist) |         grab_playlist(playlist=args.playlist) | ||||||
|     elif args.username: |     elif args.username: | ||||||
|         feed_playlist(username=args.username) |         feed_playlist(username=args.username) | ||||||
|  |  | ||||||
|  |     for thread in threads: | ||||||
|  |         thread.join() | ||||||
| else: | else: | ||||||
|     misc.filter_path('Music') |     misc.filter_path('Music') | ||||||
|     args = TestArgs() |     args = TestArgs() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user