def get_quality(self, now): """ get video numbers by copyright """ year = now.split('-')[0] month = int(now.split('-')[1]) if int(month / 7) == 0: count = '01' if int(month / 7) == 1: count = '07' sql = " select count(*) as video_num, quality_level from video_info\ where check_in_time >=unix_timestamp(\'%s\') and has_copyright = 1\ and review_status = 3\ group by quality" % (now.split(' ')[0] + ' 00:00:00') #sql = "select count(*) as video_num, quality from video_info\ # where check_in_time >= unix_timestamp('2017-07-24 00:00:00') and check_in_time <= unix_timestamp('2017-07-25 00:00:00')\ # and has_copyright = 1\ # and review_status = 3\ # group by quality" print sql try: with session_cpu_vc() as session: results = session.execute(sql).fetchall() if results is not None: return results except Exception as e: self.logger.exception("get_quality %s" % str(e))
def get_result(self, now): """ get category by content numbers """ sql = "select count(*) as content_num, category_id as categoryId from video_info\ where check_in_time >=unix_timestamp(\'%s\') and review_status = 3 and category_id != 0 \ group by categoryId"%(now) print sql try: with session_cpu_vc() as session: results = session.execute(sql).fetchall() if results is not None: return results except Exception as e: self.logger.exception("get_results %s" % str(e))
def get_result(self, now): """ get video number by source name """ sql = "select content_num, source_name from (select count(*) as \ content_num, source_name from video_info\ where check_in_time >=unix_timestamp(\'%s\') and review_status =3 and source_name != '' \ group by source_name) as b order \ by content_num desc limit 100"\ %(now) print sql try: with session_cpu_vc() as session: results = session.execute(sql).fetchall() if results is not None: return results except Exception as e: self.logger.exception("get_results %s" % str(e))