Wallpaper generator ⚠️ No longer supported ⚠️

Oh, then the guide is as follows:

Get the source code, either with git clone, or by going to https://github.com/akranis/wanikaniwallpaper and hit the (ZIP) button.
Unzip in your directory of choice

Make sure you have the essential building tools (gcc/g++, make etc),  these might be installed by default or made available through a package called build-essential or similar.

Install the packages for libSDL, libSDL_ttf, libcurl, libjsoncpp and libpng (How these packages are named differ from distro to distro, so you might need to google for them.)

Once you have these installed, run the command ‘make’ inside the directory and that should build the program.

You should now have an executable named ‘wanikaniwallpaper’, run this with your key as argument and you should have a file called out.png

If you run into an compilation or runtime error, please post them here and I’ll try to figure out what you’re missing or if there is an incompatibility in the code.

Oh, and you also need the IPA fonts, or atleast ipag.ttf, if it’s not located at /usr/fonts/OTF/ipag.ttf, you need to change the path in grid.cpp to point to that file.

Aight, here’s what I got:

make
g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper
api.cpp:3:23: fatal error: curl/curl.h: No such file or directory
compilation terminated.
main.cpp: In function ‘int main(int, char**)’:
main.cpp:43:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [wanikaniwallpaper] Error 1

Time said... Aight, here's what I got:

make g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper api.cpp:3:23: fatal error: curl/curl.h: No such file or directory compilation terminated. main.cpp: In function ‘int main(int, char**)’: main.cpp:43:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] make: *** [wanikaniwallpaper] Error 1
 Ok, looks like you're missing the header files for curl. What distro are you using and what was the name of the curl package you installed?

I get a segmentation fault.

make
g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper
main.cpp: 関数 ‘int main(int, char**)’ 内:
main.cpp:43:31: 警告: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./wanikaniwallpaper <key>
Segmentation fault

I’m using linux (ubuntu based)


Darcinon said... I get a segmentation fault.

make
g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper
main.cpp: 関数 ‘int main(int, char**)’ 内:
main.cpp:43:31: 警告: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./wanikaniwallpaper <key>
Segmentation fault

I'm using linux (ubuntu based)


 Are you running it ouside of X (graphical environment)?

Ubuntu 12.10, default curl.
Ahh I see now…
I just ran install(for latest curl), and:

g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper
api.cpp:3:23: fatal error: curl/curl.h: No such file or directory
compilation terminated.
main.cpp: In function ‘int main(int, char**)’:
main.cpp:43:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [wanikaniwallpaper] Error 1

Same thing.

Time said... Ubuntu 12.10, default curl.
Ahh I see now..
I just ran install(for latest curl), and:

g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper api.cpp:3:23: fatal error: curl/curl.h: No such file or directory compilation terminated. main.cpp: In function ‘int main(int, char**)’: main.cpp:43:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] make: *** [wanikaniwallpaper] Error 1
Same thing.
 There is a package libcurl3 that you need to install.

Tried that, says that I already had it, and same error.

Darcinon said... I get a segmentation fault.

make
g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper
main.cpp: 関数 ‘int main(int, char**)’ 内:
main.cpp:43:31: 警告: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

./wanikaniwallpaper <key>
Segmentation fault

I'm using linux (ubuntu based)


 Another theory I have is that you may be missing the IPA fonts, or they're in a different place on ubuntu. I tried to load a font that didn't exist and it segfaulted as well.

More graceful and informative errors will be added to my list of TODO's :P
Time said... Tried that, says that I already had it, and same error.
 Ah, looks like Ubuntu does that thing where they place libs and headers in different packages, you need to install libcurl4-gnutls-dev or libcurl4-openssl-dev. Which doesn't matter (They use different implementations of ssl, which I'm currently not using)

Ok did both IPA and libcurl4-gnutls-dev
Result;

make
g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper
api.cpp:4:31: fatal error: jsoncpp/json/json.h: No such file or directory
compilation terminated.
main.cpp: In function ‘int main(int, char**)’:
main.cpp:43:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [wanikaniwallpaper] Error 1

And with the other one is;

make
g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper
api.cpp:4:31: fatal error: jsoncpp/json/json.h: No such file or directory
compilation terminated.
main.cpp: In function ‘int main(int, char**)’:
main.cpp:43:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make: *** [wanikaniwallpaper] Error 1

Time said... Ok did both IPA and libcurl4-gnutls-dev
Result;

make g++ -std=c++11 api.cpp grid.cpp kanji.cpp main.cpp order.cpp save.cpp -lSDL -lSDL_ttf -lcurl -ljsoncpp -lpng -o wanikaniwallpaper api.cpp:4:31: fatal error: jsoncpp/json/json.h: No such file or directory compilation terminated. main.cpp: In function ‘int main(int, char**)’: main.cpp:43:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] make: *** [wanikaniwallpaper] Error 1
 Right, like with curl, you're looking for two packages, a quick search in ubuntu's package database gave me libjsoncpp0 (libs), and libjsoncpp-dev (headers)

