Guest User

Untitled

a guest
Jul 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ ! "$1" ]; then
  4. echo "Give a path as argument"
  5. exit 1
  6. fi
  7.  
  8. function is_seekable
  9. {
  10. if [ ! "$1" ]; then
  11. exit 1
  12. fi
  13.  
  14. if [ "$(metaflac --list --block-type=SEEKTABLE "$1" 2> /dev/null)" = "" ]; then
  15. if metaflac --list --block-type=SEEKTABLE "$1" 2> /dev/null; then
  16. return 1
  17. else
  18. return 0
  19. fi
  20. else
  21. return 0
  22. fi
  23. }
  24.  
  25. count=0
  26.  
  27. find . -iname '*.flac' | while read i
  28. do
  29. echo "checking $i"
  30. if ! is_seekable "$i"; then
  31. metaflac --add-seekpoint=1s "$i"
  32. echo "* Added seekpoints to file $i"
  33. let count++
  34. fi
  35. done
  36.  
  37. if [ $count -eq 0 ]; then
  38. echo "There were no flac files without checkpoints in folder $1"
  39. else
  40. echo "Successfully added seekpoints to $count flac file(s)"
  41. fi
Add Comment
Please, Sign In to add comment