Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
    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'}))
Exemple #4
0
    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"}))