main
Gabe Farrell 9 months ago
parent d8e3f3c83d
commit 50fb52c127

@ -1,54 +0,0 @@
#!/bin/bash
# Find all .nfo files in the directory tree
find -type f -name "*.nfo" | while read -r file; do
# Extract the directory path
dir_path=$(dirname "$file")
# Extract the filename
filename=$(basename "$file")
# Skip specific filenames
if [[ "$filename" == "tvshow.nfo" || "$filename" == "season.nfo" ]]; then
continue
fi
# Extract season and episode numbers using regex
if [[ "$filename" =~ S([0-9]+)E([0-9]+) ]]; then
season=${BASH_REMATCH[1]}
episode=${BASH_REMATCH[2]}
# Convert season and episode to integers
season_num=$((10#$season))
episode_num=$((10#$episode))
# Calculate absolute episode number
abs_episode=$episode_num
# Sum episodes of previous seasons
for ((s=1; s<season_num; s++)); do
# Define the number of episodes in each season manually (modify accordingly)
case $s in
1) abs_episode=$((abs_episode + 15)) ;; # Season 1 has 15 episodes
2) abs_episode=$((abs_episode + 11)) ;; # Season 1 has 15 episodes
3) abs_episode=$((abs_episode + 4)) ;; # Season 1 has 15 episodes
4) abs_episode=$((abs_episode + 23)) ;; # Season 1 has 15 episodes
5) abs_episode=$((abs_episode + 5)) ;; # Season 1 has 15 episodes
6) abs_episode=$((abs_episode + 4)) ;; # Season 1 has 15 episodes
7) abs_episode=$((abs_episode + 20)) ;; # Season 1 has 15 episodes
8) abs_episode=$((abs_episode + 12)) ;; # Season 1 has 15 episodes
9) abs_episode=$((abs_episode + 3)) ;; # Season 1 has 15 episodes
10) abs_episode=$((abs_episode + 6)) ;; # Season 1 has 15 episodes
# Add more seasons here if needed
*) echo "Unknown season count for S$s, adjust script manually." ; exit 1 ;;
esac
done
# Construct the new filename
new_filename=$(echo "$filename" | sed -E "s/(S[0-9]+E[0-9]+)/\1 - $(printf '%03d' $abs_episode) - /")
# Rename the file
rename "s/$filename/$new_filename/" "$file"
echo "Renamed: $file -> $dir_path/$new_filename"
fi
done

@ -0,0 +1,12 @@
#!/bin/bash
# Check if a directory is provided, otherwise use the current directory
dir="${1:-.}"
# Find all .mkv files recursively
find "$dir" -type f -name "*.mkv" | while read -r file; do
# Check for subtitle tracks using mkvinfo
if ! mkvinfo "$file" | grep -q "Track type: subtitles"; then
echo "$file"
fi
done
Loading…
Cancel
Save