Skip to content

Commit

Permalink
feat: support files from non-C drives
Browse files Browse the repository at this point in the history
  • Loading branch information
bugale committed Apr 27, 2024
1 parent 7e76eca commit eea4f3e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion buganime/transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import asyncio
import logging
import warnings
import shutil
from dataclasses import dataclass
from typing import AsyncIterator, cast, Optional

Expand Down Expand Up @@ -83,7 +84,10 @@ async def __read_input_frames(self) -> AsyncIterator[bytes]:

async def __write_output_frames(self, frames: AsyncIterator[bytes]) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
os.link(self.__input_path, os.path.join(temp_dir, 'input.mkv'))
if os.path.splitdrive(self.__input_path)[0] == os.path.splitdrive(temp_dir)[0]:
os.link(self.__input_path, os.path.join(temp_dir, 'input.mkv'))
else:
shutil.copy(self.__input_path, os.path.join(temp_dir, 'input.mkv'))
width_out = self.__width_out
height_out = self.__height_out
if self.__video_info.width / self.__video_info.height > self.__width_out / self.__height_out:
Expand Down

0 comments on commit eea4f3e

Please sign in to comment.