def get(self): global shows c = pymongo.Connection('localhost') db = c.shows tvt = TVTracker() for k, v in shows.iteritems(): show = db.shows.find_one({'title': v['title']}) data = tvt.create(v['title'], v['last_viewed']) shows[k] = data show.update(data) db.shows.save(show) self.render("index.html", shows=shows)
def get(self): global shows c = pymongo.Connection("localhost") db = c.shows tvt = TVTracker() for k, v in shows.iteritems(): show = db.shows.find_one({"title": v["title"]}) data = tvt.create(v["title"], v["last_viewed"]) shows[k] = data show.update(data) db.shows.save(show) self.render("index.html", shows=shows)
def get(self): query = self.get_argument("query", None) if query: global shows if query in shows: tvshow = shows[query] result = {'title': tvshow['title'], 'link': tvshow['link']} else: tvt = TVTracker() result = tvt.search(query) self.write(json.dumps(result)) else: self.render("search.html")
def get(self): query = self.get_argument("query", None) if query: global shows if query in shows: tvshow = shows[query] result = {"title": tvshow["title"], "link": tvshow["link"]} else: tvt = TVTracker() result = tvt.search(query) self.write(json.dumps(result)) else: self.render("search.html")
def post(self): show = self.get_argument("show", None) last_viewed = self.get_argument("last-viewed", "") if show: global shows if show not in shows: c = pymongo.Connection('localhost') db = c.shows tvt = TVTracker() data = tvt.create(show, last_viewed) shows[show] = data db.shows.insert(data, manipulate=False) self.write(json.dumps(data)) else: self.write(json.dumps({'error': 'show exists'})) else: self.write(json.dumps({'error': 'no show'}))
def post(self): show = self.get_argument("show", None) last_viewed = self.get_argument("last-viewed", "") if show: global shows if show not in shows: c = pymongo.Connection("localhost") db = c.shows tvt = TVTracker() data = tvt.create(show, last_viewed) shows[show] = data db.shows.insert(data, manipulate=False) self.write(json.dumps(data)) else: self.write(json.dumps({"error": "show exists"})) else: self.write(json.dumps({"error": "no show"}))