Added rename_srt.sh
This commit is contained in:
parent
bf9c16a46a
commit
74c1b48e1d
|
@ -3,3 +3,4 @@
|
||||||
| urlhandler | Open URLs based on regular expressions. |
|
| urlhandler | Open URLs based on regular expressions. |
|
||||||
| yt2mpd.sh | Adds an Youtube video to MPD, with correct title and duration. |
|
| yt2mpd.sh | Adds an Youtube video to MPD, with correct title and duration. |
|
||||||
| fetch_gaidao.sh | Auf neue Ausgaben von der Gai Dao prüfen, herunterladen. |
|
| fetch_gaidao.sh | Auf neue Ausgaben von der Gai Dao prüfen, herunterladen. |
|
||||||
|
| rename_srt.sh | Rename srt files to match video files |
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Rename srt files to match video files
|
||||||
|
|
||||||
|
videofiles=""
|
||||||
|
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
echo "usage: ${0} /path/to/videofiles" >&2
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
videofiles="${1}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for file in *.srt; do
|
||||||
|
episode=$(echo "${file}" | grep -Eo '[0-9]{2}[. ]' | cut -d. -f1 | cut -d" " -f1)
|
||||||
|
newfile="$(ls ${videofiles}/*[Ee]${episode}*)"
|
||||||
|
newfile=$(basename "${newfile}")
|
||||||
|
mv -v "${file}" "${newfile}"
|
||||||
|
done
|
||||||
|
rename -v .mp4 .srt *
|
Loading…
Reference in New Issue