mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-12-01 00:38:13 +08:00
fix: test, and if database is deleted, recreate database.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from module.conf import settings, VERSION
|
||||
from module.downloader import DownloadClient
|
||||
@@ -53,6 +54,14 @@ class Checker:
|
||||
f.writelines(VERSION)
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def check_database() -> bool:
|
||||
db_path = Path("data/data.db")
|
||||
if not db_path.exists():
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(Checker().check_version())
|
||||
|
||||
@@ -32,7 +32,7 @@ class Program(RenameThread, RSSThread):
|
||||
|
||||
def startup(self):
|
||||
self.__start_info()
|
||||
if self.first_run:
|
||||
if self.first_run or not self.database:
|
||||
first_run()
|
||||
logger.info("First run detected, please configure the program in webui.")
|
||||
return {"status": "First run detected."}
|
||||
|
||||
@@ -50,3 +50,7 @@ class ProgramStatus(Checker):
|
||||
@property
|
||||
def version_update(self):
|
||||
return self.check_version()
|
||||
|
||||
@property
|
||||
def database(self):
|
||||
return self.check_database()
|
||||
|
||||
@@ -10,7 +10,7 @@ def test_rss_engine():
|
||||
engine.add_rss(rss_link, aggregate=False)
|
||||
|
||||
result = engine.rss.search_active()
|
||||
assert result[1].item_path == "Mikan Project - 无职转生~到了异世界就拿出真本事~"
|
||||
assert result[1].name == "Mikan Project - 无职转生~到了异世界就拿出真本事~"
|
||||
|
||||
new_torrents = engine.pull_rss(result[1])
|
||||
torrent = new_torrents[0]
|
||||
|
||||
Reference in New Issue
Block a user