Language…
14 users online:  AmperSam, Dan2point5, Dangil, drkrdnk, Gasterus155, Giftshaven, JPhanto, kirsvantas, nonamelol1,  patcdr, reevebarusadar8, signature_steve, Sokobansolver, tOaO - Guests: 255 - Bots: 354
Users: 64,795 (2,377 active)
Latest user: mathew

SMWC Preview

Tools → SMWC Preview

Submission Details

Name: SMWC Preview
Author: trillian
Added:
Operating System: Windows, Mac OS X, Linux
Platforms: General
Games: General
Source Available: Yes
Featured: No
Website: Link
Description: This is a Python tool/Chrome extension that adds a "Preview"/"Play" button to SMWC submissions. Install instructions are in README.
Requirements: Google Chrome, Python 3.6+, Zenity if on OSX or Linux. Tested on Windows and Linux. Should also work on OS X, but I don't have a Mac, so I'm not really sure.
Demo video: https://youtu.be/iVYV18Iizig

There is an alternative install method now, you can install with a userscript. This has the advantage that you don't need to install an untrusted extension. Simply install in userscript mode and add the userscript to your browser. Currently not supported on Mac OS X.

If someone knows how to create native dialogs from python on OSX, please tell me.

Edit 1: fix installer (it would error on windows)
Edit 2: fix gen_settings (oh my god i'm bad at this "programming" thing)
Edit 3: fix dialog boxes on non-Windows platforms. Also do some proper testing.
Edit 4: include chrome_ext folder to make loading as unpacked extension easier.
Edit 5: hopefully fix windows again (i should probably create a github repo for this)
Edit 6: Added userscript install. Also created github repo, as promised.
Tags: browser-extension preview
Comments: 20 (jump to comments)
Rating:
4.3 (8 ratings)
No rating
Download 15.53 KiB | 552 downloads

Screenshots

Comments (20)

Regulous Link
Thanks a bunch, its working after applying that patch.
trillian Author Link
That appears to be caused by Cloudflare's anti-urllib measures. Here's a patch that you can apply to python_code/common.py to make it use requests, which is a different Python HTTP library that isn't blocked by Cloudflare. If you apply it then remember to also install requests using pip since it isn't included with Python by default.
Regulous Link
I'm having issues with this now, whereas I wasn't a couple months ago. After checking the error log I'm wondering if smwc has inadvertently blocked it by trying to prevent scrapers - ie https://dl.smwcentral.net/{item_id}/ works in my browser but according to the error log its giving a urllib.error.HTTPError: HTTP Error 403: Forbidden.
trillian Author Link
I haven't tested it in 3.7 but looking at the changelog, it should work just fine.
Alex119098 Link
Would this also be compatible with the newest version of Python, version 3.7?
SlameGut Link
I can't get this to work at all 😧
 RPG Hacker Link
Amazing! *_*
Thanks a lot. Also send me a PM so that we can arrange when and where I shall kiss your feet. ;)
trillian Author Link
I'm using Firefox right now, and it's working fine. Sadly i couln't get the extension-based version working, so you will have to use userscript install instead. Someone actually asked me on Discord about userscript install on firefox, so i made some image instructions here.
 RPG Hacker Link
Pretty amazing script! Something like this is what I've been looking for. Now if someone could somehow make the same thing work in Firefox, I would kiss their feet!
trillian Author Link
Since there is a command prompt, I assume you installed in userscript mode? If you get as far as a command prompt opening and closing, that already means that most stuff works. If you go to the smwc_preview folder, in there should be a uri_handler folder. Is there a file named "error.log" in there? If there is, please upload it on pastebin and link here.

(I should really update the readme with all the troubleshooting instructions)
RenkoV2 Link
yeah I did, it doesn't change anything, whenever I click the preview button it just opens a command prompt that instantly closes.
Alex119098 Link
Did you check developer mode in extensions? That should be the trick.
RenkoV2 Link
I can't get it to work, any time I put it on chrome, chrome automatically disables it, also could this work for opera? i mean opera is pretty similar to chrome
Mogu94 Link
Man, this is such a useful tool. Thanks a lot!
trillian Author Link
When you installed python, did you check the "install py launcher" option? Because that is required. You can try replacing pyw -3 with pythonw and see if that fixes it.
IanBoy Link
Got the script working now, but it gives me an error once opening something like a hack or a song saying that a file (pyw) was not found.
trillian Author Link
What do you mean, updated userscript.js? That file should always stay the same. (besides, i think i renamed it to smwc_preview.user.js anyways)
I made image instructions about how to install the userscript as a tampermonkey script:
https://cdn.discordapp.com/attachments/372700421812256768/373550218693574656/tampermonkey_instructions.zip
IanBoy Link
It doesn't give me an updated chrome_ext.crx/userscript.js even though I placed all the things I wanted into the same folder as the program and ran install.py and gen_settings.py in that order. The Preview button doesn't show up on anything at all. What am I doing wrong?
trillian Author Link
It is a combination of a Chrome extension and a native application. I can't do it with userscripts since I need to send "native messages" and I don't know of any userscript extension that allows that.
lx5 Link
If this can be made an extension, is there a chance that this could be made a userscript for Greasemonkey?