daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Jul 17th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top