Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
legnaleurc committed Dec 19, 2023
1 parent 77fc837 commit 1993912
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions drive/app/faststart/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
from tempfile import TemporaryDirectory

from wcpan.drive.core.types import Node, Drive
from wcpan.drive.cli.lib import create_drive_from_config
from wcpan.drive.cli.lib import create_drive_from_config, create_executor
from wcpan.logging import ConfigBuilder
from wcpan.queue import AioQueue

from app.lib import create_executor

from .cache import initialize_cache
from .processor import create_processor, is_oggmedia, is_realmedia

Expand Down
9 changes: 3 additions & 6 deletions drive/app/faststart/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

from wcpan.drive.core.lib import upload_file_from_local, download_file_to_local
from wcpan.drive.core.types import Node, MediaInfo, Drive
from wcpan.drive.cli.lib import get_file_hash, get_video_info

from app.lib import get_hash, get_video_info, get_daily_usage
from app.lib import get_daily_usage

from .cache import is_migrated, set_cache, need_transcode, has_cache, unset_cache

Expand Down Expand Up @@ -248,11 +249,7 @@ async def _upload(self, media_info: MediaInfo):
async def _verify(self, uploaded_node: Node):
output_path = self.transcoded_file_path
getLogger(__name__).info(f"verifying {output_path}")
factory = await self.drive.get_hasher_factory()
loop = asyncio.get_running_loop()
local_hash = await loop.run_in_executor(
self.pool, get_hash, output_path, factory
)
local_hash = await get_file_hash(output_path, pool=self.pool, drive=self.drive)
if local_hash != uploaded_node.hash:
getLogger(__name__).info(f"removing {uploaded_node.name}")
await self.drive.move(uploaded_node, trashed=True)
Expand Down

0 comments on commit 1993912

Please sign in to comment.