mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-06-01 13:50:34 +08:00
fix: 尝试修复 emby 头像路径,异步化所有文件操作
This commit is contained in:
27
models.py
27
models.py
@@ -13,6 +13,7 @@ from constants import (
|
||||
MediaType,
|
||||
)
|
||||
from settings import settings
|
||||
from utils import aopen
|
||||
|
||||
|
||||
class FavoriteList(Model):
|
||||
@@ -39,7 +40,31 @@ class Upper(Model):
|
||||
|
||||
@property
|
||||
def thumb_path(self) -> Path:
|
||||
return DEFAULT_THUMB_PATH / f"{self.mid}.jpg"
|
||||
return (
|
||||
DEFAULT_THUMB_PATH / f"{self.mid[0]}" / f"{self.mid}" / "folder.jpg"
|
||||
)
|
||||
|
||||
@property
|
||||
def meta_path(self) -> Path:
|
||||
return (
|
||||
DEFAULT_THUMB_PATH / f"{self.mid[0]}" / f"{self.mid}" / "person.nfo"
|
||||
)
|
||||
|
||||
async def save_metadata(self):
|
||||
async with aopen(self.meta_path, "w") as f:
|
||||
await f.write(
|
||||
f"""
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<person>
|
||||
<plot />
|
||||
<outline />
|
||||
<lockdata>false</lockdata>
|
||||
<dateadded>{self.created_at.strftime("%Y-%m-%d %H:%M:%S")}</dateadded>
|
||||
<title>{self.mid}</title>
|
||||
<sorttitle>{self.mid}</sorttitle>
|
||||
</person>
|
||||
""".strip()
|
||||
)
|
||||
|
||||
|
||||
class FavoriteItem(Model):
|
||||
|
||||
Reference in New Issue
Block a user