Coder Social home page Coder Social logo

shyykoserhiy / vscode-spotify Goto Github PK

View Code? Open in Web Editor NEW
601.0 14.0 72.0 741 KB

Use Spotify inside vscode(on Mac, Windows, and Linux).

Home Page: https://marketplace.visualstudio.com/items/shyykoserhiy.vscode-spotify

License: MIT License

TypeScript 100.00%

vscode-spotify's Introduction

Latest Release Installs Rating

vscode-spotify

All Contributors

Use Spotify inside vscode. Provides integration with Spotify Desktop client.

Note that some of the functionalities are only available on macOS systems (see How it works section)

This extension requires Spotify Premium to work on Windows

How it works

  • On macOS, this extension uses spotify-node-applescript (basically a wrapper for the official Spotify AppleScript API) to communicate with Spotify.
  • On Windows, the extension uses the Spotify Web API.
  • On Linux, it uses a combination of dbus and pactl.

Spotify Web API implementation can be used on any platform, but it does have some drawbacks:

  • It doesn't work without internet connection (Linux and OS X implementations do).
  • Full functionality is only available to Spotify Premium users.
  • API calls are rate limited.

At the same time it provides tighter integration and it's more or less future proofed.

Features

  • Shows the currently playing song in the vscode status bar. status bar
  • Provides commands for controlling Spotify from vscode.
  • Provides hotkeys of commands.
  • Provides buttons for controlling Spotify from vscode.

Compatibility table

Feature macOS Linux Any Platform (only option on Windows) Web API
Works Offline
Show Current Song
Play Next Song
Play Previous Song
Play
Pause
Play Pause
Mute Volume
Unmute Volume
Mute Unmute Volume
Volume Up
Volume Down
Toggle Repeating (shows repeating state) ⭕
Toggle Shuffling (shows shuffling state) ⭕
Lyrics

Additional Web API features:

  • Playlists/tracks selection. Make sure you have logged in with the command >Spotify Sign In to use these features. You can open the Virtual Studio Code command line with the hotkey Ctrl+P by default.

Contributing

This project follows the all-contributors specification. Contributions of any kind are welcome, any contributions made will be recognised in the README.

A list of contributors to this project (emoji key):


shyyko.serhiy

💻 🎨 📖 🤔 👀

Levin Rickert

🐛 💻

Marc Riera

💻

Evan Brodie

💻 🐛

Stéphane

📖

Ryan Gordon

📖 🤔

Richard Stanley

💻

realbizkit

💻

Jesús Roldán

💻

Nicolás Gebauer

💻

Muhammad Rivki

💻

Miguel Rodríguez Rosales

💻

Mosh Feu

📖

Adam Parkin

📖

Andrew Bastin

📖

Michael Fox

📖

Matija Mrkaic

💻

Mario

📖

Fernando B

💻

Commands

There are a number of commands available for the extension, and accessible via the command pallette. Find them by searching for "Spotify" in the command pallette:

Commands

Adding or changing hotkeys

All keyboard shortcuts in vscode can be customized via the User/keybindings.json file.

To configure keyboard shortcuts the way you want, go to the menu under File > Preferences > Keyboard Shortcuts. This will open the Default Keyboard Shortcuts on the left and your User/keybindings.json file where you can overwrite the default bindings on the right. You may also see an interface to modify the shortcuts on different versions of vscode.

Example :

{
		"command": "spotify.volumeDown",
		"key": "cmd+shift+g"
}

For more info on hotkeys please look at https://code.visualstudio.com/docs/customization/keybindings

Buttons

This extension provides a variety of buttons to control Spotify from status bar. By default 4 buttons are enabled:

  1. Previous track
  2. Play / Pause
  3. Next track
  4. Mute / Unmute

You can modify the shown buttons by changing your parameters (go here to find out how):

"spotify.showNextButton": {
	"type": "boolean",
	"default": true,
	"description": "Whether to show next button."
},
"spotify.showPreviousButton": {
	"type": "boolean",
	"default": true,
	"description": "Whether to show previous button."
},
"spotify.showPlayButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show play button."
},
"spotify.showPauseButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show pause button."
},
"spotify.showPlayPauseButton": {
	"type": "boolean",
	"default": true,
	"description": "Whether to show play|pause button."
},
"spotify.showMuteVolumeButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show mute button."
},
"spotify.showUnmuteVolumeButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show unmute button."
},
"spotify.showMuteUnmuteVolumeButton": {
	"type": "boolean",
	"default": true,
	"description": "Whether to show mute|unmute button."
},
"spotify.showVolumeUpButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show volume up button."
},
"spotify.showVolumeDownButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show volume down button."
}
"spotify.showToggleRepeatingButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show toggle repeating button."
},
"spotify.showToggleShufflingButton": {
	"type": "boolean",
	"default": false,
	"description": "Whether to show toggle shuffling button."
}

