import spotipy                      #NOTE Still need this when using spotify exception reports
from pkce_auth import Authorize     #NOTE Get the class from the authorization file

authcase = Authorize()              #NOTE Assign it to a variable



class get_user:
    def __init__(self):
        #NOTE For illustration purposes only
        self.some_crap = ""
        self.somemore_crap = 0
        self.current_user_playlists =""

    def get_the_playlists(self):
        try:
            self.current_user_playlists = self.sp.current_user_playlists() #NOTE See the change from sp. to self.sp. That is needed in any existing code

            print("Current user's playlists:")
            print(self.current_user_playlists)

        except Exception as e:
            print("An error occurred:", e)

    def author(self):                       #NOTE Need This Whole function in each .py file (no changes needed to code)
        print("[•] Authorising App....")    #NOTE Need This Whole function in each .py file (no changes needed to code)
        global authcase                     #NOTE Need This Whole function in each .py file (no changes needed to code)
        while True:                         #NOTE Need This Whole function in each .py file (no changes needed to code)
            self.sp = authcase.auth()       #NOTE Need This Whole function in each .py file (no changes needed to code)
            break                           #NOTE Need This Whole function in each .py file (no changes needed to code)

a = get_user()
a.author()              #NOTE This does the authorisation bit
a.get_the_playlists()