Characterizer + API?


#1

Sorry to [REDACTED]


#2

Wow, I’ve been using characterizer and didn’t even realize you could add profiles; I’d be interested in this as well.

I’m
a bit swamped right now but if nobody else comes forward in the next
few days I’ll take a look. No promises, but it doesn’t seem overly
difficult.


#3

Hey. So I quickly made something just for you, it’s available on my personal server, which unfortunately doesn’t have a hostname yet. It’s quite stable though, so, theorically, it should be available whenever you need it.

Basically, just go to http://82.127.144.96/wkformatter.php and enter your API key in the field.
Then my (totally awesome) php script will generate an XML file that you can download and save and use wherever you need it.

I don’t use Firefox so I did not even test the XML file with Characterizer. Tell me if it’s what you need.

Also, a more effective way to get your XML file (when you need to update) is to bookmark the following address, replacing the “[your api key]” part by your api key:
http://82.127.144.96/wkformatter.php?apikey=[your api key]
Then you’ll just have to click your bookmarked link to directly obtain your updated XML file, without additional input. Isn’t that amazing?

And now, you can even download the (zipped) php page here:
http://82.127.144.96/files/wkformatter.zip


#4

@Doublevil:
Your XML contains duplicate keys. Characterizer wants those handled with semicolons:

<entry key=“reason” kanji=“由;理” />
Unfortunately, after sorting my xml file and taking care of the dupes, I got an error out of Characterizer:
TypeError: Components.classes[’@mozilla.org/extensions/manager;1’] is undefined
That doesn’t seem like your fault, though; I renamed one of the existing profiles and got the same error. Replacing a default XML file with the new one (who needs french anyway?) and restarting Firefox works, though.

Also, you should probably change the title string from ‘Heisig’ to ‘Wanikani’ or something.

Also also, thanks!



#5
protospork said... @Doublevil:
Your XML contains duplicate keys. Characterizer wants those handled with semicolons:
<entry key="reason" kanji="由;理" />
 Thanks, I did not know that. So if two kanji share the same meaning, I should write only one entry containing both. But nothing's wrong with having multiple entries for the same kanji, right?
   
protospork said...
Unfortunately, after sorting my xml file and taking care of the dupes, I got an error out of Characterizer:
TypeError: Components.classes['@mozilla.org/extensions/manager;1'] is undefined
That doesn't seem like your fault, though; I renamed one of the existing profiles and got the same error. Replacing a default XML file with the new one (who needs french anyway?) and restarting Firefox works, though.
Ok, merci pour le test! (haha, seems like you need french now!) :D

 
protospork said...
Also, you should probably change the title string from 'Heisig' to 'Wanikani' or something.
Oooh... so that's the name of the set...


I'll work on a fix for the duplication issue tomorrow morning (like 7 hours from now), as it's super late here and I need to get some sleep.

#6
Doublevil said... But nothing's wrong with having multiple entries for the same kanji, right?
Correct.
 

#8
siberianbreaks said... Oh my gosh, thank you so much!! :'D It works perfectly for me at the moment after replacing a profile and restarting. (I probably don't have enough kanji to get dupes, haha.) I seriously can't thank you enough though, this is just what I needed.
 You're welcome.
The duplicate issue is fixed. Well, at least, the only duplicate I seem to have works as expected.

#10

Aw, it is down.
I just levelled up, too :frowning:

Doublevil, I’d understand if you didn’t want to run this on your server anymore, but if that’s the case, would you mind showing us your code? I don’t have a php-enabled machine handy but it’d be easier to write a standalone script if I had a reference.

(Although naturally I’m hoping this is just simple downtime so I don’t have to bother <_<)

Edit: I tossed together a perl script.  I know perl isn’t very convenient for most windows people but it’s my favorite language so I could do it quickly; I’m interested in porting this to javascript/jquery both as a learning exercise and so it’ll be more convenient, but if I never follow through on that, at least the perl script will still exist.


#11

Oh yeah, sorry, my server is down. I’ll restart it tonight, promise!

EDIT:
And, yeah, I’ll share the code too.

RE-EDIT:
Damn, your last message was posted three days ago… we really need some kind of private messaging.


#13

Ok, so, my planning has changed, and I won’t be able to physically access the server until tomorrow (like 24h from now).
I’m trying to get someone else to restart the server though. I don’t know if they will be able to do it. I’ll edit my message later to keep you informed.
I am really sorry for the inconvenience. :/

EDIT:
My plan failed! Seems like you’re gonna have to wait for tomorrow. Sorry again. :frowning:


#14

Interesting API. I need to learn to program better so I can do cool contributions as well.


#16
siberianbreaks said... Also, protospork, your script didn't work for me when I tried it.. though it was probably my fault. If you want I can tell you the error
Please tell me anyway in case it's something I can fix. That script's had very little testing.

#17

Aaand it’s back.
Thanks for waiting.

Additionaly, I zipped the php page and put it there:
http://82.127.144.96/files/wkformatter.zip


#19

It looks to me like you downloaded Github’s prettified page featuring the script, instead of the script itself. You’d want to click ‘raw’, as below, and download that.


Nice to see the original’s back up.