Spotify Plugin

473 views
Skip to first unread message

Yifan Jin

unread,
Aug 3, 2013, 3:14:57 AM8/3/13
to quicksilver-...@googlegroups.com
Hi All,

I just finished an at lease usable Spotify Plugin for Quicksilver, Supports some control commands include:

Dcrease Volume
Increase Volume
Mute
Next Song
Previous Song
Play
Pause
Play/Pause

Share on Twitter

I also added Shuffling and Repeat commands but they do not work properly, they can stop shuffling and repeat but cannot start, I don't know why.

You can check source code here: https://github.com/Doraemoe/Spotify-Plugin-for-Quicksilver

Download link: https://dl.dropboxusercontent.com/u/1660391/Spotify%20Plugin.qsplugin.zip

If you have any comments please let me know, I'm willing to improve it :)

Rob McBroom

unread,
Aug 6, 2013, 8:46:44 AM8/6/13
to quicksilver-...@googlegroups.com
On Sat Aug 03 2013 at 03:14:57, Yifan Jin wrote:

You can check source code here: https://github.com/Doraemoe/Spotify-Plugin-for-Quicksilver

Download link: https://dl.dropboxusercontent.com/u/1660391/Spotify%20Plugin.qsplugin.zip

If you have any comments please let me know, I'm willing to improve it :)


Great. We love new plug-ins! I’ll look it over when I get a chance and let you know if I have any suggestions.

-- 
Rob McBroom
<http://www.skurfer.com/>

Rob McBroom

unread,
Sep 11, 2013, 9:10:01 AM9/11/13
to quicksilver-...@googlegroups.com
I can’t actually build/run it since I don’t have Spotify installed, but here are some observations from poking around.

The Info.plist isn’t showing up in the project.

The extendedDescription is missing. If you just rename `README.md` to `Documentation.mdown` and build again, the Markdown should be converted to HTML and stuck into the plist automatically. See http://projects.skurfer.com/QuicksilverPlug-inReference.mdown#documentation-and-bltrversion

The catalog preset doesn’t need to be nested with children since there’s only one item, unless you think additional presets will be added in the near future.

I think the stuff under QSRequirements was copied from the iTunes plug-in and probably doesn’t belong here. Same for the stuff under QSResourceAdditions.

The QSSpotify_PluginActionProvider class appears to be empty, so you can probably just remove it. You might want to change the reference under QSActionProviders to the class you actually use, but if that might be unused. I suppose you would have noticed if the thing wasn’t working at all. :-) Same for the QSSpotify_PluginSource class.

I don’t know much about Spotify, but is there nothing useful that can be added to the catalog, like Artists, Albums, Playlists, etc?

Sorry it took so long to get back to you.

Yifan Jin

unread,
Nov 1, 2013, 10:42:11 PM11/1/13
to quicksilver-...@googlegroups.com, mailin...@skurfer.com
Thanks Rob! Sorry I don't have time to fix it until now.

I added Info.plist to the project list, weird it dosen't show up.

The automatic conversion from markdown to html doesn't work for me so I manually converted it and added it to the extended description.

I noticed the catalog problem too, maybe it's a silly question but actually I don't know how not to nested it with children.

Yeah, the QSRequirements was copied from the iTunes plug-in and I deleted them now. For those in QSResourceAdditions, I want to brorrow some icons from it so I will leave it there :P

I deleted the QSSpotify_PluginActionProvider class, no problem occured, seems I never used them...

It will be good to add Playlists and Following to the catalog, but Spotify does not provide any method to do so, hope they will open these part in the furture.

Anyway, thanks for all those suggestions!

Best

Rob McBroom

unread,
Nov 4, 2013, 10:19:04 AM11/4/13
to quicksilver-...@googlegroups.com

On 1 Nov 2013, at 22:42, Yifan Jin wrote:

Thanks Rob! Sorry I don't have time to fix it until now.

No problem. Here are some more comments.

I added Info.plist to the project list, weird it dosen't show up.

I see it now. I also see a broken (red) reference to Spotify Info.plist. That can be removed.

The automatic conversion from markdown to html doesn't work for me so I manually converted it and added it to the extended description.

Hmmm. Not sure why that would be, but it you don’t mind doing it manually, that’s fine.