If you keep getting the *.h no such file, look for a package ending with -dev for the library.

I’m going to sleep now, but if you keep having problems with compiling, here is an “inofficial” “pre-release” of the application for linux: https://dl.dropbox.com/u/412571/wanikaniwallpaper-linux-pre.tar.gz

Know this:

  • the IPA font HAS to exist at /usr/share/fonts/OTF/ipag.ttf
  • The file named “order” must be in the same directory as the executable
  • It has to be run from a terminal inside X (eg. gnome terminal), as SDL requries this to run.
  • Resolution is hardcoded to 1920x1080

silentdude56k said... I packaged a Windows build up for those who want to try it out. All credit goes to akranis.

Please note that this is functionally identical to the original Linux code I pulled from akranis's GitHub. It is currently NOT USER-FRIENDLY, so run this at your own risk (although I expect this will change soon). That being said, I only tested my build on Windows 7 64-bit and Windows XP 32-bit. There may be problems I am not aware of.

Also note that the wallpaper is currently hardcoded to be 1920x1080. I am currently only providing builds, not adding features.

You can get it here: https://docs.google.com/file/d/0B45KzpxyN8ncRl8xenFGT2xtUDg/edit?usp=sharing
VirusTotal report: https://www.virustotal.com/en/file/87acc73b3c9b5a97078f9885daaa35fa0560cd46e8989bd933b28941f2defaa0/...

Go to File and click Download or hit Ctrl+S to download the zip file.

Unzip everything to a new folder and navigate there in a command prompt window. Type "wanikaniwallpaper" followed by your WaniKani API key and hit enter. An out.png file should appear in your folder within a few seconds.

Example: wanikaniwallpaper abcdefghijklmnopqrstuvwxyz012345

Enjoy!
 Thank you! I think I might try setting it up as a batch file on a schedule so my background auto-updates every day.  And of course thanks akranis for making it in the first place!
akranis said... Oh, then the guide is as follows:

Get the source code, either with git clone, or by going to https://github.com/akranis/wanikaniwallpaper and hit the (ZIP) button.
Unzip in your directory of choice

Make sure you have the essential building tools (gcc/g++, make etc),  these might be installed by default or made available through a package called build-essential or similar.

Install the packages for libSDL, libSDL_ttf, libcurl, libjsoncpp and libpng (How these packages are named differ from distro to distro, so you might need to google for them.)

Once you have these installed, run the command 'make' inside the directory and that should build the program.

You should now have an executable named 'wanikaniwallpaper', run this with your key as argument and you should have a file called out.png

If you run into an compilation or runtime error, please post them here and I'll try to figure out what you're missing or if there is an incompatibility in the code.

Oh, and you also need the IPA fonts, or atleast ipag.ttf, if it's not located at /usr/fonts/OTF/ipag.ttf, you need to change the path in grid.cpp to point to that file.

wingdi.h (included by windows.h, which is included by SDL on Windows) has #define ERROR 0 in it. This causes a compilation error:

api.cpp: In static member function 'static std::vector<wanikani::Kanji> wanikani::API::get(std::string)':api.cpp:59:16: error: invalid conversion from 'int' to 'wanikani::Knowledge' [-fpermissive]

This takes precedence over the ERROR value in the Knowledge enum. I got it to compile by adding the following after line 5 in api.cpp:
  • #ifdef ERROR
  • #undef ERROR
  • #endif
This probably won't be an issue when you make the switch to FreeType, but you might consider adding a prefix to reduce preprocessor usage.

Yeah, wrote the code a little too fast. Should have followed more conventions.

I do have a bit of rewriting planned that will take place before 1.0, like renaming the class Kanji to KanjiCharacter.

The Knowledge enum will probably be renamed to WaniKaniSRS, and all the values prefixed with SRS_.

Excellent. It’s a very nifty little program; thank you for sharing.

akranis said... I'm going to sleep now, but if you keep having problems with compiling, here is an "inofficial" "pre-release" of the application for linux: https://dl.dropbox.com/u/412571/wanikaniwallpaper-linux-pre.tar.gz

Know this:
  • the IPA font HAS to exist at /usr/share/fonts/OTF/ipag.ttf
  • The file named "order" must be in the same directory as the executable
  • It has to be run from a terminal inside X (eg. gnome terminal), as SDL requries this to run.
  • Resolution is hardcoded to 1920x1080

 Maybe I get the segfault because my /usr/share/fonts/OTF/ipag.ttf doesn't exist. Although I tried installing fonts-ipafont, and it neither created OTF/ipag.ttf nor fixed the segfault.

This is pretty cool, and I was looking for some JavaScript practice, so I made a similar (read: clone) tool to run in a web browser. 
You can view the source at https://github.com/dbowring/wanikani-wallpaper-js - or view a “live” version at http://dbowring.github.com/wanikani-wallpaper-js/

Haven’t properly tested yet (only basics in chrome), but it seems to work well. :slight_smile: