Giter VIP home page Giter VIP logo

spotlightify's Introduction

Spotlightify

Spotlightify is a GUI based application designed to allow users to quickly interact with the Spotify Desktop application across Windows, Linux and macOS.

Spotlightify

Prerequisites

  • Spotify Premium Account
  • Python 3.7 or later
  • A Spotify App must also be created, the instructions follow:
    1. Open the Spotify Developer Dashboard here and login using your Spotify account credentials.
    2. Click the "CREATE AN APP" button.
    3. Name the application "Spotlightify", write anything for the description and select "Desktop App" from the checkboxes. Click "NEXT".
    4. Respond with "No" to the question "Are you developing a commercial integration?".
    5. Tick all boxes and click "SUBMIT".
    6. Now on the dashboard, click "EDIT SETTINGS".
    7. Under the title "Redirect URIs" enter: "http://localhost:8080", hit "ADD" and then at the bottom, hit "SAVE".
    8. That is the App set up, keep the dashboard webpage open as we will need Client ID and Client Secret from it later on.

Installing Dependencies

OS Specific Setup

To setup a virtual environment, perform the following commands.

Windows

cd path\to\spotlightify-root
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python app.py

To run the application as an independent process (i.e. it will not end when the command line is exited), use: pythonw app.py

MacOS

cd path/to/spotlightify-root
python -m venv venv
. venv/bin/activate
pip install -r requirements.txt
python app.py

Linux

cd path/to/spotlightify-root
python3 -m venv venv
. venv/bin/activate
sudo apt-get install python3-pyqt5
pip3 install -r requirements.txt

python3 app.py

Linking the Spotify App

Run app.py to start the application.

On the Spotify App that you have created, take the values of Client ID, Client Secret and Redirect URI (Redirect URL is found when the "EDIT SETTINGS" button is clicked) from the website and input them into their respective textboxes. To make sure the correct username is entered into the username textbox, go to this link, get your exact username string and paste it (you only need to do this if you sign into Spotify using a service such as Facebook).

On first start up, Spotlightify will cache all of your liked and playlist songs, caching both song information and album art. So keep the app open for at least 10 minutes so that all of your songs can be cached.

Installing Fonts

The fonts found in assets/fonts must be installed for this to display correctly.

Usage

The GUI is activated by using the shortcut ctrl + space. Here is the current list of available functions:

List of Commands

| Name     | Description                                        | Prefix            | Parameter     |
|----------|----------------------------------------------------|-------------------|---------------|
| Play     | Find and play a song                               | play              | song name     |
| Queue    | Find and queues a song                             | queue             | song name     |
| Playlist | Find and play a saved/followed playlist            | playlist          | playlist name |
| Album    | Find and play a saved album                        | album             | album name    |
| Artist   | Find and play songs from a saved/followed artist   | artist            | artist name   |
| Liked    | Plays saved/liked music                            | liked             | None          |
| Volume   | Changes music volume                               | volume            | 1 - 10        |
| Go to    | Seeks a position in a song                         | goto              | e.g. 1:24     |
| Resume   | Resumes music playback                             | resume            | None          |
| Skip     | Skips the current song                             | next              | None          |
| Previous | Plays pervious song                                | previous          | None          |
| Pause    | Pauses music playback                              | pause             | None          |
| Shuffle  | Toggles shuffle playback                           | shuffle           | None          |
| Device   | Select device for music playback                   | device            | None          |
| Repeat   | Toggles repeating modes                            | repeat            | None          |
| Current  | Provides currently playing song info               | currently playing | None          |
| Share    | Copies the current song's URL to clipboard         | share             | None          |
| Exit     | Exits the application                              | exit              | None          |

List of Song Options

| Name                      | Description                                        |
|---------------------------|----------------------------------------------------|
| Add Song to Queue         | Adds the selected song to the queue                |
| Add Song to Playlist      | Adds the selected song to the selected playlist    |
| Play Song Radio           | Plays a Spotify radio related to the selected song |
| Save/Like Song            | Saves the selected song to user Spotify library    |
| Share Song                | Copies the selected song's URL to the clipboard    |

Song options are shown by holding down either shift key and left clicking/pressing the enter key on the song.

Additional Information

Built With

  • Spotipy - A Spotify API wrapper for Python
  • PyQt5 - A cross platform GUI framework for Python

Reddit Posts

Contributing

Join us on discord to discuss how to contribute to the project.

spotlightify's People

Contributors

cmd0 avatar jac0b-w avatar marianito412 avatar markmcmoran avatar petergmurphy avatar tomdvies avatar wllkle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spotlightify's Issues