The documentation says the commands are all prefixed with ‘S’, but that doesn’t appear to be the case in the plist. I wouldn’t do that, anyway. Use full words, like “Spotify Play”. Users can still find the commands just by typing “spl” if they want, but it will look nicer. Personally, I would add something to the end of all the commands instead, like “Play (Spotify)”. Similar to how we handle the “Current Web Page” for all the different browsers.

I noticed the catalog problem too, maybe it's a silly question but actually I don't know how not to nested it with children.

It looks like you inured that out.

Yeah, the QSRequirements was copied from the iTunes plug-in and I deleted them now. For those in QSResourceAdditions, I want to brorrow some icons from it so I will leave it there :P

You might want to remove the QSProxies and QSEventTriggers. They might cause useless things to appear in the interface.

I deleted the QSSpotify_PluginActionProvider class, no problem occured, seems I never used them...

What about QSSpotify_PluginSource? It looks like it’s still there and still adding a useless test object to the catalog.

Yifan Jin

unread,
Jan 4, 2014, 10:34:42 PM1/4/14
to quicksilver-...@googlegroups.com, mailin...@skurfer.com
Thanks Rob, I fixed all the problems (I hope...). If I have time I will look into if it's possible for me to add playlist information to the catalog.

Rob McBroom

unread,
Jan 9, 2014, 1:55:36 PM1/9/14
to quicksilver-...@googlegroups.com

On 4 Jan 2014, at 22:34, Yifan Jin wrote:

Thanks Rob, I fixed all the problems (I hope...). If I have time I will look into if it's possible for me to add playlist information to the catalog.

Looks good. I just saw two small things:

  1. There’s a typo in the documentation. “relays” should be “relies”.
  2. The QSResourceAdditions section of the plist can be removed. It just redefines resources from the iTunes plug-in (and would conflict if they ever change).

Yifan Jin

unread,
Apr 25, 2014, 2:46:45 AM4/25/14
to quicksilver-...@googlegroups.com
Sorry it might be a stupid question, I want to add a preference panel to this plugin, so I followed the instruction in the Plugin Development Reference but the preference panel dosen't appear. The problem is like this: http://d.pr/i/DFYI

