mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-26 13:18:35 -06:00
Added rename-subs
This commit is contained in:
parent
64b0b047a2
commit
36fb93790a
1 changed files with 18 additions and 0 deletions
18
rename-subs
Normal file
18
rename-subs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# It renames the .srt files in a directory to match the .mp4 movie names (since those are the formats I usually need).
|
||||||
|
# It makes the subs discoverable by virtually any video player.
|
||||||
|
|
||||||
|
for f in *.mp4; do
|
||||||
|
if [ -f "$f" ]; then
|
||||||
|
h=$(basename "$f" .mp4)
|
||||||
|
echo "Renaming the subtitle (if any) accompanying $h.mp4..."
|
||||||
|
n=$(find . -maxdepth 1 -name "*.srt" -printf '.' | wc -m)
|
||||||
|
if [ $n -eq 1 ] && ! [ -f $h.srt ]; then
|
||||||
|
mv *.srt $h.srt
|
||||||
|
echo "Done!"
|
||||||
|
else
|
||||||
|
echo "Unable to find unique srt file that needs to be renamed."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in a new issue