[BUG] Can't kill process after crash

OS: Windows 10

If you press the system tray icon repeatedly it becomes unresponsive. The windows 'this program is unresponsive' dialog doesn't kill the app and neither does task manager. VS Code also failed to kill. I also I tried taskkill in an elevated command prompt but I still couldn't kill the process. The only way to fix this that I know of is to restart my system.

Test results with non-premium account

doesn't work. gives this error(i removed part of the device_id:

HTTP Error for PUT to https://api.spotify.com/v1/me/player/play?device_id=c4c852afd11255147f14f324fc30924f******** returned 403 due to Player command failed: Premium required  
[ERROR] Could not toggle playback. Make a device has been selected. Use the 'device' command to select` the appropriate device```

[Task] Create a Share Command

Create a command that copies the currently playing song link to the user's clipboard.

What it must include:

  • A command which allows the user to copy the currently playing song's URL to clipboard.
  • Info about the track which is currently playing e.g. title: Share [SONG_NAME], description: Copy Spotify song URL to clipboard

[Task] Fuzzy-like Cache Searching

Description:
Modify the cache search (found in spotlight/suggestions/commands/play.py begining at line 48) to fulfill requirements.

Requirements:

  • Change from the linear search algorithm currently in use to a more efficient search algorithm, such as a binary search algorithm.
  • Remove special characters from search e.g. '.', '@' or "'" etc. So that they are not necessary for user to input to find song.
    • e.g. for the User-Queries: "cant hold us" or "can't hold us" | Result: Can't Hold Us - feat. Ray Dalton
  • I (Peter) have tried using some fuzzy text matching libraries but they have been extremely slow and inefficient. Maybe try and make some small fuzzy-like text matching if possible.
  • Any other search refinements you deem useful.

[Task] Add Options for Songs, Artists, Playlists and Albums

Description:
Create option commands for song, artist, playlist and album items. Options should be displayed for said items when a user focuses an item on the UI, then hits shift + enter on the item. Also when shift is held, small cog icons should appear beside the appropriate items.

Requirements:

  • Small cog icon appears when left-shift is held.
  • Appropriate options should be shown when item options are activated via shift + enter.

'right click' menu appearing when opening spotlight

Thanks for the great repo!

Just one small strange thing.. whenever I open the spotlight with ctrl+enter, a right click menu appears behind the spotlight and kills the spotlight unless I start typing right away.

I'm on Mac OS 10.15.5. Wondering if there is some kind of mapping collision, or if its related to the app.

I'm attaching a screenshot.

Thanks!

Screen Shot 2020-07-10 at 10 36 35 AM

Not sure if this is related, but I get the following error on startup each time:

[CACHE] [ARTIST] Skipping caching, last updated Fri 10 Jul 10:13:43 2020
HTTP Error for GET to https://api.spotify.com/v1/albums/7JbUvdIr1yepIxZy9rt3un/tracks/ returned 404 due to error
Exception in thread Thread-8:
Traceback (most recent call last):
  File "/Users/carlosgonzalezoliver/Projects/spotlightify/venv/lib/python3.7/site-packages/spotipy/client.py", line 175, in _internal_call
    response.raise_for_status()
  File "/Users/carlosgonzalezoliver/Projects/spotlightify/venv/lib/python3.7/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.spotify.com/v1/albums/7JbUvdIr1yepIxZy9rt3un/tracks/?limit=50&offset=0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/carlosgonzalezoliver/anaconda3/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/Users/carlosgonzalezoliver/Projects/spotlightify/caching/threads.py", line 278, in run
    song_data = self.get_all(self.sp.album_tracks(album_id=album["id"]))
  File "/Users/carlosgonzalezoliver/Projects/spotlightify/venv/lib/python3.7/site-packages/spotipy/client.py", line 358, in album_tracks
    "albums/" + trid + "/tracks/", limit=limit, offset=offset, market=market
  File "/Users/carlosgonzalezoliver/Projects/spotlightify/venv/lib/python3.7/site-packages/spotipy/client.py", line 210, in _get
    return self._internal_call("GET", url, payload, kwargs)
  File "/Users/carlosgonzalezoliver/Projects/spotlightify/venv/lib/python3.7/site-packages/spotipy/client.py", line 190, in _internal_call
    headers=response.headers,
spotipy.exceptions.SpotifyException: http status: 404, code:-1 - https://api.spotify.com/v1/albums/7JbUvdIr1yepIxZy9rt3un/tracks/?limit=50&offset=0:
 error

No identifiable running process

