Simplify db code

This commit is contained in:
Zed
2019-09-08 12:22:52 +02:00
parent c7a2387aeb
commit d7e0fa6059
6 changed files with 21 additions and 15 deletions

View File

@@ -102,7 +102,7 @@ proc getVideoVar(tweet: Tweet): var Option[Video] =
return tweet.video
proc getVideo*(tweet: Tweet; agent, token: string; force=false) {.async.} =
withDb:
withCustomDb("cache.db", "", "", ""):
try:
getVideoVar(tweet) = some(Video.getOne("videoId = ?", tweet.id))
except KeyError: