View Full Version : Code Snippets
shevegen
2nd February 2005, 04:29
Hi,
if you have working Code snippets at doing any kind of work just post here.
Also post questions if you want.
And dont hesitate to "betterfy" ie improve whats collected here.
Matching .srt Time format via RegEx:
00:02:38,098
Regex:
/(\d\d):(\d\d):(\d\d),(\d\d\d)/
outlyer
23rd February 2005, 12:33
OK, this could become a nice thread if people gets into it.
Lets dump some random garbage...
This one I have in my .bashrc for AVIs broken at the container level (ie. AVIs that are repaired with a simple remux).
For those of you without shell functions knowledge, if it's in a file loaded on login, like .bashrc, it will behave as a command.
remuxavi() { # v0.99
if [ $# -lt 1 ];
then
echo "Usage: remuxavi input [input2 [input3 [...]]]" >&2
return 1
fi
while [ "$1" ];
do
OUTPUT_FILE=`dirname "$1"`/`basename "$1" .avi`.rmx.avi
mencoder -oac copy -ovc copy -of avi -idx "$1" -o "${OUTPUT_FILE}"
shift
done
}
Edit: 2005-02-23 16:04 UTC
Not really a snippet but if you're as clumsy as me this can come in handy: If you wipe a VIDEO_TS.IFO file (rendering a DVD useless/unrippable on a lot of Windows tools/hardware players), you can recreate it with:
dvdauthor --toc -o base_directory
(where base_directory is the one holding the VIDEO_TS and AUDIO_TS folders)
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.