For the full configuration options go here.

Note that due to limitations of Spotify's Applescript API toggleRepeatingButton toggles only 'repeat all' property of spotify. There is no way to set 'repeat one' via vscode-spotify.

You can also change the position of buttons by changing the parameters below:

"spotify.priorityBase": {
	"type": "number",
	"default": 30,
	"description": "Base value of priority for all vscode-spotify elements in Status Bar(priority = basePriority+priority). This is done to avoid 'conflicts' with other extensions. "
},
"spotify.nextButtonPriority": {
	"type": "number",
	"default": 8,
	"description": "Priority of next button."
},
"spotify.previousButtonPriority": {
	"type": "number",
	"default": 10,
	"description": "Priority of previous button."
},
"spotify.playButtonPriority": {
	"type": "number",
	"default": 7,
	"description": "Priority of play button."
},
"spotify.pauseButtonPriority": {
	"type": "number",
	"default": 6,
	"description": "Priority of pause button."
},
"spotify.playPauseButtonPriority": {
	"type": "number",
	"default": 9,
	"description": "Priority of play|pause button."
},
"spotify.muteButtonPriority": {
	"type": "number",
	"default": 5,
	"description": "Priority of mute button."
},
"spotify.unmuteButtonPriority": {
	"type": "number",
	"default": 4,
	"description": "Priority of unmute button."
},
"spotify.muteUnmuteButtonPriority": {
	"type": "number",
	"default": 3,
	"description": "Priority of mute|unmute button."
},
"spotify.volumeUpButtonPriority": {
	"type": "number",
	"default": 2,
	"description": "Priority of volume up button."
},
"spotify.volumeDownButtonPriority": {
	"type": "number",
	"default": 1,
	"description": "Priority of volume down button."
},
"spotify.trackInfoPriority": {
	"type": "number",
	"default": 0,
	"description": "Priority of volume track info."
},
"spotify.toggleRepeatingButtonPriority": {
	"type": "number",
	"default": 11,
	"description": "Priority of toggle repeating button."
},
"spotify.toggleShufflingButtonPriority": {
	"type": "number",
	"default": 12,
	"description": "Priority of toggle shuffling button."
}

Seeking to a specific point in a song

You can use Spotify Seek To command (spotify.seekTo) to seek to the specific point in a song. You can specify hotkey that will seek to a custom time in a song by adding keybinding in keybindings.json. For example:

{
    "command": "spotify.seekTo",
    "key": "alt+d",
    "args": "1:15"
}

MIT LICENSE

vscode-spotify's People

Contributors

andrewbastin avatar audstanley avatar ecbrodie avatar gitryder avatar k-yle avatar levrik avatar matijamrkaic avatar mikqi avatar misterfoxy avatar moshfeu avatar mrcasals avatar negebauer avatar realbizkit avatar ryan-gordon avatar shyykoserhiy avatar xebuz 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  avatar  avatar  avatar  avatar  avatar  avatar

vscode-spotify's Issues

Can't use tab with playlists and tracks

Hi,

I have a problem with the extension. I'm able to use shortcuts like play/next etc... at the bottom of vscode but when I open the tab, it's empty and a popin appear with this error code:

vscode-spotify: You should be logged in order to use this feature.

Did I miss something ? I'm on ubuntu with Spotify Desktop app running and a premium account. (edit: online mode on)
Thanks for you help and thanks you for this extension !

More buttonz

image

Start/stop is pretty nice but having prev next here would be just awesome, it's basically unused space.

Thanks for the plugin btw it's really cool.

Is there a way to disable shortcuts?

Hello, thanks for this great extension!

I was wondering if there is anyway to just disable shortcuts in your extension and keep vscode default ones?

Thank you

Show album title

Hi!

First of all, thanks for your work on this extension, it's very handy!

Is there any way to show the album title next to the track title? Something like Artist name - Track name - Album name would work for me.

I don't know much about how VSCode extensions work, soI can't help much, but if you don't have time to work on this I might be able to pull something off if you give me some hints on where to start 😄

Thanks!

Plugin breaks my entire vscode setup

Since the last update the plugin breaks all my vscode plugins.

