Run monitor before scan

This commit is contained in:
Zoe Roux 2024-02-26 23:40:03 +01:00
parent faf8832572
commit fc7926c2cc
2 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,5 @@
async def main():
import asyncio
import os
import logging
import sys
@ -38,8 +39,9 @@ async def main():
) as client:
try:
scanner = Scanner(client, languages=languages.split(","), api_key=api_key)
await scanner.scan(path)
logging.info("Scan finished. Starting to monitor...")
await monitor(path, scanner)
await asyncio.gather(
monitor(path, scanner),
scanner.scan(path),
)
except ProviderError as e:
logging.error(e)

View File

@ -54,6 +54,7 @@ class Scanner:
# We batch videos by 20 because too mutch at once kinda DDOS everything.
for group in batch(iter(videos), 20):
await asyncio.gather(*map(self.identify, group))
logging.info("Scan finished.")
async def get_registered_paths(self) -> List[str]:
paths = None