mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 06:35:38 +01:00
Add exists check
This commit is contained in:
@@ -60,6 +60,11 @@ async def check_books(ctx: dict, *args, **kwargs) -> None: # NOSONAR
|
||||
|
||||
|
||||
async def cache_file(book: Book, file_type: str) -> Optional[CachedFile]:
|
||||
if await CachedFile.objects.filter(
|
||||
object_id=book.id, object_type=file_type
|
||||
).exists():
|
||||
return
|
||||
|
||||
data = await download(book.source.id, book.remote_id, file_type)
|
||||
|
||||
if data is None:
|
||||
|
||||
Reference in New Issue
Block a user