Jump to content
vitor

CardSearch — Search for trading card game cards

Recommended Posts

Search for Magic: The Gathering cards by name with mtg followed by your search string.


8emieMU.png


↵ opens the card on the Scryfall card database; ⌘↵ pastes the name and URL as a markdown link; ⌥↵ pastes them separeted by a colon. ⇧ or ⌘Y gives a quicklook preview of the card, with the mtg_image_size Workflow Environment Variable controlling the size (from biggest to smallest: png, large, normal, small).


:mtgrebuild updates the card database.


0VMpnsH.png

Download | Source

Edited by vitor

Share this post


Link to post

Update.


Added paste options. Paste as a Markdown link or the name and URL separated by a colon.


To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.

Share this post


Link to post

Update.


Fix for cards whose newest editions have no multiverse id.


To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.

Share this post


Link to post
16 minutes ago, nikivi said:

Hope it’s not too off topic.

 

Considering that since its inception this Workflow has only supported a single game, I’d say it’s on topic!

 

16 minutes ago, nikivi said:

do you play magic: the gathering online?

 

Nope. Even if I wanted to, don’t you need Windows for that?

Share this post


Link to post

Update.


Correct outputting name in arguments.


To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.

Share this post


Link to post

Update.

  • Removed option to search non-english names.
  • Faster to search for cards, because it now downloads and saves the entire database.
  • Faster to display quicklook cards because it defaults to a lower-quality (but still pretty good) preview image.
  • Displays mana colours in icons.


To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.
 

Share this post


Link to post

I haven't been able to get this to work.  Whenever it tries to rebuild it returns with the notification: "Error rebuilding card database"

 

Console had a lot to say.

The first error was:

cannot open file at line 42270 of [95fbac39ba]
error    13:42:01.909680 -0400    applet    os_unix.c:42270: (2) open(/var/db/DetachedSignatures) - No such file or directory

 

Googling indicates it's becoming common for the DetachedSignatures file to be missing, so I touched one to create it.

 

Next it was missing a "PlugIns" folder in the Notifier app bundle:

lsd    Non-fatal error enumerating at <private>, continuing: Error Domain=NSCocoaErrorDomain Code=260 "The file “PlugIns” couldn’t be opened because there is no such file." UserInfo={NSURL=PlugIns/ -- file:///Users/<myusername>/Library/Application%20Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9933E1BC-1B62-4C77-8EB5-61CAB19EDCF2/Notificator.app/Contents/, NSFilePath=/Users/<myusername>/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9933E1BC-1B62-4C77-8EB5-61CAB19EDCF2/Notificator.app/Contents/PlugIns, NSUnderlyingError=0x7ff04b4018f0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

 

So I created that directory, but alas it still won't run.

 

I think I'm hung up on this part of the console error:

 

default    14:01:22.605260 -0400    distnoted    register name: com.apple.nsquiet_safe_quit_give_reason object: com.vitorgalvao.alfred.cardsearch token: f4270 pid: 38070
default    14:01:22.689067 -0400    tccd    -[TCCDAccessIdentity staticCode]: static code for: identifier com.runningwithcrayons.Alfred, type: 0: 0x7f92abe0e9a0 at /Applications/Alfred 4.app
default    14:01:22.816648 -0400    applet            OSErr AERemoveEventHandler(AEEventClass, AEEventID, AEEventHandlerUPP, Boolean)(ascr,gdut handler=0x7fff44251005 isSys=YES) err=0/noErr
default    14:01:22.817321 -0400    applet    self-sent 'ascr'/'gdut' event accepted in process that isn't scriptable
default    14:01:22.820976 -0400    applet    UNIX error exception: 17
default    14:01:22.825030 -0400    applet    UNIX error exception: 17
default    14:01:22.830357 -0400    applet    UNIX error exception: 17
 

I did notice that the Alfred script for the :mtgrebuild keyword has "./build_cards_json", but the executable is named "./build_mtg_cards_json", (Notice the missing _mtg in the first string).  I added that, and it now takes much longer before it fails, but it does still fail with the error above.

 

Trying to run build_mtg_cards_json directly from terminal results in:

$ ./build_mtg_cards_json

./build_mtg_cards_json:6:in `join': no implicit conversion of nil into String (TypeError)

from ./build_mtg_cards_json:6:in `<main>'

 

But I don't know if that should work standalone or not.

Share this post


Link to post

I set the environment variables trying to get a little further, and hit this error:

 

$ ./build_mtg_cards_json

./build_mtg_cards_json:24:in `block in <main>': undefined method `empty?' for nil:NilClass (NoMethodError)

from ./build_mtg_cards_json:13:in `each'

from ./build_mtg_cards_json:13:in `<main>'

Share this post


Link to post
1 minute ago, DieselDM said:

I set the environment variables trying to get a little further, and hit this error:

 

$ ./build_mtg_cards_json

 

If you set a Workflow Environment Variable inside Alfred but then run the tool outside Alfred, it makes no difference.


The problem has been fixed; update to the latest version. The introduction of Art Series cards was the issue. The Workflow now ignores them, as it already did tokens.

Share this post


Link to post
4 hours ago, vitor said:

 

If you set a Workflow Environment Variable inside Alfred but then run the tool outside Alfred, it makes no difference.


The problem has been fixed; update to the latest version. The introduction of Art Series cards was the issue. The Workflow now ignores them, as it already did tokens.

I had set it in the terminal where I was trying to run the binary.

 

The latest version does indeed work.  Thanks!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...