Jump to content

Moby Games workflow


Recommended Posts

Posted (edited)

Search Moby Games in Alfred

 

Requirements:

 

Results

  • Game Title
  • Release Platforms and Years
  • Cmd: Moby Games URL
  • Cmd+Shift: Official URL

 

Supports

  • keyword, for searching typed query
  • hotkey, for searching with selected text

 

Config

  • keyword
  • API Key, with instructions

 

https://github.com/gingerbeardman/alfred-moby-games

 

alfred-moby-games.png.729908a7271539ffcadc36358c76eb59.png

Edited by gingerbeardman
  • 3 weeks later...
Posted

@gingerbeardman I have this one almost ready to add, there’s just a couple of details needed:

  • Are you able to provide a retina screenshot? If not let me know and I’ll try to reproduce.
  • The icon is smaller than the minimum 256x256 px. Do you have a larger one?
Posted

I should’ve asked for you to mention me when done. I didn’t see the edit until now because I specifically searched for it. I have this almost ready to go, but I noticed a problem when testing. All of this information must be present:

 

ckgf5J4.png

 

Well, not exactly all of it, but at the very least the Placeholder Title must be there, otherwise users won’t get any feedback that the workflow even exists until it finished running. In other words, you can type moby yoyo and still see no indication the workflow is installed or running until two seconds later when the API returns and the results suddenly populate. It not being there also prevents users from ↩ on it when partially typing the name to make it bubble to the top.


The Please Wait Subtext is also useful to indicate when the workflow is contacting the API.

 

Also, it seems that ↩ and ⌘↩ have the exact same behaviour. Is that correct?

 

Finally, I noticed you have an extraneous script and Flickr icon in the workflow.

  • 3 weeks later...
Posted (edited)

Thanks! Great improvements @vitor thanks for the PRs I would have not seen these forum replies for a while.

 

I have no idea how the Flickr icon got in there, and also the repo had even more unused files.

 

The "brief.sh" script I may use in future so I've left it for now has been removed.

 

> Also, it seems that ↩ and ⌘↩ have the exact same behaviour. Is that correct?

 

Yes, for now, maybe in future I'll decide a different use for one of them.

 

Thanks for the sanity check.

 

v1.2 is released https://github.com/gingerbeardman/alfred-moby-games/releases/tag/1.2

 

cheers

 

 

Edited by gingerbeardman
Posted
14 hours ago, gingerbeardman said:

It would be cool if it could say how easy and free it is to get the "API Key from Moby Games."

 

What I mean is there is no approval or waiting needed.

 

The messaging for dependencies (including API keys) is standardised as opposed to freeform. The consistency does wonders.

 

Also worth noting being free with no waiting period is the norm for workflows in the Gallery that ask for an API key.

 

2 hours ago, gingerbeardman said:

Version 1.4 is live

 

Live now in the Gallery as well.

Posted
2 hours ago, gingerbeardman said:

blog

 

Nice clean look, I like it. I also noticed a few nice indicators:

  • The pin emoji is for a pinned post. No surprise there.
  • The PlayDate-related posts have a yellow background! Nice touch, I enjoyed figuring out the rule.

What’s the heart icon, though? I can see in the DOM that it’s a “fave”, but in practice, what does that mean? Is it for posts you think came out particularly good?

Posted (edited)

Hey! As someone who was just using moby as a web search option, this was super cool to see! It was only working for single-word inputs for me, so I went ahead and added it so it works for multi-word inputs as well if you want to add that to the main functionality:

#!/usr/bin/env zsh

api_key="${moby_games_api_key}"

