[LB6 Action] IMDB Suggestions

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

[LB6 Action] IMDB Suggestions

Post by Nosrac » Tue Jul 08, 2014 1:46 am

Search IMDB with suggestions.

https://github.com/Nosrac/LBIMDB

Currently only suggests Movies and TV Shows. Actors (and anything else) can still be found by typing the full search and pressing enter.

Image

Note: Intended as a replacement for the Search Template
Last edited by Nosrac on Tue Jul 08, 2014 3:14 pm, edited 1 time in total.

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

Re: [LB6 Action] IMDB Suggestions

Post by Nosrac » Tue Jul 08, 2014 1:57 am

Which do you guys prefer for the icon?

Image

or

Screen Shot 2014-07-07 at 6.56.56 PM.png
Screen Shot 2014-07-07 at 6.56.56 PM.png (61.79 KiB) Viewed 5520 times

Jono
Rank 4
Rank 4
Posts: 161
Joined: Mon Feb 25, 2008 11:25 am
Location: UK
Contact:

Re: [LB6 Action] IMDB Suggestions

Post by Jono » Tue Jul 08, 2014 11:53 am

Nice, do you have a download link for the action?

For the icon I prefer the IMDB one, but I think it could be nice to make a black version with the letters cutout (hollow), and add template to the end of the name so that LaunchBar adds it's own nice effects to it (I could make it if needed).

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

Re: [LB6 Action] IMDB Suggestions

Post by Nosrac » Tue Jul 08, 2014 3:14 pm

Whoops! Here's a download link: https://github.com/Nosrac/LBIMDB

Jono wrote:For the icon I prefer the IMDB one, but I think it could be nice to make a black version with the letters cutout (hollow), and add template to the end of the name so that LaunchBar adds it's own nice effects to it (I could make it if needed).


If you could create that icon, that would be great. My photoshop skills aren't very impressive ;-)

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

Re: [LB6 Action] IMDB Suggestions

Post by Ayla » Wed Jul 09, 2014 10:28 am

Thanks for this :)

It doesn't work for me though, no suggestions appear and it seems to crash pretty bad according to Console log:

Code: Select all

09/07/14 10.27.00,763 LaunchBar[44888]: Error: Item properties in wrong format: Expected string for key “icon” but got Number.
09/07/14 10.27.03,042 at.obdev.LaunchBar.JavaScriptRunnerService[61280]: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSJSONSerialization dataWithJSONObject:options:error:]: value parameter is nil'
*** First throw call stack:
(
   0   CoreFoundation                      0x00007fff872c925c __exceptionPreprocess + 172
   1   libobjc.A.dylib                     0x00007fff8d9cbe75 objc_exception_throw + 43
   2   CoreFoundation                      0x00007fff872c910c +[NSException raise:format:] + 204
   3   Foundation                          0x00007fff814bc257 +[NSJSONSerialization dataWithJSONObject:options:error:] + 94
   4   at.obdev.LaunchBar.JavaScriptRunnerService 0x000000010964cbf1 ODEnclosingBundlePath + 11815
   5   CoreFoundation                      0x00007fff871b4a5c __invoking___ + 140
   6   CoreFoundation                      0x00007fff871b48c4 -[NSInvocation invoke] + 308
   7   JavaScriptCore                      0x00007fff83095f65 _ZN3JSC24ObjCCallbackFunctionImpl4callEP9JSContextP13OpaqueJSValuemPKPKS3_PS6_ + 293
   8   JavaScriptCore                      0x00007fff83095da9 _ZN3JSCL34objCCallbackFunctionCallAsFunctionEPK15OpaqueJSContextP13OpaqueJSValueS4_mPKPKS3_PS6_ + 233
   9   JavaScriptCore                      0x00007fff82e89bee _ZN3JSC18JSCallbackFunction4callEPNS_9ExecStateE + 510
   10  JavaScriptCore                      0x00007fff82de5a12 _ZN3JSC5LLInt9setUpCallEPNS_9ExecStateEPNS_11InstructionENS_22CodeSpecializationKindENS_7JSValueEPNS_17LLIntCallLinkInfoE + 738
   11  JavaScriptCore                      0x00007fff830637e3 llint_op_call + 169
   12  JavaScriptCore                      0x00007fff82deaa13 _ZN3JSC11Interpreter11executeCallEPNS_9ExecStateEPNS_8JSObjectENS_8CallTypeERKNS_8CallDataENS_7JSValueERKNS_7ArgListE + 595
   13  JavaScriptCore                      0x00007fff82dea7b5 _ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE + 69
   14  JavaScriptCore                      0x00007fff82dea6d5 JSObjectCallAsFunction + 661
   15  JavaScriptCore                      0x00007fff8301a93d -[JSValue callWithArguments:] + 301
   16  at.obdev.LaunchBar.JavaScriptRunnerService 0x000000010964775a at.obdev.LaunchBar.JavaScriptRunnerService + 5978
   17  libdispatch.dylib                   0x00007fff8322d1bb _dispatch_call_block_and_release + 12
   18  libdispatch.dylib                   0x00007fff8322a28d _dispatch_client_callout + 8
   19  libdispatch.dylib                   0x00007fff8322c673 _dispatch_queue_drain + 451
   20  libdispatch.dylib                   0x00007fff8322d9c1 _dispatch_queue_invoke + 110
   21  libdispatch.dylib                   0x00007fff8322bf87 _dispatch_root_queue_drain + 75
   22  libdispatch.dylib                   0x00007fff8322d177 _dispatch_worker_thread2 + 40
   23  libsystem_pthread.dylib             0x00007fff8902bef8 _pthread_wqthread + 314
   24  libsystem_pthread.dylib             0x00007fff8902efb9 start_wqthread + 13
)


