mirror of
				https://github.com/KevinMidboe/spotify-downloader.git
				synced 2025-10-29 18:00:15 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					d18663c0e7 | ||
| 
						 | 
					4db1dcc9b8 | 
							
								
								
									
										15
									
								
								spotdl.py
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								spotdl.py
									
									
									
									
									
								
							@@ -13,6 +13,7 @@ import urllib.request
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
import time
 | 
			
		||||
import threading
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def generate_songname(tags):
 | 
			
		||||
@@ -374,6 +375,14 @@ def grab_single(raw_song, number=None):
 | 
			
		||||
    if not check_exists(file_name, raw_song, islist=islist):
 | 
			
		||||
        if download_song(file_name, content):
 | 
			
		||||
            print('')
 | 
			
		||||
            thread = threading.Thread(target=finalize, args=(file_name, meta_tags))
 | 
			
		||||
            threads.append(thread)
 | 
			
		||||
            thread.start()
 | 
			
		||||
        else:
 | 
			
		||||
            print('No audio streams available')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def finalize(file_name, meta_tags):
 | 
			
		||||
    input_song = file_name + args.input_ext
 | 
			
		||||
    output_song = file_name + args.output_ext
 | 
			
		||||
    convert.song(input_song, output_song, args.folder,
 | 
			
		||||
@@ -383,8 +392,6 @@ def grab_single(raw_song, number=None):
 | 
			
		||||
 | 
			
		||||
    if not args.no_metadata:
 | 
			
		||||
        metadata.embed(os.path.join(args.folder, output_song), meta_tags)
 | 
			
		||||
        else:
 | 
			
		||||
            print('No audio streams available')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TestArgs(object):
 | 
			
		||||
@@ -403,6 +410,7 @@ if __name__ == '__main__':
 | 
			
		||||
    args = misc.get_arguments()
 | 
			
		||||
 | 
			
		||||
    misc.filter_path(args.folder)
 | 
			
		||||
    threads = []
 | 
			
		||||
 | 
			
		||||
    if args.song:
 | 
			
		||||
        grab_single(raw_song=args.song)
 | 
			
		||||
@@ -412,6 +420,9 @@ if __name__ == '__main__':
 | 
			
		||||
        grab_playlist(playlist=args.playlist)
 | 
			
		||||
    elif args.username:
 | 
			
		||||
        feed_playlist(username=args.username)
 | 
			
		||||
 | 
			
		||||
    for thread in threads:
 | 
			
		||||
        thread.join()
 | 
			
		||||
else:
 | 
			
		||||
    misc.filter_path('Music')
 | 
			
		||||
    args = TestArgs()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user