Even the git builtin plugin is not working anymore when the plugin is enabled. Took me some time to figure it out. I guess it's caused by the last update?

Let me know if you need some more info.

Status Bar Icons Disappeared

The controls that were in the status bar have disappeared. However, the keyboard shortcuts and controlling the extension through the command palette still works.

Cannot see current Song.

The current song playing is not visible after logging in. My VSCode Version is :

Version: 1.28.1 (user setup)
Commit: 3368db6750222d319c851f6d90eb619d886e08f5
Date: 2018-10-11T18:13:53.910Z
Electron: 2.0.9
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

There is no User Setting for showing Current Song.

[Feature] Focus on song

The clicking on song title on the bottom (notification bar) to focus it in the plugin list on the left side

Force Web API not working on MacOS

I already authed and everything was fine with the Spotify app, but it uses a lot of CPU and I'd rather use the web API.

I switched to the web API in the settings, but now when I try to play anything, I get the message:

vscode-spotify: Failed to perform operation Unknown error: status code404 ; { "error" : { "status" : 404, "message" : "No active device found" } }

vscode-spotify: Failed to perform operation Unknown error: status code 403

I just installed vscode-spotify and connected it to my Spotify account but it seems that I can't get it working, whenever I try to put a playlist it outputs this:

vscode-spotify: Failed to perform operation Unknown error: status code403 ; {
  "error" : {
    "status" : 403,
    "message" : "Not available for the current user"
  }
}

Image

vscode_spotify_error

I'm using Linux, by the way...

Documentation missing for showSignInButton/showSignOutButton

I think this should be added to the documentation, since your code already shows the button no matter the setting if we are logged out, I decided to hide the button.

"spotify.showSignInButton" : true,
"spotify.showSignOutButton" : false,

Failed to perform operation when select a track

I'm trying to click on a track (any track) in tracks list and I get this error:

vscode-spotify: Failed to perform operation Unknown error: status code403 ; { "error" : { "status" : 403, "message" : "Not available for the current user" } }

Thanks!

UI glitches: Pause icon incorrect, icon size differs

Hi!

Thanks for an interesting extension. 👍 I am using it on macOS.

I noted two minor details:

  1. The pause button is slightly "wrong", it looks like a "stop" button instead of pause: https://github.com/ShyykoSerhiy/vscode-spotify/blob/master/src/SpotifyControls.ts#L72
  2. The width of primitive-square and triangle-right differs with a pixel or two, which means that the status bar "jumps around" when you play/pause the music.

Suggestions on how to fix these, and I'll gladly submit a PR.

When Spotify is not open: "Failed to initialize vscode-spotify. We'll keep trying every 20 seconds."

Configuration

  • vscode-spotify version 2.1.1
  • VS Code 1.16.1
  • Spotify client 1.0.63.617.g5aca9a2a
  • macOS Sierra, 10.12.6 (16G29)

Summary

When Spotify is not currently running, newly started Code windows seem to throw an error. I don't think this happened before.

Regardless of whether or not "spotify.useCombinedApproachOnMacOS": true is set in my VSCode config, if Spotify is not open when VSCode is started, this error still occurs.

To Reproduce

  1. Quit Spotify and VSCode.
  2. Launch VSCode from the command line (code .). Probably this will also happen if launched from the Finder or Spotlight.
  3. After a little while, VSCode will raise the above error.
  4. Quit VSCode
  5. Launch Spotify
  6. Launch VSCode
  7. The error does not appear, and after a short period of time the Spotify controls appear in the gutter of the VSCode window as expected.

Feature: Add support for Spotify Connect

Would like to optionally control which device spotify is playing on from my editor.

screen shot 2018-04-06 at 15 08 33

Could fit as a button next to the song title that opens a omniwindow with a list of devices to chose from. Or maybe its better to keep it just as a cmd + shift + p type setting so as not to clutter the bottom bar

Wrong stopped/playing state

If I launch VSCode while Spotify was already playing it shows me the stop/play button as if the music was not playing (it shows play button):

image

If I hit that play button, the music actually stops and it shows a stop icon:

image

It might be a small bug due to an assumption about the initial state of things.

Spotilocal is not initialized.

I am getting the error message, running vsc 1.26.1 on win10 version1803

vscode-spotify: Failed to play. We are going to retry reinit spotilocal. Spotilocal is not initialized.

when i ping spotsa.spotilocal.com, results seems fine:

PS C:\Users\Baran> ping spotsa.spotilocal.com