PID(s) should easily be identifiable on the system running spotlightify.

How it should look on Linux CLI

mark@DESKTOP-V5FN9GN:~$ ps -ef | grep "spotlightify" | grep -v grep mark 47 46 0 15:54 tty1 00:00:00 spotlightify

Having it like this will let you kill troublesome running sessions without unintentionally killing your IDE session, or the Python session.

Suggestion:

Use the os module, it has methods like os.getpid() to retrieve the PID.

Unit testing

I think that Unit testing should be carried out, Python has a predefined module called unittest.

[Issue] cache_songs crash

Thread crashes as sometimes song["track"] is None, giving a TypeError. It does not happen with any particular song just at the end of a specific playlist.

[Task] Create a Currently Playing Command

What is must include:

  • A command with prefix "current"
  • The command must be displayed in the following format:
    title: Current Song is [SONG_NAME]
    description: By [ARTIST_NAME/S]

Run Spotlightify

This question is straight forward, I did install it and got it to run. But after turn your computer on. How do you run the application when there is not exe file. More confused than anything else.

Font overhead issue

After installing the font, I'm still getting the following message:
qt.qpa.fonts: Populating font family aliases took 415 ms. Replace uses of missing font family "SF Pro Display Light" with one that exists to avoid this cost.

Unable to use ctr + space to bring up spotlightify

As the title suggests, I get this error after following the installation step on my Mac OS and am unable to hit ctrl + space to bring up spotlightify.

[CACHE] Starting
Starting image cache thread
[CACHE] Initialised
[CACHE] Starting
[CACHE] Initialised
[CACHE] Starting

195
[CACHE] Terminating
Error occurred removing key from pressed_keys
Error occurred removing key from pressed_keys
Error occurred removing key from pressed_keys
Error occurred removing key from pressed_keys
Error occurred removing key from pressed_keys
[CACHE] Terminating
Error occurred removing key from pressed_keys
Error occurred removing key from pressed_keys

[Bug] Logout on "python3 app.py"

Hi,

When I run python3 app.py, it justs logs out after like 10 seconds

I'm running Pop!_OS 22.04 LTS

I captured the output :

Welcome to Spotlightify


Starting auth process... 

 
[CACHE] [MANAGER] Initialised

[CACHE] [SONG] Initialised
[CACHE] [IMAGE] Initialised
[CACHE] [PLAYLIST] Initialised
[CACHE] [LIKED] Initialised
[CACHE] [ALBUM] Initialised
[CACHE] [ARTIST] Initialised
[CACHE] [SONG] Starting
[CACHE] [IMAGE] Starting
[CACHE] [PLAYLIST] Starting
[CACHE] [LIKED] Starting
[CACHE] [ALBUM] Starting
[CACHE] [PLAYLIST] Skipping caching, last updated jeu 02 jun 2022 18:38:31
[CACHE] [ARTIST] Starting
[CACHE] [ARTIST] Skipping caching, last updated jeu 02 jun 2022 18:38:32
[Error] could not select default device.
[CACHE HOLDER] Reloading JSON File
arguments did not match any overloaded call:
  QPoint(): too many arguments
  QPoint(int, int): argument 2 has unexpected type 'float'
  QPoint(QPoint): argument 1 has unexpected type 'int'
Starting auth process... 

 
threads can only be started once
Starting auth process... 

And then there's like a hundred

threads can only be started once
Starting auth process... 

And I'm logged out of my session

I checked config.json, the fields are exactly what they need to be

Did I do something wrong? I don't really understand those errors

[Issue] Access Token Not Refreshing

App fails to refresh the API user token if it has been open for longer than one hour. At the moment the app requires a restart for the token to be refreshed. This needs to be fixed.

The function to refresh tokens can be found inside of app.py on the master branch.

[Issue] GUI Activation

Using ctrl + space momentarily opens GUI, but it vanishes almost immediately afterwards. In certain cases, the GUI will stay open if I use the shortcut directly after running the app, but if I change windows, etc., the shortcut fails. Usually I can open the GUI by clicking on the menu bar icon.

[Task] Change how songs are searched for better results

Implement a better system for correctly finding songs based on text input. Some kind of fuzzytext matching may be necessary although this may not be ideal. The current code for this can be found at spotlight/commands/play.py within the SongCommand method on line 50.

Conversion of UI from PyQt to ElectronJS

Discussed with Peter conversion of UI to another language:

Proxy of the backend to frontend would be more feasible to get around the issue of Python's GIL locking to a single thread.

Technologies considered?

  • Flask (for proxying Python to frontend)
  • ElectronJS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.