mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-09-06 16:07:26 +08:00
fix: 修复类型错误,加入部分日志
This commit is contained in:
+13
-10
@@ -41,19 +41,22 @@ async def upper_thumb():
|
|||||||
makedir_tasks = []
|
makedir_tasks = []
|
||||||
other_tasks = []
|
other_tasks = []
|
||||||
for upper in await Upper.all():
|
for upper in await Upper.all():
|
||||||
if not all(
|
if all(
|
||||||
await asyncio.gather(
|
await asyncio.gather(
|
||||||
aexists(upper.thumb_path), aexists(upper.meta_path)
|
aexists(upper.thumb_path), aexists(upper.meta_path)
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
makedir_tasks.append(
|
logger.info("Upper {} {} already exists, skipped.", upper.mid, upper.name)
|
||||||
amakedirs(upper.thumb_path.parent, exist_ok=True)
|
makedir_tasks.append(
|
||||||
)
|
amakedirs(upper.thumb_path.parent, exist_ok=True)
|
||||||
other_tasks.extend(
|
)
|
||||||
[
|
logger.info("Saving metadata for upper {} {}...", upper.mid, upper.name)
|
||||||
upper.save_metadata(),
|
other_tasks.extend(
|
||||||
download_content(upper.thumb_url, upper.thumb_path),
|
[
|
||||||
]
|
upper.save_metadata(),
|
||||||
)
|
download_content(upper.thumb_url, upper.thumb_path),
|
||||||
|
]
|
||||||
|
)
|
||||||
await asyncio.gather(*makedir_tasks)
|
await asyncio.gather(*makedir_tasks)
|
||||||
await asyncio.gather(*other_tasks)
|
await asyncio.gather(*other_tasks)
|
||||||
|
logger.info("All done.")
|
||||||
|
|||||||
@@ -41,13 +41,13 @@ class Upper(Model):
|
|||||||
@property
|
@property
|
||||||
def thumb_path(self) -> Path:
|
def thumb_path(self) -> Path:
|
||||||
return (
|
return (
|
||||||
DEFAULT_THUMB_PATH / f"{self.mid[0]}" / f"{self.mid}" / "folder.jpg"
|
DEFAULT_THUMB_PATH / str(self.mid)[0] / f"{self.mid}" / "folder.jpg"
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def meta_path(self) -> Path:
|
def meta_path(self) -> Path:
|
||||||
return (
|
return (
|
||||||
DEFAULT_THUMB_PATH / f"{self.mid[0]}" / f"{self.mid}" / "person.nfo"
|
DEFAULT_THUMB_PATH / str(self.mid)[0] / f"{self.mid}" / "person.nfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
async def save_metadata(self):
|
async def save_metadata(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user