Jump to content

CardSearch — Search for trading card game cards


vitor

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). If mtg_sort_by_rarity is set to true, cards are sorted by descending order of rarity.


:mtgrebuild updates the card database.


BTK0EmR.png

 

Download | Source

Edited by vitor
Link to post
  • 11 months later...
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?

Link to post
  • 4 months later...

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.
 

Link to post
  • 5 months later...

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.

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>'

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.

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!

Link to post
  • 7 months later...

Update.


Consider special and bonus rarities (sorted below common).


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.

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...