Code Monkey home page Code Monkey logo

counsel-spotify's Introduction

Counsel Spotify

Little Emacs package to control Spotify app through an Ivy interface.

If I have seen further it is by standing on the shoulders of giants. Isaac Newton

This package is basically a port of helm-spotify and helm-spotify-plus with an Ivy interface. Many thanks to the authors of those for their amazing work!

Dependencies

Ivy

Notes on Spotify Web API authentication

You'll need to register an application in Spotify in order to obtain a client id and a client secret. Then, you'll have to set the variables counsel-spotify-client-id and counsel-spotify-client-secret variables with your credentials to start using the search feature

How to use it

This package exposes these search functions:

  • counsel-spotify-search-track
  • counsel-spotify-search-album
  • counsel-spotify-search-artist
  • counsel-spotify-search-playlist
  • counsel-spotify-search-tracks-by-album
  • counsel-spotify-search-tracks-by-artist

The options are fetched from Spotify REST API. Hitting RET while selecting an option will start playing that track or album (depending on what the search were). Also, hitting M-o will prompt a tiny menu with some more actions to choose from (for example, choosing to play the entire album a song belongs to)

Controllers

There are defined some basic controllers for the Spotify App

Action Function
Play counsel-spotify-play
Toggle play/pause counsel-spotify-toggle-play-pause
Next song counsel-spotify-next
Previous song counsel-spotify-previous

What if I want to use another Spotify client (like Mopidy or Spotifyd)?

Well, in that case I think you would be interested in two variables:

  • counsel-spotify-service-name is the name of the DBUS service counsel-spotify calls to handle the reproduction of a song
  • counsel-spotify-use-system-bus-p for some clients that use the system bus instead of the session

counsel-spotify's People

Contributors

jaor avatar jcf avatar lautaro-garcia avatar louixs 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

Watchers

 avatar  avatar  avatar

counsel-spotify's Issues

no applicable method: counsel-spotify-do-play

All search commands (counsel-spotify-search-album, -track, -artist etc) are failing for me:

Contacting host: accounts.spotify.com:443
cl-no-applicable-method: No applicable method: counsel-spotify-do-play, #s(counsel-spotify-linux-backend #s(counsel-spotify-backend-commands "Play" "PlayPause" "Next" "Previous")), nil

The next/previous/play commands work fine.

My API client and secret are valid since I use them with another spotify client without issue. This is Emacs 27.0.90. I am trying with the official Linux spotify client open, although I would eventually like to use spotifyd.

This is my use-package declaration:

(use-package counsel-spotify
  :ensure
  :commands counsel-spotify-start-search
  :after counsel
  :general
  (:keymaps 'space-menu-map
    "U" '(counsel-spotify-start-search :wk "spotify"))
  :config
  (defun counsel-spotify-start-search ()
    (interactive)
    (counsel-M-x "counsel-spotify-search-"))
  (setq counsel-spotify-service-name "spotify")
  (setq counsel-spotify-client-id my-counsel-spotify-client-id
        counsel-spotify-client-secret my-counsel-spotify-client-secret
        counsel-spotify-use-notifications nil))

The my-counsel-spotify- variables are set elsewhere.

Dbus calls not working

I had an issue while testing this package on Debian. The API calls would work fine, but when sending the commands through dbus, I would get the message:

dbus[4105]: arguments to dbus_message_new_method_call() were incorrect, assertion "_dbus_check_is_valid_member (method)" failed in file ../../../dbus/dbus-message.c line 1369.
This is normally a bug in some application using the D-Bus library.

  D-Bus not built with -rdynamic so unable to print a backtrace

I found that the function counsel-spotify-format-play-linux used format to supply the uri. Unfortunately, the escaping of " wasn't working on my computer ((format "OpenUri \"string:%s\"" "test") would return OpenUri \"string:test\" instead of OpenUri "string:test")

Testing with the change

(defun counsel-spotify-format-play-linux (uri)
  "Tell Spotify app to play the given URI."
  (format "OpenUri 'string:%s'" uri))

appears to work fine.

Software Version
counsel-spotify 20170612.1132
emacs 25.2.2
D-Bus 1.12.6

Search hangs and fails out when entering input too fast

I've noticed that the ivy-interface for searching is very slow and hangs quite a bit when entering input. It feels like a synchronous call to spotify on each character. There also seems to be a bit of a race condition when you enter a string too fast either:

  1. Characters are missing
  2. The window crashes

I can provide a screen recording on request.

I'm happy to look into fixing this, but wanted to validate whether this is confirmed behaviour first

ivy--dynamic-collection-cands: Wrong type argument: sequencep, 0

Hi, I'm pretty confident that this is an issue with my machine, but I'd really appreciate your help in troubleshooting!

All of the counsel-spotify-search- commands give me the error ivy--dynamic-collection-cands: Wrong type argument: sequencep, 0. I've set up an application through the Spotify Developers site to get a client id and secret, and I've set those to counsel-spotify-client-id and counsel-spotify-client-secret. I'm not sure where I'm going wrong here...

I've also tried spotify.el and I haven't been able to get that working either, so it likely isn't an issue with your package. I've tried two different spotify accounts, so it's unlikely to be an account-specific issue.

Any ideas what might be going wrong? Thank you!

Shell command succeeded with no output

This is a duplicate of #5 but I don't have permission to reopen it.
I have spotify open, but when I do counsel-spotify-play it returns "(Shell command succeeded with no output)".
I'm on emacs 26.3, macOS 10.15.4, and counsel-spotify from melpa.

Error when trying to search from emacs.

Dear,

Thanks for this great plugin, the control play, pause, next etc working like a charming,

But when tried to search in Emacs, by invoke cunsel-spotify-search-track etc,

It always shows

helm-M-x: make client process failed: Connection refused, :name, accounts.spotify.com, :buffer, #, :host, 127.0.0.1, :service, 6152, :nowait, nil, :tls-parameters, nil

I can confirm that the client security and client Id setting is correct.

Could you please help to investigate what's wrong on my side?

Related setting is quite simple as below

;;spotify configs
(require 'counsel-spotify)
(setq counsel-spotify-client-id "fae6e6ef787743fea5b649117d9a9b2a")
(setq counsel-spotify-client-secret "7a6b41fdd292498c9ca65a3484f12090")
(global-set-key (kbd "C-c s f") 'counsel-spotify-next)
(global-set-key (kbd "C-c s b") 'counsel-spotify-previous)
(global-set-key (kbd "C-c s p") 'counsel-spotify-toggle-play-pause) 

Thanks for the help :)

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.