Skip to content

Commit

Permalink
Use stash's videphash to install ffmpeg if not on commandline.
Browse files Browse the repository at this point in the history
  • Loading branch information
4c0d3r committed Jan 2, 2023
1 parent a393a4f commit 586a168
Show file tree
Hide file tree
Showing 13 changed files with 374 additions and 311 deletions.
9 changes: 6 additions & 3 deletions namer/command.py
Expand Up @@ -17,7 +17,7 @@

from namer.configuration import NamerConfig
from namer.configuration_utils import default_config
from namer.ffmpeg import ffprobe, FFProbeResults
from namer.ffmpeg import FFMpeg, FFProbeResults
from namer.fileinfo import parse_file_name, FileInfo
from namer.comparison_results import ComparisonResults, LookedUpFileInfo

Expand Down Expand Up @@ -66,6 +66,9 @@ class Command:

config: NamerConfig

def get_command_target(self):
return str(self.target_movie_file.absolute())


def move_command_files(target: Optional[Command], new_target: Path) -> Optional[Command]:
if not target:
Expand Down Expand Up @@ -176,10 +179,10 @@ def selected_best_movie(movies: List[str], config: NamerConfig) -> Optional[Path
# This could use a lot of work.
if movies:
selected = Path(movies[0])
selected_values = extract_relevant_attributes(ffprobe(selected), config)
selected_values = extract_relevant_attributes(FFMpeg().ffprobe(selected), config)
for current_movie_str in movies:
current_movie = Path(current_movie_str)
current_values = extract_relevant_attributes(ffprobe(current_movie), config)
current_values = extract_relevant_attributes(FFMpeg().ffprobe(current_movie), config)
if current_values[1] <= config.max_desired_resolutions or config.max_desired_resolutions == -1:
if greater_than(current_values, selected_values):
selected_values = current_values
Expand Down
4 changes: 2 additions & 2 deletions namer/configuration_utils.py
Expand Up @@ -21,7 +21,7 @@
from namer.configuration import NamerConfig
from namer.database import abbreviations
from namer.name_formatter import PartialFormatter
from namer.ffmpeg import ffmpeg_version
from namer.ffmpeg import FFMpeg


def __verify_naming_config(config: NamerConfig, formatter: PartialFormatter) -> bool:
Expand Down Expand Up @@ -79,7 +79,7 @@ def __verify_name_string(formatter: PartialFormatter, name: str, name_string: st


def __verify_ffmpeg() -> bool:
versions = ffmpeg_version()
versions = FFMpeg().ffmpeg_version()
for tool, version in versions.items():
if not version:
logger.error(f'No {tool} found, please install {tool}')
Expand Down

0 comments on commit 586a168

Please sign in to comment.