start nim rewrite

This commit is contained in:
Christine Dodrill 2015-08-13 19:20:23 -07:00
parent ae5e90ae1f
commit 71489f4f33
5 changed files with 45 additions and 4 deletions

2
.gitignore vendored
View File

@ -59,3 +59,5 @@ docs/_build/
# PyBuilder # PyBuilder
target/ target/
ponyapi
nimcache

5
Makefile Normal file
View File

@ -0,0 +1,5 @@
build:
nim c -d:release --deadcodeElim:on --hints:off ponyapi
run: build
./ponyapi

View File

@ -1 +0,0 @@
web: gunicorn ponyapi:app --log-file=-

35
ponyapi.nim Normal file
View File

@ -0,0 +1,35 @@
import jester
import json
import strutils
type
Episode* = object of RootObj
## An episode of My Little Pony: Friendship is Magic
name*: string ## Episode name
air_date*: int ## Air date in unix time
season*: int ## season number of the episode
episode*: int ## the episode number in the season
is_movie*: bool ## does this record represent a movie?
var
episodes: seq[Episode]
for line in lines "./fim.list":
var
ep: Episode
splitLine = line.split " "
timestr = splitLine[1]
seasonstr = splitLine[2]
episodestr = splitLine[3]
is_movie = seasonstr == "99"
name = splitLine[4 .. ^1].join " "
ep = Episode(name: name,
air_date: timestr.parseInt,
season: seasonstr.parseInt,
episode: episodestr.parseInt,
is_movie: is_movie)
episodes = episodes & ep
echo episodes

View File

@ -2,9 +2,9 @@
name = "ponyapi" name = "ponyapi"
version = "0.1.0" version = "0.1.0"
author = "Christine Dodrill <xena@yolo-swag.com>" author = "Christine Dodrill <xena@yolo-swag.com>"
description = "PonyAPI client https://github.com/Xe/PonyAPI" description = "PonyAPI server https://github.com/Xe/PonyAPI"
license = "MIT" license = "MIT"
srcDir = "client/nim" bin = "ponyapi"
[Deps] [Deps]
Requires: "nim >= 0.10.0" Requires: "nim >= 0.10.0, jester#head"