Funny thing is, after I compiled another plugin with preference panel and added it into Quicksilver,  the preference panel of this plugin will appear (but the new one won't). I'm wondering maybe I need to init something? Can anyone help? Thanks.

Rob McBroom

unread,
Apr 25, 2014, 3:43:33 PM4/25/14
to quicksilver-...@googlegroups.com

On 25 Apr 2014, at 2:46, Yifan Jin wrote:

Sorry it might be a stupid question, I want to add a preference panel to
this plugin, so I followed the instruction in the Plugin Development
Reference but the preference panel dosen't appear. The problem is like
this: http://d.pr/i/DFYI

Funny thing is, after I compiled another plugin with preference panel and
added it into Quicksilver, the preference panel of this plugin will appear
(but the new one won't). I'm wondering maybe I need to init something? Can
anyone help? Thanks.

I don’t see any obvious problems. The only real difference I see is that you have Auto Layout enabled. We were turning that off to support 10.6, but that’s no longer a requirement. Still, I wonder if maybe it’s causing the controls to be displayed outside the bounds of the visible area or something.

If you figure it out, let me know so I can update the reference. If not, send me a copy of the generated Spotify.h so I can try building it myself.

Yifan Jin

unread,
Apr 27, 2014, 12:02:02 AM4/27/14
to quicksilver-...@googlegroups.com, mailin...@skurfer.com
Thanks, I tried to roll back to previous version and redone the add panel process, it works now, maybe I made some minor mistakes last time.

Yifan Jin

unread,
Dec 5, 2014, 9:29:03 PM12/5/14
to quicksilver-...@googlegroups.com
Hi,

I'm currently revisiting this plugin and want it to have more functions. However, I encountered some problems while trying to add some items to the catalog. I know Quicksilver will use
- (BOOL)indexIsValidFromDate:(NSDate *)indexDate forEntry:(NSDictionary *)theEntry
function to check whether catalog needs to be updated, and if yes, Quicksilver will use
- (NSArray *)objectsForEntry:(NSDictionary *)theEntry
to update the catalog.

However, since I'm dealing with online resources, all request to the online server are operated asynchronously. That means, if I want to request new items in the function
- (NSArray *)objectsForEntry:(NSDictionary *)theEntry
I don't know when the request resources will ready, thus at the end of this method I don't know what to return.

So my question is, is there a way to manually trigger catalog refresh when I am certain my request resource are ready? Thanks.


On Saturday, August 3, 2013 5:14:57 PM UTC+10, Yifan Jin wrote:

Rob McBroom

unread,
Dec 7, 2014, 9:47:29 AM12/7/14
to quicksilver-...@googlegroups.com

On 5 Dec 2014, at 21:29, Yifan Jin wrote:

I'm currently revisiting this plugin and want it to have more functions.
However, I encountered some problems while trying to add some items to the
catalog. I know Quicksilver will use
- (BOOL)indexIsValidFromDate:(NSDate *)indexDate forEntry:(NSDictionary *)theEntry
function to check whether catalog needs to be updated, and if yes,
Quicksilver will use
- (NSArray *)objectsForEntry:(NSDictionary *)theEntry
to update the catalog.

However, since I'm dealing with online resources, all request to the online
server are operated asynchronously. That means, if I want to request new
items in the function
- (NSArray *)objectsForEntry:(NSDictionary *)theEntry
I don't know when the request resources will ready, thus at the end of this
method I don't know what to return.

I know exactly what you mean.

https://github.com/quicksilver/Quicksilver/issues/1766

For now, you’ll have to get creative and employ some work-arounds.

The short answer is to return nil if you’re just initiating the request for remote data. But then you’ll need logic to see if that’s the case, or if data is available to turn into QSObjects.

Maybe you could initiate the request in indexIsValidFromDate:forEntry:, always returning YES, then force a rescan when results are ready (see below). That assumes indexIsValidFromDate:forEntry: won’t be called when you invalidate the entry, but I’m pretty sure that’s the case.

So my question is, is there a way to manually trigger catalog refresh when
I am certain my request resource are ready?

You can tell Quicksilver the source is invalid. That will trigger a rescan.

[[NSNotificationCenter defaultCenter] postNotificationName:QSCatalogSourceInvalidated object:@"name of catalog source"];

There are examples of this in the iTunes plug-in.

Let me know if you have any additional questions.

Yifan Jin

unread,
Dec 30, 2014, 5:59:21 AM12/30/14
to quicksilver-...@googlegroups.com, mailin...@skurfer.com
Hi Rob,

First of all, thanks for your previous answer, with your help, I did managed to add what I want to the catalog. However, I got a new problem. If I search what I added to the catalog, Quicksilver will crash, but if I go to Preference-Catalog-Spotify and double click what I added to the catalog, it works just fine. So what dose Quicksilver do when I search for an item? The crash log looks like

 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull isEqualToString:]: unrecognized selector sent to instance XXXXXXX, or
 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]: unrecognized selector sent to instance XXXXXXX

Now, where should I look at to find what I did wrong in the code? Thanks.

Best,
Yifan.

Rob McBroom

unread,
Dec 30, 2014, 2:08:27 PM12/30/14
to quicksilver-...@googlegroups.com

On 30 Dec 2014, at 5:59, Yifan Jin wrote:

The crash log looks like

Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[NSNull isEqualToString:]: unrecognized selector sent to instance
XXXXXXX, or
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[NSNull length]: unrecognized selector sent to instance XXXXXXX

Now, where should I look at to find what I did wrong in the code? Thanks.

It looks like there’s an instance of NSNull where Quicksilver expects to see an instance of NSString. Are you setting anything to NSNull? The first things I’d check are the identifier, name, and details for the objects.

Yifan Jin

unread,
Dec 30, 2014, 8:46:53 PM12/30/14
to quicksilver-...@googlegroups.com, mailin...@skurfer.com
I found a special playlist created by Spotify itself has no identifier :P

Thank you for your hint.

Yifan Jin

unread,
Sep 24, 2015, 11:39:01 PM9/24/15
to Quicksilver - Development
Hi,

I'm now thinking to further improve this plugin, for now I added an option to let user access their private playlists.

I'm thinking is it possible to let this plugin included in the plugin section inside Quicksilver? Dose it require anything?

Best.

Rob McBroom

unread,
Sep 25, 2015, 6:27:41 AM9/25/15
to Quicksilver - Development
On 24 Sep 2015, at 23:39, Yifan Jin wrote:

