Skip to content

Commit

Permalink
get more info (ThePornDatabase#130)
Browse files Browse the repository at this point in the history
* on server shutdown wait for the thread processing work to join(), not for the queue to join(), as sometimes the queue doesn't notice the last item being fully processed (the None) item that tells the working thread that all work is done.
* prevent chmod after files move
* Detect when work is enqued after server stop.
* use my fork of videohashes
* Use stash's videphash to install ffmpeg if not on commandline.

Co-authored-by: 4c0d3r <nope>
  • Loading branch information
4c0d3r authored Jan 2, 2023
1 parent 240e2ff commit eb56005
Show file tree
Hide file tree
Showing 17 changed files with 477 additions and 378 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "videohashes"]
path = videohashes
url = https://github.com/peolic/videohashes.git
url = https://github.com/4c0d3r/videohashes.git
9 changes: 6 additions & 3 deletions namer/command.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading

0 comments on commit eb56005

Please sign in to comment.