If I remove these lines it works fine:

Code: Select all

    var icon = false;

        if (result.Type == "movie")
        {
            icon = "at.obdev.LaunchBar:MoviesTemplate";
        } else if (result.Type == "series") {
            icon = "at.obdev.LaunchBar:TVShowsTemplate";
        }


Also, you should change:

Code: Select all

   <key>LBTextInputTitle</key>
   <string>YouTube</string>

Jono
Rank 4
Rank 4
Posts: 161
Joined: Mon Feb 25, 2008 11:25 am
Location: UK
Contact:

Re: [LB6 Action] IMDB Suggestions

Post by Jono » Wed Jul 09, 2014 5:16 pm

Yea, doesn't work for me either.

Nosrac wrote:If you could create that icon, that would be great. My photoshop skills aren't very impressive ;-)

Try this one http://d.pr/f/uipV
(And update the name in the plist file to match the new one)

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

Re: [LB6 Action] IMDB Suggestions

Post by Nosrac » Thu Jul 10, 2014 12:30 am

Hey Ayla,

Would you give it another download? It was breaking for results that weren't movies/tv shows

Jono,

Thanks! Your icon is present in this version.


Everyone,

Would you try searching for 5 or 6 movies quickly? When I do it, the results slow down quite a bit. If it's not just me, the API provider (omdbapi.com) is likely rate limiting by IP address

Jono
Rank 4
Rank 4
Posts: 161
Joined: Mon Feb 25, 2008 11:25 am
Location: UK
Contact:

Re: [LB6 Action] IMDB Suggestions

Post by Jono » Thu Jul 10, 2014 12:36 pm

Thanks, working OK now.

I tried a few searches. It does seem to slow down now and then, but I wouldn't type lots of searches, one after the other anyway.

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

Re: [LB6 Action] IMDB Suggestions

Post by Ayla » Thu Jul 10, 2014 5:16 pm

Seems to work now, thanks... Can be a little slow at searching, but API to blame I guess :)

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

Re: [LB6 Action] IMDB Suggestions

Post by Nosrac » Thu Jul 10, 2014 8:36 pm

I'm thinking it would be ideal to delay sending the requests.

Currently if you type "game of", it sends 7 requests:
"g", "ga", "gam", "game", "game ", etc

Launchbar Devs:

Would it be possible to add an option to the Info.plist to delay requests for "live" suggestion scripts?

I could add something to my script but I figure I'm not going to be the last person to have this problem.

If not, let me know and I can force my script to sleep for 300ms or something before doing the request

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

Re: [LB6 Action] IMDB Suggestions

Post by manfred » Tue Jul 15, 2014 2:39 pm

Nosrac wrote:Would it be possible to add an option to the Info.plist to delay requests for "live" suggestion scripts?

I could add something to my script but I figure I'm not going to be the last person to have this problem.

If not, let me know and I can force my script to sleep for 300ms or something before doing the request

Actually this is something on our list, but no one implemented it yet ;) I will forward your request to the responsible
developer.

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

Re: [LB6 Action] IMDB Suggestions

Post by Nosrac » Wed Jul 16, 2014 2:25 am

manfred wrote:Actually this is something on our list, but no one implemented it yet ;) I will forward your request to the responsible
developer.


Great minds think alike!

Cool, till then I'll go ahead and wait in JS.

New version:
- When there are no results, the extension will explain why

Post Reply