if [[ $api_key ]]
then

    title="$*"

    url="https://api.mobygames.com/v1/games"

    json=`curl --get --data-urlencode "format=normal" --data-urlencode "limit=25" --data-urlencode "title=$title" --data-urlencode "api_key=$api_key" $url`

    json=${json:gs/\"games\"\:/\"items\"\:}
    json=${json:gs/"game_id"/"uid"}
    json=${json:gs/"moby_url"/"url"}

    # remove description to speed things up
    json=`echo -E $json | jq '.items |= map(del(.description))'`

    # add arg which is the URL we will pass to Open URL
    json=`echo -E $json | jq '.items[] |= (. + {arg: .url})'`

     # add platforms and release years as subtitle
    json=`echo -E $json | jq '.items |= map(. + {subtitle: (.platforms | map("\(.platform_name) (\(.first_release_date[0:4]))") | join(", "))})'`

    # cmd for Moby Games URL, cmd+shift for Official URL
    json=`echo -E $json | jq '.items |= map(if .official_url then
                                . + {mods: {
                                    cmd: {valid: true, arg: .url, subtitle: .url},
                                    "shift+cmd": {valid: true, arg: .official_url, subtitle: .official_url}
                                }}
                            else
                                . + {mods: {
                                    cmd: {valid: true, arg: .url, subtitle: .url}
                                }}
                            end)'`

    echo -n $json

fi

Thank you for making this workflow a reality! Just a suggestion.

Edited by philocalyst
Posted (edited)
On 8/4/2024 at 6:19 PM, vitor said:

I also noticed a few nice indicators:

  • The pin emoji is for a pinned post. No surprise there.
  • The PlayDate-related posts have a yellow background! Nice touch, I enjoyed figuring out the rule.

What’s the heart icon, though? I can see in the DOM that it’s a “fave”, but in practice, what does that mean? Is it for posts you think came out particularly good?

Posts about Macintosh and Windows also have different colour background.

 

The "heart" icon is on posts that are my personal favourites, posts that took a lot of work, or most popular in the feedback I've received. It's just a way of me showing the posts new visitors might want to read first.

 

I'm not mad keen on the pin symbol, I'd prefer it to be mono, but I couldn't find an alternative that looked good.

 

Thanks for reading

 

Edited by gingerbeardman
Posted (edited)
On 8/6/2024 at 10:17 PM, philocalyst said:

Hey! As someone who was just using moby as a web search option, this was super cool to see! It was only working for single-word inputs for me, so I went ahead and added it so it works for multi-word inputs as well if you want to add that to the main functionality:

 

Added in 1.5 ! With a credit to you, thanks.

 

https://github.com/gingerbeardman/alfred-moby-games/releases/tag/1.5

 

Cheers

Edited by gingerbeardman
Posted
56 minutes ago, gingerbeardman said:

I'm not mad keen on the pin symbol, I'd prefer it to be mono, but I couldn't find an alternative that looked good.

 

If you need it to be text, then I’m also not familiar with a good looking alternative. But if it can be SVG, here’s a quick drawing:

 

<svg viewBox="0 0 38 68" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2">
  <path d="M16 37.764C6.937 36.324 0 28.466 0 19 0 8.514 8.514 0 19 0c10.487 0 19 8.514 19 19 0 9.466-6.936 17.324-16 18.764V65a2.999 2.999 0 1 1-6 0V37.764ZM19 9c5.52 0 10 4.481 10 10a2 2 0 0 0 4 0c0-7.727-6.272-14-14-14a2 2 0 0 0 0 4Z"/>
</svg>

 

It looks like this:

 

8RwliH5.png

Posted (edited)

That's nice, I'll put it on my list of things to do... 

 

Oh, and I just remembered that I have a calendar emoji for annual posts. I'll look at doing a custom font with a few characters for all these symbols.

 

Thanks for the idea!

Edited by gingerbeardman
Posted

Would you consider adding a fallback search option? Mainly for when the API is being slow, the ability to open it in the traditional Moby search would be comforting to me.

Posted (edited)

Sure, if you want to have a go I'll accept the code change.

Bonus points if you can submit as a GitHub Pull Request.

 

Otherwise, I will get around to it at some point soon.

 

 

Edited by gingerbeardman
Posted
5 hours ago, philocalyst said:

fallback search option?

 

Open Alfred, paste this link and press ↩

 

alfred://customsearch/Moby%20Games/moby/utf8/nospace/https://www.mobygames.com/search/?q=%7Bquery%7D

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