Skip to content

Commit

Permalink
find_need_transcode.py and find_media_errors.py skip files in hidden …
Browse files Browse the repository at this point in the history
…directories
  • Loading branch information
double16 committed Oct 28, 2024
1 parent 4a4773a commit 498726d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dvrprocess/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1430,3 +1430,13 @@ def should_adjust_frame_rate(current_frame_rate: Union[None, str, float], desire

frame_rate_pct = abs(current_frame_rate_f - desired_frame_rate_f) / max(current_frame_rate_f, desired_frame_rate_f)
return frame_rate_pct >= tolerance


def is_file_in_hidden_dir(filepath) -> bool:
"""
Check if the file is inside a hidden directory, i.e. a directory name starting
with ".". Any directory in the path starting with "." will return True.
:param filepath: the full or partial path
:return:
"""
return filepath.startswith('.') or f"{os.path.sep}." in filepath
2 changes: 2 additions & 0 deletions dvrprocess/find_media_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ def media_errors_generator(media_paths: list[str], media_roots: list[str],
for root, dirs, files in os.walk(media_path, topdown=True):
for file in common.filter_for_mkv(files):
filepath = os.path.join(root, file)
if common.is_file_in_hidden_dir(filepath):
continue
cached_error_count = config.get_file_config_option(filepath, 'error', 'count')
if cached_error_count:
error_count = int(cached_error_count)
Expand Down
2 changes: 2 additions & 0 deletions dvrprocess/find_need_transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def _os_walk_media_generator(media_paths, desired_audio_codecs: list[str], desir

for file in common.filter_for_mkv(files):
filepath = os.path.join(root, file)
if common.is_file_in_hidden_dir(filepath):
continue

# check the transcode overrides based on the folder structure
if desired_video_codecs != ['all']:
Expand Down

0 comments on commit 498726d

Please sign in to comment.