[LB6 Action] Search Spotify (with predictions) [V 2.0]

Sharing and discussing custom actions for LaunchBar
Nosrac
Rank 1
Rank 1
Posts: 33
Joined: Sun Jun 22, 2014 10:07 pm

[LB6 Action] Search Spotify (with predictions) [V 2.0]

Post by Nosrac » Thu Jul 03, 2014 11:46 pm

- Search for Artists, Albums, and Songs
- Now displays up to 3 songs, 3 artists, and 3 albums like Spotify. The best result will still rise to the top.

Image

https://github.com/Nosrac/LBSpotify
Last edited by Nosrac on Wed Aug 13, 2014 3:34 am, edited 3 times in total.

Nosrac
Rank 1
Rank 1
Posts: 33
Joined: Sun Jun 22, 2014 10:07 pm

Re: [LB6 Action] Search Spotify (with predictions)

Post by Nosrac » Thu Jul 03, 2014 11:51 pm

Anyone with a little expertise mind helping me figure out something?

I want each result to open a URL as its action. What's the best way to do that?

In my code, you'll notice I've tried this:

Code: Select all

// 'action' => "open.sh",
// 'actionArgument' => $track->href,


But it still runs code from default.js

Right now, I have something of a hack setup to make it work :lol:

veke
Rank 2
Rank 2
Posts: 49
Joined: Mon Nov 06, 2006 11:30 am

Re: [LB6 Action] Search Spotify (with predictions)

Post by veke » Fri Jul 04, 2014 12:26 pm

Cool! It would be nice with a similar one for iTunes Store?

TheEndless
Posts: 1
Joined: Fri Jul 04, 2014 1:15 pm

Re: [LB6 Action] Search Spotify (with predictions)

Post by TheEndless » Fri Jul 04, 2014 1:18 pm

Looks great, but doesn't work on my system. Action always responds with "TypeError: 'undefined' is not an object"

My fault?

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: [LB6 Action] Search Spotify (with predictions)

Post by manfred » Fri Jul 04, 2014 5:54 pm

Nice action, nosrac!

Nosrac wrote:I want each result to open a URL as its action. What's the best way to do that?

In my code, you'll notice I've tried this:

Code: Select all

// 'action' => "open.sh",
// 'actionArgument' => $track->href,



I guess the solution is pretty easy for you. Replace the above one with

Code: Select all

'url'=>$track->href


By the way, with LaunchBar bundled are pretty nice music related icons.
E.g. you can reference LaunchBar's icons using the bundle id. So track
icon would be:

Code: Select all

'icon' => "at.obdev.LaunchBar:AudioTrackTemplate"

Nosrac
Rank 1
Rank 1
Posts: 33
Joined: Sun Jun 22, 2014 10:07 pm

Re: [LB6 Action] Search Spotify (with predictions)

Post by Nosrac » Fri Jul 04, 2014 9:27 pm

TheEndless wrote:Looks great, but doesn't work on my system. Action always responds with "TypeError: 'undefined' is not an object"

My fault?


Would you try downloading again? I think manfred's help might've fixed this.

Nosrac
Rank 1
Rank 1
Posts: 33
Joined: Sun Jun 22, 2014 10:07 pm

Re: [LB6 Action] Search Spotify (with predictions)

Post by Nosrac » Fri Jul 04, 2014 10:06 pm

New version!

- Results now include Artists and Albums

Ayla
Posts: 17
Joined: Mon Jul 07, 2014 12:22 pm

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by Ayla » Mon Jul 07, 2014 12:25 pm

Hi

Downloaded the latest version, and installed it, but when I try and run it, I get this error:
Attachments
Screen Shot 2014-07-07 at 12.23.45.png
Error Dialog
Screen Shot 2014-07-07 at 12.23.45.png (23.41 KiB) Viewed 17708 times

robynw
Posts: 3
Joined: Mon Jul 07, 2014 9:55 pm

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by robynw » Mon Jul 07, 2014 10:06 pm

Ayla wrote:Hi

Downloaded the latest version, and installed it, but when I try and run it, I get this error:


I'm having the same problem...

Nosrac
Rank 1
Rank 1
Posts: 33
Joined: Sun Jun 22, 2014 10:07 pm

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by Nosrac » Tue Jul 08, 2014 2:26 am

The two of you having problems:

I just fixed a bug that broke "free form" searches, that wasn't your problem was it?

If not, what countries are you from? I'm wondering if the Spotify API isn't supported in your region

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by manfred » Tue Jul 08, 2014 9:38 am

It works perfectly for me. Robyn & Ayla when you see this alert, open your Console.app and
check for messages from LaunchBar. Usually this gives more informations why the action failed.

Ayla
Posts: 17
Joined: Mon Jul 07, 2014 12:22 pm

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by Ayla » Tue Jul 08, 2014 1:44 pm

Thanks for the replies.

Downloaded the latest version, still get the same error.

I'm in Denmark (and a Spotify subscriber of course).

Also, I'm using an Alfred Spotify workflow that works just fine.

Console error:

Code: Select all

08/07/14 13.42.59,334 LaunchBar[44888]: Search Spotify (com.kyleacarson.LaunchBar.action.SearchSpotify): Unhandled Exception in script "default.js": TypeError: 'undefined' is not an object {
}

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by manfred » Tue Jul 08, 2014 2:17 pm

Thanks for posting the output Ayla. You are trying to open the action with return, right?
Pressing space should work fine.

Nosrac, the reason for this issue is that you do not define a run function in your default.js file.

Code: Select all

function run() {

}

We will improve the alert text in the next version of LaunchBar.

Ayla
Posts: 17
Joined: Mon Jul 07, 2014 12:22 pm

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by Ayla » Tue Jul 08, 2014 2:26 pm

Yes, it works using space instead of return.

But, no matter what I search for ("Madonna" for example), Spotify tells me: "Your search did not match anything in our catalogue.....", when I press enter on the result in LB.

I'm using the latest Spotify Desktop app.

Nosrac
Rank 1
Rank 1
Posts: 33
Joined: Sun Jun 22, 2014 10:07 pm

Re: [LB6 Action] Search Spotify (with predictions) [V 1.5]

Post by Nosrac » Tue Jul 08, 2014 6:42 pm

Ayla wrote:Yes, it works using space instead of return.

But, no matter what I search for ("Madonna" for example), Spotify tells me: "Your search did not match anything in our catalogue.....", when I press enter on the result in LB.

I'm using the latest Spotify Desktop app.


Hey Ayla, I think my last update caused this bug. Would you update again and let me know if it works for you now?

Post Reply