View previous topic :: View next topic |
Author |
Message |
Re-JeeP Apprentice

Joined: 10 Oct 2006 Posts: 294 Location: Sweden
|
Posted: Tue Oct 09, 2007 9:25 pm Post subject: Script for adding seekpoints to a flac file |
|
|
Hi!
I noticed that I couldn't fast-forward / search flac-files in Amarok. So I made a little script to take care of that. What the script does is that it adds seekpoints to flac-files.
The script:
Code: | #!/bin/bash
if [ ! "$1" ]; then
echo "Give a path as argument"
exit 1
fi
function is_seekable
{
if [ ! "$1" ]; then
exit 1
fi
if [ "$(metaflac --list --block-type=SEEKTABLE "$1" 2> /dev/null)" = "" ]; then
if metaflac --list --block-type=SEEKTABLE "$1" 2> /dev/null; then
return 1
else
return 0
fi
else
return 0
fi
}
count=0
while read i; do
if ! is_seekable "$i"; then
metaflac --add-seekpoint=1s "$i"
echo "* Added seekpoints to file $i"
let count++
fi
done < <(find "$1" -name "*.flac" -type f)
if [ $count -eq 0 ]; then
echo "There were no flac files without checkpoints in folder $1"
else
echo "Successfully added seekpoints to $count flac file(s)"
fi |
The seekpoint interval is now set to 1 second. This isn't necessary and if you feel that you don't need that many points you can just change it to a higher number. For example:
Code: | --add-seekpoint=10s |
To run the script:
Code: | $ ./script musicfolder
$ ./script file.flac |
If you give a folder as argument it looks for flac files recursive.
Note: I'm not an experienced BASH programmer so there might be flaws in the script. But it works for me If you have suggestions I'm happy to take them. _________________ Dig where you stand! |
|
Back to top |
|
 |
Lenz Veteran


Joined: 17 Jul 2003 Posts: 1439 Location: Marburg [HE, D, EU]
|
Posted: Wed Mar 16, 2011 12:31 am Post subject: |
|
|
Hey, thanks a lot! Works great and saved me a lot of time! _________________ .:: Lenz' Signature 1.7b ::.
| Gentoo Linux since v1.4 (08-2003) [Screenshot]
| NetHack Highscore: 5.476.380 Pts., Val-Dwa-Fem-Law, ~ ascended to demigoddess-hood ~ |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|