示例#1
0
 def __init__(self, sp: Spotify):
     Command.__init__(self, "Like",
                      "Add the currently playing song to Saved playlist",
                      "like")
     self.sp = sp
     # The rate limiter requires the same is_song_liked method to run for it to properly limit API requests
     self.liked = CheckFunctions(self.sp).is_song_liked
示例#2
0
 def __init__(self, sp: Spotify):
     Command.__init__(self, "Like",
                      "Add the current song to your liked songs", "heart",
                      PlaybackManager.toggle_like_song, "", "like", "exe")
     self.sp = sp
     # The rate limiter requires the same is_song_liked method to run for it to properly limit API requests
     self.liked = CheckFunctions(self.sp).is_song_liked
 def __init__(self, search_type: str):
     if search_type == "song":
         prefix = "play "
     else:
         prefix = f"{search_type} "
     Command.__init__(self, prefix, f"Search for a {search_type}", prefix)
     self.type_ = search_type
示例#4
0
 def __init__(self, sp: Spotify, queue: Queue):
     self.sp = sp
     self.auth_ui = AuthUI()
     self.command_list = [
         SongCommand(),
         QueueCommand(),
         PlaylistCommand(),
         AlbumCommand(),
         ArtistCommand(),
         PlayingCommand(sp),
         ShuffleCommand(sp),
         LikeCommand(sp),
         Command("Authentication", "Enter Spotify API details", "cog",
                 lambda: None, "", "authentication", "exe"),
         OnlineCommand(sp, type="song"),
         OnlineCommand(sp, type="queue"),
         OnlineCommand(sp, type="artist"),
         OnlineCommand(sp, type="playlist"),
         OnlineCommand(sp, type="album"),
         ParameterCommand(
             "Go to", "Seeks a position in the current song, i.e. 1:40",
             "forward", PlaybackManager.goto, "", "go to "),
         ParameterCommand(
             "Volume",
             "Sets the volume of your Spotify Player in range 1-10",
             "volume", PlaybackManager.set_volume, "", "volume "),
         DeviceCommand(sp),
         Command("Pause", "Pauses playback", "pause", PlaybackManager.pause,
                 "", "pause", "exe"),
         Command("Resume", "Resumes playback", "play",
                 PlaybackManager.resume, "", "resume", "exe"),
         RepeatCommand(),
         Command("Skip", "Skips to the next song", "forward",
                 PlaybackManager.skip, "", "skip", "exe"),
         Command("Previous", "Plays the previous song", "backward",
                 PlaybackManager.previous, "", "previous", "exe"),
         Command("Saved", "Plays liked music", "heart",
                 PlaybackManager.play_liked, "", "saved", "exe"),
         Command("Exit", "Exit the application", "exit",
                 PlaybackManager.exit_app, "", "exit", "exe"),
         Command("Share", "Copy song URL to clipboard", "share",
                 PlaybackManager.copy_url_to_clipboard, "", "share", "exe")
     ]
     self.manager = PlaybackManager(sp, queue)
     self.manager.set_device("")  # Sets default device
     CacheHolder.reload_holder("all")
示例#5
0
 def __init__(self, sp: Spotify, type="song"):
     """
     Allows user to search online for songs/albums/artists/playlists/queue-songs
     :param sp: Spotify object from the spotipy library
     :param type: str of value 'song', 'queue', 'artist', 'playlist' or 'album'
     """
     # creates command and class variables
     func = PlaybackManager.play_song
     icon = "play"
     prefix = "🔎song "
     noun = type
     if type == "queue":
         func = PlaybackManager.queue_song
         icon = "list"
         prefix = "🔎queue "
         noun = "song"
     elif type == "playlist":
         func = PlaybackManager.play_playlist
         icon = type
         prefix = "🔎playlist "
         noun = type
     elif type == "album":
         func = PlaybackManager.play_album
         icon = type
         prefix = "🔎album "
         noun = type
     elif type == "artist":
         func = PlaybackManager.play_artist
         icon = type
         prefix = "🔎artist "
         noun = type
     Command.__init__(self, "Search", f"Searches for {noun} online", icon,
                      func, "", prefix, "fill")
     self.type = type
     self.icon = icon
     self.sp = sp
示例#6
0
 def __init__(self, title: str, description: str, icon: str,
              function: classmethod, parameter: str, prefix: str,
              setting: str, _type: str):
     Command.__init__(self, title, description, icon, function, parameter,
                      prefix, setting)
     self._type = _type
示例#7
0
 def __init__(self):
     Command.__init__(self, "Authentication",
                      "Change Spotify API App Credentials",
                      "authentication")
示例#8
0
 def __init__(self):
     Command.__init__(
         self, "Share",
         "Copies to clipboard the Spotify URL of the song currently playing",
         "share")
 def __init__(self):
     Command.__init__(self, "Resume", "Resumes playback", "resume")
 def __init__(self):
     Command.__init__(self, "Saved", "Plays saved/liked songs", "saved")
 def __init__(self):
     Command.__init__(self, "Previous", "Plays previous song", "previous")
 def __init__(self):
     Command.__init__(self, "Next", "Skips current song", "next")
 def __init__(self):
     Command.__init__(self, "Pause", "Pauses playback", "pause")
示例#14
0
 def __init__(self, sp: Spotify, spotifyplayer):
     Command.__init__(self, "Currently Playing",
                      "Show currently playing song", "currently playing")
     self.spotifyplayer = spotifyplayer
     self.sp = sp
示例#15
0
 def __init__(self):
     Command.__init__(self, "Repeat",
                      "Change the repeat state of your Spotify player",
                      "repeat")
示例#16
0
 def __init__(self, sp: Spotify, spotifyplayer):
     Command.__init__(self, "Device", "Set the device to play music from", "device")
     self.spotifyplayer = spotifyplayer
     self.sp = sp
示例#17
0
 def __init__(self, sp: Spotify):
     Command.__init__(self, "Shuffle", "Change Shuffle State", "shuffle")
     self.sp = sp
     # The rate limiter requires the same is_shuffle_on method to run for it to properly limit API requests
     self.check_shuffle = CheckFunctions(self.sp).is_shuffle_on
示例#18
0
 def __init__(self):
     Command.__init__(self, "Volume", "Set volume level from 1-10",
                      "volume ")
 def __init__(self, search_type: str, sp: Spotify):
     Command.__init__(self, "", "Search Online", f"🔎{search_type} ")
     self.sp = sp
     self.type_ = search_type
示例#20
0
 def __init__(self):
     Command.__init__(self, "Go to",
                      "Seek to a point in a song e.g. '2:10'", "go to ")
示例#21
0
 def __init__(self, sp: Spotify):
     Command.__init__(self, "Shuffle", "Change Shuffle State", "shuffle",
                      PlaybackManager.toggle_shuffle, "", "shuffle", "exe")
     self.sp = sp
     # The rate limiter requires the same is_song_liked method to run for it to properly limit API requests
     self.check_shuffle = CheckFunctions(self.sp).is_shuffle_on
示例#22
0
 def __init__(self):
     Command.__init__(self, "Exit", "Exits the Spotightlify application",
                      "exit")
 def __init__(self, title: str, description: str, icon: str,
              function: classmethod, parameter: str, prefix: str):
     Command.__init__(self, title, description, icon, function, parameter,
                      prefix, "fill")