modify scripts

This commit is contained in:
oscarz
2025-06-25 15:20:30 +08:00
parent 576db3c10a
commit 32b9989238
2 changed files with 49 additions and 1 deletions

View File

@ -132,6 +132,9 @@ class DatabaseHandler:
def finalize_task_log(self, task_id):
return 1
def get_statics(self):
return {}
def close(self):
self.cursor.close()
self.conn.close()
@ -517,4 +520,36 @@ class JavbusDBHandler(DatabaseHandler):
except sqlite3.Error as e:
logging.error(f"查询 href 失败: {e}")
return None
# 查询状态
def get_statics(self):
result = {}
try:
# 获取 performers、studios 等表的最终行数
self.cursor.execute(f"SELECT COUNT(*) FROM {self.tbl_name_actors} ")
result['actors'] = self.cursor.fetchone()[0]
self.cursor.execute(f"SELECT COUNT(*) FROM {self.tbl_name_actors} where uncensored=1")
result['actors_uncensored'] = self.cursor.fetchone()[0]
self.cursor.execute(f"SELECT COUNT(*) FROM {self.tbl_name_actors} where is_full_data=1")
result['actors_full_data'] = self.cursor.fetchone()[0]
self.cursor.execute(f"SELECT COUNT(*) FROM {self.tbl_name_actors} where is_full_data=1 and is_full_data=1")
result['actors_uncensored_full_data'] = self.cursor.fetchone()[0]
# 获取 performers、studios 等表的最终行数
self.cursor.execute(f"SELECT COUNT(*) FROM {self.tbl_name_movies} ")
result['movies'] = self.cursor.fetchone()[0]
self.cursor.execute(f"SELECT COUNT(*) FROM {self.tbl_name_movies} where uncensored=1")
result['movies_uncensored'] = self.cursor.fetchone()[0]
self.cursor.execute(f"SELECT COUNT(*) FROM {self.tbl_name_movies} where is_full_data=1 and is_full_data=1")
result['movies_uncensored_full_data'] = self.cursor.fetchone()[0]
except sqlite3.Error as e:
logging.error(f"query error: {e}")
return result

View File

@ -0,0 +1,13 @@
import json
import time
import src.db_utils.sqlite_db as sqlite_db
db_tools = sqlite_db.JavbusDBHandler()
if __name__ == "__main__":
# 命令行参数处理
result = db_tools.get_statics()
print(result)