HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.2.34
System: Linux atalantini.com 3.10.0-1127.13.1.el7.x86_64 #1 SMP Tue Jun 23 15:46:38 UTC 2020 x86_64
User: root (0)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: //usr/share/worker/scripts/cd2flac.sh
#! /bin/bash
# Example script for use with worker
# converts CD tracks to other formats
# based on scripts by Giulio Canevari <giuliogiuseppecarlo@interfree.it>

if [ "$#" -lt "1" ]; then
  echo "$0 <title1> ..."
  exit 5
fi

case "`basename $0`" in
  cd2flac*)
    MODE="flac"
    PROGS="cdparanoia normalize flac"
    ;;
  cd2mp3*)
    MODE="mp3"
    PROGS="cdparanoia normalize lame"
    ;;
  cd2ogg*)
    MODE="ogg"
    PROGS="cdparanoia normalize oggenc"
    ;;
  *)
    MODE="wav"
    PROGS="cdparanoia normalize"
    ;;
esac

for i in $PROGS; do
  if [ -z "`which $i 2>/dev/null`" ]; then
    echo "You need $i to run this script!"
    exit 5
  fi
done

if [ -z "$TMP" ]; then
  TMP=/tmp
fi

for T in $*; do
  while true; do
    TF="$TMP/worker-$$-$RANDOM.wav"
    if [ ! -e "$TF" ]; then
      touch "$TF"
      chmod 0600 "$TF"
      break
    fi
  done
  cdparanoia $T "$TF"
  normalize "$TF"
  case "$MODE" in
    flac)
      flac --best "$TF" -o Track-$T.flac
      ;;
    mp3)
      lame -b 256 "$TF" Track-$T.mp3
      ;;
    ogg)
      oggenc -q 8 "$TF" -o Track-$T.ogg
      ;;
    *)
      mv "$TF" Track-$T.wav
      ;;
  esac
  rm -f "$TF"
done