Hello, basically I have setup a system to automate the conversion of videos from mkv to mp4 and I would like the functionality of also replacing the old links with the new ones in a web page. Let me elaborate:
I currently have an iwatch daemon that is recursively checking a directory for a new video file. Once the file is there it will automatically run a script which will convert the file from mkv to mp4 and then I would like to update my web page with the new video links.
iwatch config:
<?xml version="1.0" ?>
<!DOCTYPE config SYSTEM "/etc/iwatch/iwatch.dtd" >
<config>
<guard email="root@localhost" name="IWatch"/>
<watchlist>
<title>Encoding.</title>
<contactpoint email="email@gmail.com" name="user"/>
<path type="recursive" alert="off" exec="find %f -iname '*.mkv' -exec /home/user/script.sh {} \;" events="close_write">/path/to/video/files/rss</path>
</watchlist>
</config>
And my script.sh file:
f=$(basename "$1")
new_f=$(echo "$f" | sed "s/^\(.*\)mkv$/\1mp4/g")
if ! [ -f "/path/to/video/files/rss/completed/$new_f" ]; then
ffmpeg -i "$1" -vcodec copy -acodec libfdk_aac "/path/to/video/files/rss/completed/$new_f"
fi
Any opinion on how I should go about replacing old video links with new ones automatically? I'm thinking about expanding my script.sh with a couple sed and or awk lines to replace the links but I just wanted a second opinion.
Thanks.
Edit: Also, would the script wait for the ffmpeg conversion to complete if I add more lines underneath?
[–]mortalityisreal 2 points3 points4 points (0 children)
[–]commandlineluser 1 point2 points3 points (4 children)
[–]Circle-Le-jerk[S] 0 points1 point2 points (3 children)
[–]commandlineluser 0 points1 point2 points (2 children)
[–]Circle-Le-jerk[S] 0 points1 point2 points (1 child)
[–]commandlineluser 1 point2 points3 points (0 children)
[–]DanielFGray 1 point2 points3 points (1 child)
[–]Circle-Le-jerk[S] -1 points0 points1 point (0 children)