Skip to content

Commit e06cbe2

Browse files
committed
Update check_extras_folder mode
1 parent a731d8c commit e06cbe2

File tree

2 files changed

+36
-23
lines changed

2 files changed

+36
-23
lines changed

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,32 @@ The program supports the following arguments:
6767
```
6868
videodupchecker "C:\path\to\folder" --mode check_folder
6969
```
70-
- `check_extras_folder`: Looks specifically for videos in 'Extras' subfolders within the specified folder structure. The program will scan each folder within the specified top-level directory and process any 'Extras' subfolders it finds.
70+
- `check_extras_folder`: Scans for videos in subdirectories within the specified folder structure.
71+
The program will go through each folder within the specified top-level directory and process all
72+
subdirectories it finds.
73+
Each subdirectory (e.g., 'Extras', 'BehinTheScenes', etc.) will be processed individually.
7174
An example folder structure for this case:
7275
73-
Movies
74-
├── Movie 1
75-
│ └── Extras
76-
├── Movie 2
77-
│ └── Extras
78-
└── Movie 3
79-
└── Extras
80-
76+
Movies
77+
├── Movie 1
78+
│ ├── BehindtheScenes
79+
│ └── Subdirectory2
80+
├── Movie 2
81+
│ ├── Extras
82+
│ └── DeletedScenes
83+
└── Movie 3
84+
├── BonusContent
85+
└── Interviews
8186
Example Usage:
8287
```
8388
videodupchecker "C:\path\to\Movies" --mode check_extras_folder
8489
```
85-
8690
- `check_movie_folder`: Compares all videos directly within movie folders, including their subfolders.
8791
The program will iterate through all subdirectories within the specified top-level
8892
directory and process videos in each folder and its subfolders.
8993
An example folder structure for this case:
9094
91-
Movies
95+
Movies
9296
├── Movie 1
9397
│ ├── Video1.mkv
9498
│ ├── Video2.mkv

VideoDupChecker.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,23 @@ def process_folders(base_folder, mode, threshold):
3131
subfolders = [base_folder]
3232

3333
total_folders = len(subfolders)
34-
34+
3535
for index, folder_path in enumerate(subfolders, start=1):
3636
print(f"\n\nProcessing folder: {folder_path} (Folder {index} of {total_folders})\n")
3737

3838
try:
3939
if mode == "check_extras_folder":
40-
# Process "Extras" folder inside each movie folder
41-
extras_folder = os.path.join(folder_path, "Extras")
42-
if os.path.exists(extras_folder):
43-
matches = process_folder(extras_folder, mode, threshold)
40+
# Process all subdirectories in the folder
41+
subdirectories = [
42+
os.path.join(folder_path, subdir)
43+
for subdir in os.listdir(folder_path)
44+
if os.path.isdir(os.path.join(folder_path, subdir))
45+
]
46+
for sub_index, subdirectory in enumerate(subdirectories, start=1):
47+
print(f"\n\nProcessing subdirectory: {subdirectory} (Subdirectory {sub_index} of {len(subdirectories)})\n")
48+
matches = process_folder(subdirectory, mode, threshold)
4449
if matches:
45-
all_matches[extras_folder].extend(matches)
50+
all_matches[subdirectory].extend(matches)
4651
elif mode == "check_movie_folder" or mode == "check_folder":
4752
# Process all video files in the given folder (and subfolders for check_movie_folder)
4853
matches = process_folder(folder_path, mode, threshold)
@@ -87,17 +92,21 @@ def main():
8792
"1. check_folder:\n"
8893
" Compares all videos contained in this folder and all its subfolders for duplicates.\n\n"
8994
"2. check_extras_folder:\n"
90-
" Looks specifically for videos in 'Extras' subfolders within the specified folder structure.\n"
91-
" The program will scan each folder within the specified top-level directory and\n"
92-
" process any 'Extras' subfolders it finds.\n"
95+
" Scans for videos in subdirectories within the specified folder structure.\n"
96+
" The program will go through each folder within the specified top-level directory\n"
97+
" and process all subdirectories it finds.\n"
98+
" Each subdirectory (e.g., 'Extras', 'BehinTheScenes', etc.) will be processed individually.\n"
9399
" Example folder structure:\n\n"
94100
" Movies\n"
95101
" ├── Movie 1\n"
96-
" │ └── Extras\n"
102+
" │ ├── BehindtheScenes\n"
103+
" │ └── Subdirectory2\n"
97104
" ├── Movie 2\n"
98-
" │ └── Extras\n"
105+
" │ ├── Extras\n"
106+
" │ └── DeletedScenes\n"
99107
" └── Movie 3\n"
100-
" └── Extras\n\n"
108+
" ├── BonusContent\n"
109+
" └── Interviews\n\n"
101110
"3. check_movie_folder:\n"
102111
" Compares all videos directly within movie folders, including their subfolders.\n"
103112
" The program will iterate through all subdirectories within the specified top-level\n"

0 commit comments

Comments
 (0)