> I'm now thinking to further improve this plugin, for now I added an
> option
> to let user access their private playlists.

Cool.

> I'm thinking is it possible to let this plugin included in the plugin
> section inside Quicksilver? Dose it require anything?

When you feel like it’s ready, one of us can look it over and then
make it available in the update system.

Yifan Jin

unread,
Sep 28, 2015, 10:26:58 PM9/28/15
to Quicksilver - Development, mailin...@skurfer.com
Great, thank Rob. I have uploaded a new version, it should be ready now, please have a check.
 

Patrick Robertson

unread,
Oct 6, 2015, 8:16:39 PM10/6/15
to quicksilver-...@googlegroups.com
I’ve just looked through the code, and it all looks good to me - great job!
The only small thing I noticed is that there shouldn’t be a need to include the “QSInterface.framework” files in the project.

We’ll try and get it into the official list and make an announcement on Twitter soon. Thanks for all your hard work Yifan :-)

-- 
You received this message because you are subscribed to the Google Groups "Quicksilver - Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quicksilver---deve...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yifan Jin

unread,
Oct 11, 2015, 6:57:03 AM10/11/15
to Quicksilver - Development
Hi Patrick,

Thank you, but I think maybe it is not a good idea to include this plugin yet, I just found the following problem:

Apple now introduced "App Transport Security" in 10.11 and Xcode 7. However, spotify's authorization server does not meet the security standard yet. As a result,  if one want to auth his/her account in my plugin, the web page will not load and return a "NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)" error. The only solution now is to edit info.plist in quicksilver to allow insecure connection, this is not a good practice in anyway. Thus I would recommend to wait until spotify changed their server setting.

Thanks.

Best.
To unsubscribe from this group and stop receiving emails from it, send an email to quicksilver---development+unsub...@googlegroups.com.

Patrick Robertson

unread,
Oct 11, 2015, 9:11:09 AM10/11/15
to quicksilver-...@googlegroups.com
Aaah, that’s a shame. I’m sure they’ll change it over pretty quickly. We need to do the same in the app itself anyway.


I prefer to use encrypted email. You can find my public key here.
Learn how to encrypt your email with the Email Self Defense Guide

To unsubscribe from this group and stop receiving emails from it, send an email to quicksilver---deve...@googlegroups.com.

Yifan Jin

unread,
Nov 7, 2015, 8:20:23 PM11/7/15
to Quicksilver - Development
Hi,

I just found a small problem in this plugin. The thing is, if I uncheck those commands (play,pause,etc.) in preference--catalog--contents, they will still appear when I search for commands in QS. If I uncheck those playlists, they will disappear as intended. This also happened in iTunes plugin, is there any way to fix it?

I'm also not sure about the precedence of actions, is 0 the highest precedence or 4? I feels like whenever I add an new action, the new action will be the default action for my defiend type no matter what the precedence is.

Thanks.


On Saturday, August 3, 2013 at 5:14:57 PM UTC+10, Yifan Jin wrote:

Rob McBroom

unread,
Nov 11, 2015, 8:59:48 AM11/11/15
to Quicksilver - Development
On 7 Nov 2015, at 20:20, Yifan Jin wrote:

> I just found a small problem in this plugin. The thing is, if I
> uncheck
> those commands (play,pause,etc.) in preference--catalog--contents,
> they
> will still appear when I search for commands in QS. If I uncheck those
> playlists, they will disappear as intended. This also happened in
> iTunes
> plugin, is there any way to fix it?

It’s obviously a problem with Quicksilver, so I wouldn’t hold up the
plug-in for that reason. Feel free to investigate and fix it in QS,
though. :-)

> I'm also not sure about the precedence of actions, is 0 the highest
> precedence or 4? I feels like whenever I add an new action, the new
> action
> will be the default action for my defiend type no matter what the
> precedence is.

4 is higher. Note that the precedence is only considered when an action
is added for the first time. Once it’s on the list, it doesn’t move
unless the user moves it (via Preferences). Also, if that action is the
only one that applies to your type, it will be default, but that’s
never really true since there are some actions that apply to everything.

I would keep the precedence at 2 or lower. That’s usually enough to
get something ranked at the top. And never set a precedence for actions
that apply to existing types, because it could mess up a user’s
defaults for that type.
Reply all
Reply to author
Forward
0 new messages