start nim rewrite
This commit is contained in:
parent
ae5e90ae1f
commit
71489f4f33
|
@ -59,3 +59,5 @@ docs/_build/
|
||||||
# PyBuilder
|
# PyBuilder
|
||||||
target/
|
target/
|
||||||
|
|
||||||
|
ponyapi
|
||||||
|
nimcache
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
build:
|
||||||
|
nim c -d:release --deadcodeElim:on --hints:off ponyapi
|
||||||
|
|
||||||
|
run: build
|
||||||
|
./ponyapi
|
|
@ -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
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue