mirror of
				https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
				synced 2025-11-03 21:10:34 +00:00 
			
		
		
		
	Added premium over
This commit is contained in:
		
							parent
							
								
									4efd15ed70
								
							
						
					
					
						commit
						44f23a3e98
					
				@ -10,6 +10,7 @@ import platform
 | 
				
			|||||||
import re
 | 
					import re
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					from getpass import getpass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import music_tag
 | 
					import music_tag
 | 
				
			||||||
import requests
 | 
					import requests
 | 
				
			||||||
@ -23,6 +24,7 @@ SESSION: Session = None
 | 
				
			|||||||
ROOT_PATH = "ZSpotify Music/"
 | 
					ROOT_PATH = "ZSpotify Music/"
 | 
				
			||||||
SKIP_EXISTING_FILES = True
 | 
					SKIP_EXISTING_FILES = True
 | 
				
			||||||
MUSIC_FORMAT = "mp3"  # or "ogg"
 | 
					MUSIC_FORMAT = "mp3"  # or "ogg"
 | 
				
			||||||
 | 
					FORCE_PREMIUM = False
 | 
				
			||||||
sanitize = ["\\", "/", ":", "*", "?", "'", "<", ">", '"']
 | 
					sanitize = ["\\", "/", ":", "*", "?", "'", "<", ">", '"']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# miscellaneous functions for general use
 | 
					# miscellaneous functions for general use
 | 
				
			||||||
@ -72,8 +74,8 @@ def login():
 | 
				
			|||||||
        except RuntimeError:
 | 
					        except RuntimeError:
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
    while True:
 | 
					    while True:
 | 
				
			||||||
        user_name = input("UserName: ")
 | 
					        user_name = input("Username: ")
 | 
				
			||||||
        password = input("Password: ")
 | 
					        password = getpass()
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            SESSION = Session.Builder().user_pass(user_name, password).create()
 | 
					            SESSION = Session.Builder().user_pass(user_name, password).create()
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
@ -255,11 +257,12 @@ def get_song_info(song_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def check_premium(access_token):
 | 
					def check_premium(access_token):
 | 
				
			||||||
 | 
					    global FORCE_PREMIUM
 | 
				
			||||||
    """ If user has spotify premium return true """
 | 
					    """ If user has spotify premium return true """
 | 
				
			||||||
    headers = {'Authorization': f'Bearer {access_token}'}
 | 
					    headers = {'Authorization': f'Bearer {access_token}'}
 | 
				
			||||||
    resp = requests.get('https://api.spotify.com/v1/me',
 | 
					    resp = requests.get('https://api.spotify.com/v1/me',
 | 
				
			||||||
                        headers=headers).json()
 | 
					                        headers=headers).json()
 | 
				
			||||||
    return bool("product" in resp and resp["product"] == "premium")
 | 
					    return bool(("product" in resp and resp["product"] == "premium") or FORCE_PREMIUM)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Functions directly related to modifying the downloaded audio and its metadata
 | 
					# Functions directly related to modifying the downloaded audio and its metadata
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user