Snazzah / SublimeDiscordRP

📄 Discord rich presence for Sublime Text
MIT License
131 stars 35 forks source link

Host list of supported file type icons online #68

Open FichteFoll opened 3 years ago

FichteFoll commented 3 years ago

Instead of bundling the list of supported file type icons, I believe it would be more convenient to modify the list of supported icons from a remote place, have the plugin fetch the mapping as a JSON file from some static URL, cache that locally, and base icon name resolution on that. With this, it wouldn't be required to package a new release simply for an added icon.

A suitable location would be a JSON file in the default branch, where it would double-serve as an automatically semi-up-to-date fallback for packaged releases (readable via sublime.load_resource).

Snazzah commented 3 years ago

Sounds like a great idea. Not sure how to get a remote resource (since I haven't done much with sublime packages) but this would work better than making a patch release on every update. Feel free to PR if you want since I might be too busy to focus on this.

FichteFoll commented 3 years ago

You could easily use urllib.request.urlopen, i.e.

with urllib.reques.urlopen(ICON_MAP_URL) as response:
    if response.status != 200:
        raise RuntimeError("whatever")
    data = json.load(response)

Alternatively, requests as a dependency.

I don't have a personal interest in this as I don't use the package and have much higher priority issues, so don't count on me for a PR. I just noticed through my notifications that the last couple releases were only icon additions.

Snazzah commented 3 years ago

I'll look into doing this later.