コード例 #1
0
ファイル: maintain.py プロジェクト: lijiahong/opinion_news
def one_topic_clear(topicname_start):
    topicname, start_datetime = topicname_start
    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
コード例 #2
0
ファイル: maintain.py プロジェクト: lijiahong/opinion_news
def one_topic_clear(topicname_start):
    topicname, start_datetime = topicname_start
    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
コード例 #3
0
 def record(cls, user, action, *args):
     c = cls()
     c.created = datetime.utcnow()
     c.timestamp = datetime2ts(c.created)
     c.user_id = user.id
     c.revision = cls.query.filter_by(user_id=user.id).count()
     c.data = json.dumps([action] + list(args), ensure_ascii=False)
     _data = str(c.revision) + str(c.timestamp) + c.data
     _data = _data.encode()
     state.db.session.add(c)
     state.db.session.commit()
コード例 #4
0
 def record(cls, user, action, *args):
     c = cls()
     c.created = datetime.utcnow()
     c.timestamp = datetime2ts(c.created)
     c.user_id = user.id
     c.revision = cls.query.filter_by(user_id=user.id).count()
     c.data = json.dumps([action] + list(args), ensure_ascii=False)
     _data = str(c.revision) + str(c.timestamp) + c.data
     _data = _data.encode()
     state.db.session.add(c)
     state.db.session.commit()
コード例 #5
0
ファイル: load_data.py プロジェクト: jimmy0000/opinion_news
def initializeNewsTopic():
    """初始化新闻话题
    """
    em = EventManager()

    topicname = u'外滩踩踏'
    start_datetime = "2015-01-02 00:00:00"
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
コード例 #6
0
ファイル: load_data.py プロジェクト: lijiahong/opinion_news
def initializeNewsTopic():
    """初始化新闻话题
    """
    em = EventManager()

    topicname = u'外滩踩踏'
    start_datetime = "2015-01-02 00:00:00"
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
コード例 #7
0
ファイル: load_data.py プロジェクト: jimmy0000/opinion_news
def initializeWeiboTopic():
    """初始化weibo话题
    """
    em = EventManager()

    # topicname = u'外滩踩踏-微博'
    # start_datetime = "2015-01-02 00:00:00"
    # topicname = u'呼格案-微博'
    # start_datetime = "2014-12-14 00:00:00"
    # topicname = u'复旦投毒案-微博'
    # start_datetime = "2014-12-15 00:00:00"
    topicname = u'APEC-微博'
    start_datetime = "2014-12-15 00:00:00"

    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
コード例 #8
0
ファイル: load_data.py プロジェクト: lijiahong/opinion_news
def initializeWeiboTopic():
    """初始化weibo话题
    """
    em = EventManager()

    # topicname = u'外滩踩踏-微博'
    # start_datetime = "2015-01-02 00:00:00"
    # topicname = u'呼格案-微博'
    # start_datetime = "2014-12-14 00:00:00"
    # topicname = u'复旦投毒案-微博'
    # start_datetime = "2014-12-15 00:00:00"
    topicname = u'APEC-微博'
    start_datetime = "2014-12-15 00:00:00"

    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
コード例 #9
0
#-*-coding=utf-8-*-

from utils import datetime2ts

MONGO_DB_NAME = "news"
EVENTS_COLLECTION = "news_topic"
SUB_EVENTS_COLLECTION = "news_subevent"
SUB_EVENTS_FEATURE_COLLECTION = "news_subevent_feature"
EVENTS_NEWS_COLLECTION_PREFIX = "post_"
EVENTS_COMMENTS_COLLECTION_PREFIX = "comment_"

START_DATETIME = "2014-01-01 00:00:00"
END_DATETIME = "2014-11-04 00:00:00"

START_TS = datetime2ts(START_DATETIME)
END_TS = datetime2ts(END_DATETIME)
コード例 #10
0
 def json(self):
     timestamp = self.timestamp or datetime2ts(self.created)
     return [self.revision, timestamp, self.data]
コード例 #11
0
ファイル: models.py プロジェクト: h4ck3rm1k3/openmedialibrary
 def timestamp(self):
     return utils.datetime2ts(self.modified)
コード例 #12
0
 def json(self):
     timestamp = self.timestamp or datetime2ts(self.created)
     return [self.revision, timestamp, self.data]
コード例 #13
0
ファイル: config.py プロジェクト: jimmy0000/opinion_news
#-*-coding=utf-8-*-

from utils import datetime2ts


MONGO_DB_NAME = "news"
EVENTS_COLLECTION = "news_topic"
SUB_EVENTS_COLLECTION = "news_subevent"
SUB_EVENTS_FEATURE_COLLECTION = "news_subevent_feature"
EVENTS_NEWS_COLLECTION_PREFIX = "post_"
EVENTS_COMMENTS_COLLECTION_PREFIX = "comment_"

START_DATETIME = "2014-01-01 00:00:00"
END_DATETIME = "2014-11-04 00:00:00"

START_TS = datetime2ts(START_DATETIME)
END_TS = datetime2ts(END_DATETIME)