Pinging spotsa.spotilocal.com [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Local server seems to be running aswell:

PS C:\WINDOWS\system32> netstat -bano | Select-String spotify -Context 0,1

>  [Spotify.exe]
    TCP    0.0.0.0:57621          0.0.0.0:0              LISTENING       12964
>  [Spotify.exe]
    TCP    25.44.156.214:139      0.0.0.0:0              LISTENING       4
>  [Spotify.exe]
    TCP    192.168.1.37:55810     192.121.140.177:80     ESTABLISHED     12964
>  [Spotify.exe]
    TCP    192.168.1.37:56058     151.101.0.133:443      ESTABLISHED     12884
>  [Spotify.exe]
    TCP    192.168.1.37:56475     204.79.197.200:443     ESTABLISHED     12864
>  [Spotify.exe]
    UDP    0.0.0.0:3389           *:*                                    1092
>  [Spotify.exe]
    UDP    0.0.0.0:65417          *:*                                    12964
>  [Spotify.exe]
    UDP    25.44.156.214:137      *:*                                    4

Installed vscode-spotify extension but not working

Just installed vscode-spotify extension with:

ext install shyykoserhiy.vscode-spotify

Relaunched VSCode and the bar is not showing up. Spotify Desktop Client is running but there are no controls in VSCODE. Ubuntu 18.04

EDIT:

Just closed VSCode and Spotify, launched first Spotify and after VSCode. The bar is still missing

Lyrics in split panel window

Hello, thanks for this great extension!

It would be nice if when the lyrics window opens, instead of a full window, it opened as split panel one.

Thanks!

Song lyrics not found

The plugin occasionally fails to find song lyrics on macOS 10.13.4 High Sierra. Some of the songs it fails to find lyrics for have worked before (also, their lyrics appears on genius). Genius wasn't down at the time of the errors either.

For example, this appears in an editor named vscode-spotify:

Song lyrics for 21 Savage - Rap Saved Me not found.
 You can add it on https://genius.com/ .

Spotify version: 1.0.77.338.g758ebd78

How do you log in?

When clicking the spotify icon in the explorer bar, I get: vscode-spotify: You should be logged in order to use this feature. Screenshot:

screen shot 2018-10-10 at 10 17 11 am

How do you log in?

VS Code: 1.28
Spotify Extension: 3.0.4
OS: OSX Sierra (10.12.6)

Implement "Add to favorite"

This is a request for a button "Add to favorite" like you have in Spotify next to the current song.

I don't know if this is possible with the API you're using, but it would be so great, because right now I have to reopen my spotify which is minimized in the notification zone only to add a song to a my favorites.

Not working?

Nothing appears after installation. VSC 1.21.0 on macOS 10.13.3.

Icon order issue

For some reason the php debug extension inserts it's icon between some of your icons.
image
As you can see it's between the play and song title icon ^

Spotify auth does not work

The callback URL gets opened in the browser and shows

Cannot GET /

Edit:

After looking in the code the local server uses /callback but Spotify redirects to /.
Maybe some misconfiguration in the Spotify app?
It works if I manually change the URL to /callback in the browser.

Smaller icon size in Activity bar

Please make a smaller icon in the activity bar. It is too large.
Debug icon also circle has 28px x 28px
Spotify icon has 32px x 32px
Maybe you see different icon sizes if you have different resolution.
Mine is 2560 x 1440.

Thanks

Changing the search API

I didn't find how to change the search API and, because of that, I created a PHP script to changing it to Vagalume, I think it is better than Genius, you can use an specific key just by attributing it to api variable, feel free to editing the file and don't forget to changing "spotify.lyricsServerUrl" inside VS Code. You can use another search API if you want and know how to do this.
lyrics.zip

Authentication fails on 3.0.0

Steps to reproduce

  1. Push Spotify Sign In button.
  2. Firefox opens https://vscode-spotify-auth.azurewebsites.net/?message=You%20can%20now%20close%20this%20tab.
  3. vscode-spotify says Failed to retrieve access token : "state_mismatch"

image

showInformationMessage(`Failed to retrieve access token : ${JSON.stringify(e)}`);

Environments

vscode-spotify version
3.0.0
vscode version
1.27.2
os
Linux 4.18.5-arch1-1-ARCH #1 SMP PREEMPT Fri Aug 24 12:48:58 UTC 2018 x86_64 GNU/Linux

Doesn't play well with debug session

I wonder if this is intentional or not, but the "back/stop/forward" buttons get placed before any VS Code debug session information, and then the song title etc gets placed after the debug session information:

image

I think it would make perhaps more sense if all the information was contained, but I don't know - are there good reasons for the current behavior?

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.