dylanjbarth/ka-lite — pull request #1 by dylanjbarth (2013-07-19 20:12:49+00:00)
Title: Check in of subtitle support progress

Thanks @bcipolli for getting started on this. The first part of this project was to fix the way we were interacting with the Amara API. Inside of central/ I created utils/ which houses different tools for managing subtitles (might be better renamed to subtitle_utils/ now that I am thinking about it). They work together to get data from the Amara API and then use that data to download subtitle files.

First, generate_subtitle_map.py indexes through all of our videos, and checks Amara's API to see what subtitle languages, if any, are available. It write the info it gets back to a json file in the static/data/subtitledata dir.

Second, download_subtitles.py uses the data collected and stored in the json file to actually download the srt files Amara says is available. It organizes and stores them by language code in locale/.

Third, generate_zipped_srts.py zips up each languages subtitles and sticks them in media/subtitles/ for future download.

The other files are shared methods, paths, and headers.

I have set git to ignore the data/static/subtitledata folder to avoid bloat, but in case you don't want to wait an hour for the generation of a subtitle map, I'd be happy to email or dropbox you some pre-generated JSON. Please ping me with any questions and thanks again!