コード例 #1
0
ファイル: postworker.py プロジェクト: ipedrazas/dotmarks-api
def parse_log(item):
    if 'source_id' in item:
        oid = item['source_id']
        if(item['action'] == 'click'):
            db.dotmarks.update(
                {"_id": ObjectId(oid)},
                {"$inc": {"views": 1}, "$set": {LAST_UPDATED: get_date()}},
                upsert=False)

        if(item['action'] == 'star'):
            updates = {'star': 'true' in item['value']}
            do_update(oid, updates)
コード例 #2
0
ファイル: postworker.py プロジェクト: ipedrazas/dotmarks-api
def populate_dotmark(item):
    logger.info("processing %s" % item['url'])
    updates = {}
    if 'url' and '_id' in item:
        if 'title' not in item or not item['title']:
            updates['title'] = get_title_from_url(item['url'])
            item['title'] = updates['title']

        atags = auto_tag(item)
        if atags:
            updates['atags'] = atags

        if updates:
            do_update(item['_id'], updates)
コード例 #3
0
ファイル: postworker.py プロジェクト: ipedrazas/dotmarks
def populate_dotmark(item):
    logger.info("processing %s" % item['url'])
    updates = {}
    if 'url' and '_id' in item:
        if 'title' not in item or not item['title']:
            updates['title'] = get_title_from_url(item['url'])
            item['title'] = updates['title']

        atags = auto_tag(item)
        if atags:
            updates['atags'] = atags

        if updates:
            do_update(item['_id'], updates)
コード例 #4
0
ファイル: postworker.py プロジェクト: ipedrazas/dotmarks
def parse_log(item):
    if 'source_id' in item:
        oid = item['source_id']
        if (item['action'] == 'click'):
            db.dotmarks.update({"_id": ObjectId(oid)}, {
                "$inc": {
                    "views": 1
                },
                "$set": {
                    LAST_UPDATED: get_date()
                }
            },
                               upsert=False)

        if (item['action'] == 'star'):
            updates = {'star': 'true' in item['value']}
            do_update(oid, updates)