A Sinatra app for showing Anki flashcards in a slideshow on a webpage.
CSS Python Ruby
Switch branches/tags
Nothing to show
Clone or download

README.md

anki-slideshow

Displays Anki flashcards, exported from Anki as HTML, in a simple slideshow-like interface on a webpage. Check out a working demo of my flashcards for med school.

This is just for casual browsing: unlike the Anki desktop clients or the AnkiWeb interface, correct/incorrect answers are not tracked and scheduling data is not saved in any way. I find this useful for leaving up info that I can watch when I'm bored.

It is implemented as a Ruby/Rack application built with Sinatra. Ruby is preinstalled on most Macs and packaged for most Linuxes, and all necessary gems can be acquired with RubyGems and bundler. For deployment, techniques for any Rack apply, and it could be served with, e.g., Apache/Passenger, nginx/Passenger or nginx/Unicorn.

For getting data from your Anki decks into the web app, an Anki plugin is provided, which can be used with the Mac, Windows, or Linux/BSD Anki desktop clients. The plugin exports all flashcard data and transfers it to the location of the Rack app via rsync (i.e., you can create decks on one computer and serve them from another). If you use Anki for Windows, you'll need to install rsync first via Cygwin, but it should already be installed on most Macs and Linuxes.

Installation

  1. Clone this repository to the computer that will serve the Rack web application, and cd into it.

  2. You will need some Ruby gems. First, gem install bundler, then bundle install.

  3. Create a folder to hold the flashcard data: mkdir anki-data. (You can change this in config.ru).

  4. If this computer is different from the one that has your Anki decks, make sure that the anki-data is accessible to you via SSH, and that you can get into it without a password using SSH keys. If it's the same computer, don't worry about this.

  1. On the computer that has your Anki decks, copy or symlink the anki-slideshow.py file from the anki-plugin directory into your Anki addons folder. On most platforms, this folder is in your user's Documents folder, under Anki/addons.

  2. Run Anki. Once you're at the main window with all your decks, you'll now notice an "Export Cards to Anki-Slideshow" item under the Tools menu. Click it.

  3. You'll be asked for a rsync destination. Enter in the location of the anki-data folder you created, which could be on the same computer, or a different computer. In the former case, enter the full path starting with a forward slash, and in the latter, enter a destination in the form username@host.tld:/path/to/anki-data.

  4. The files will be copied via rsync, and you'll see a message informing you of the results.

  5. Back on the computer that is serving the Rack app, run rackup -p4567 and off you go. It will be accessible at http://0.0.0.0:4567/.

More complex setups involving nginx or Apache are possible, if you would like to run the app behind a robust web server. For such situations, you'll want to check out Passenger or Unicorn.

It may also be possible to serve this via Heroku, but I haven't tried yet.

License

The MIT License (MIT)

Copyright (c) 2013 Theodore Pak

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.