Become a Site Supporter and Never see Ads again!

Author Topic: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux  (Read 4940 times)

0 Members and 1 Guest are viewing this topic.

Offline BlingFree

  • Trade Count: (2)
  • Taperssection Member
  • ***
  • Posts: 943
  • Gender: Male
  • Working the dumb end of a digital recorder.
    • Lossless Legs
reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« on: December 02, 2016, 03:53:12 PM »
Automation...  :coolguy:

This Linux shell script recursively finds all .flac files in a selected directory and tests FLAC integrity.

Would love input / critiques / chat / help form anyone. Hope it helps you out!


reflacs.sh
GitHub: https://github.com/BlingFree/reflacs
Direct Download: https://drive.google.com/open?id=0BykNc_CxDLTpeTVCQXlpX29ub0E

Code: [Select]
#!/bin/sh
#########
# reCURSIVE flac TESTING sCRIPT (reflacs) v0.0.1
# Searches directory and sub-directories for .flac files and tests FLAC for integrity.
# From gharris999's "testflacs.sh" found at: # http://forums.slimdevices.com/showthread.php?60307-Program-to-check-integrity-of-flac-files&p=398725&viewfull=1#post398725
# Modified by BlingFree on 2016-12-02 - please email modifications to prof.chomsky@gmail.com subject=reflacs
##########
# Requires 'flac' (sudo apt-get install flac)
# Usage: Copy 'reflacs.sh' to your FLAC library's parent folder (i.e /home/user/Music/)
# Usage: Type 'chmod +x reflacs.sh' then './reflacs.sh'
# Usage: Rawk \mm/
##########
DATE=$(/bin/date)
DIR=$(dirname "$1")
REPORT="$PWD/report.txt"
#
echo Recursively testing FLACs in "$PWD"
echo Decoding errors logged to "$REPORT"
sleep 5
echo Testing of "$PWD" and sub-directories started at "$DATE" >>"$REPORT"
echo Errors were found in the following FLAC files: >>"$REPORT"
#
/usr/bin/find "$DIR/" -name '*.flac' -type f -not -exec /usr/bin/flac -t '{}' \; -and -print >>"$REPORT"
#
echo Testing of "$PWD" completed on "$DATE" >>"$REPORT"
echo Testing complete.
echo Report saved to "$PWD"/report.txt
##########
# v0.0.2 Goals: Silence multiple FLAC ver/warranty warnings while showing file progress
# v0.0.2 Goals: Include error code output in report.txt. If no errors then make line 20 echo 'No errors to report.'
# v0.1.0 Goals: Command line executable with variables (example: reflacs /home/user/Media --silent, --no-report, --xml)
# v1.0.0 Goals: Cross-platform GUI
##########

report.txt output
Code: [Select]
Testing of /home/noam/Desktop and sub-directories started at Fri Dec  2 14:45:29 CST 2016
Errors were found in the following FLAC files:
./Festivaaaaaal 2007-05-18.19/2/bitm2007-05-19/bitm2007-05-19.matrix.GEMS.flac16/bitm2007-05-19d1t01.flac
Testing of /home/noam/Desktop completed on Fri Dec  2 14:45:29 CST 2016
« Last Edit: December 02, 2016, 04:16:54 PM by BlingFree »
Audio
* AKG SE-300B / CK 91 > Zoom H6
* powered by i.Sound Portable Power Max - 16000 mAh
Video
*coming soon??**

LMA uploads
bt.etree uploads
YouTube Playlists

Offline rastasean

  • in paradise
  • Trade Count: (23)
  • Needs to get out more...
  • *****
  • Posts: 3699
  • Gender: Male
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #1 on: December 02, 2016, 07:58:53 PM »
What's the actual error with ./Festivaaaaaal 2007-05-18.19/2/bitm2007-05-19/bitm2007-05-19.matrix.GEMS.flac16/bitm2007-05-19d1t01.flac?
Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than it’s worth.

Offline if_then_else

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 428
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #2 on: December 03, 2016, 02:55:42 AM »
How about this? Works fine for me on GNU/Linux...

N.B.: Non-GNU versions of command line tools like `find` and `date` might require different parameters (e.g. on aix or Solaris).
If portability is an issue, please consider coding in Perl or Python.

Code: [Select]
#!/bin/bash

# Check the parameters passed to this script
# -r is the path to the report/log file
# -d is the path to the directory that contains the flac files
usage() { echo "Usage: $0 [-r <string>] [-d <string>]" 1>&2; exit 1; }

while getopts ":r:d:" o; do
case "${o}" in
r)
r=${OPTARG}
;;
d)
d=${OPTARG}
;;
*)
        usage
;;
esac
done
shift $((OPTIND-1))

if [ -z "${r}" ] || [ -z "${d}" ]; then
usage
fi

echo "r = ${r}"
echo "d = ${d}"

if [ ! -d "${d}" ]; then
echo "Parameter passed for flac input directory doesn't correspond to a directory"
exit 2
fi

# Check if the dependency to the flac package is met
function check_deps {
FLAC_PATH=$(whereis flac | sed "s/^flac://" | awk '{$1=$1;print}')
DEPENDENCY_MET="NO"
if [ -n "${FLAC_PATH}" ]; then
DEPENDENCY_MET="YES"
fi

if [ "${DEPENDENCY_MET}" == "NO" ]; then
echo "Dependency to flac not met or binary not in your \$PATH. Please install the missing package first."
exit 1
fi
}

function test_flac_files {
IFS=$'\n'
for i in $(find "${d}" -type f -name "*.flac") ; do
# Note that flac **always** writes to stderr instead of stdout
# Therefore we redirect stderr to stdout here
RESULT=$(flac -s -t "${i}" 2>&1)
# Check the return code (0 = success)
STATUS=${?}
if [ ${STATUS} -ne 0 ]; then
echo "Integrity check FAILED for ${i}. Please check the log file."
echo "Integrity check FAILED for ${i}." >> "${r}"
echo "${RESULT}" >> "${r}"
NR_TESTS_FAILED=$((${NR_TESTS_FAILED}+1))
else
echo "Integrity check PASSED for ${i}"
echo "Integrity check PASSED for ${i}" >> "${r}"
NR_TESTS_PASSED=$((${NR_TESTS_PASSED}+1))
fi
done
}

check_deps

START_TIME_HR=$(date +'%d/%m/%Y %H:%M:%S:%3N')
echo "Testing of ${d} and sub-directories started at ${START_TIME_HR}"
echo "Testing of ${d} and sub-directories started at ${START_TIME_HR}" > "${r}"
START_TIME_EPOCH=$(date +%s)
NR_TESTS_PASSED=0
NR_TESTS_FAILED=0
test_flac_files
END_TIME_HR=$(date +'%d/%m/%Y %H:%M:%S:%3N')
echo "Testing of ${d} and sub-directories completed at ${END_TIME_HR}"
echo "Testing of ${d} and sub-directories completed at ${END_TIME_HR}" >> "${r}"
END_TIME_EPOCH=$(date +%s)
EXECUTION_TIME=$((${END_TIME_EPOCH}-${START_TIME_EPOCH}))
echo "Total execution time was ${EXECUTION_TIME} seconds"
echo "Total execution time was ${EXECUTION_TIME} seconds" >> "${r}"
echo "Total number of checks passed: ${NR_TESTS_PASSED}"
echo "Total number of checks failed: ${NR_TESTS_FAILED}"
« Last Edit: December 03, 2016, 03:44:00 AM by if_then_else »

Offline dabbler

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 359
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #3 on: December 03, 2016, 06:51:38 PM »
I use a oneliner that parallelizes with "-P$(nproc)"

  find "$DIR" -name '*.flac' -type f -print0 |xargs -0 -n1 -P$(nproc) flac -st

"-n1" means a new "flac" command is spawned for every file,
increasing granularity and thus ability to parallelize.

"nproc" is in newer GNU coreutils, and "-P" and "-0" require GNU xargs;
you can just use the number of cores you have if you don't have "nproc".


Btw, if_then_else: is your name because you're a programmer or a fan of the album by The Gathering? (I am both :)

Offline if_then_else

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 428
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #4 on: December 03, 2016, 11:35:34 PM »
Btw, if_then_else: is your name because you're a programmer or a fan of the album by The Gathering? (I am both :)

Both, actually.

Thanks for the hint about -P$(nproc). Could use something like this on aix if it wasn't GNU-only.

Offline BlingFree

  • Trade Count: (2)
  • Taperssection Member
  • ***
  • Posts: 943
  • Gender: Male
  • Working the dumb end of a digital recorder.
    • Lossless Legs
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #5 on: December 04, 2016, 05:00:18 PM »
<3 u guys :D

I appreciate the input and will research it in the upcoming week. I want to learn coding in a proper language so any resources for dummies would be nice!
Audio
* AKG SE-300B / CK 91 > Zoom H6
* powered by i.Sound Portable Power Max - 16000 mAh
Video
*coming soon??**

LMA uploads
bt.etree uploads
YouTube Playlists

Offline BlingFree

  • Trade Count: (2)
  • Taperssection Member
  • ***
  • Posts: 943
  • Gender: Male
  • Working the dumb end of a digital recorder.
    • Lossless Legs
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #6 on: December 04, 2016, 05:04:16 PM »
What's the actual error with ./Festivaaaaaal 2007-05-18.19/2/bitm2007-05-19/bitm2007-05-19.matrix.GEMS.flac16/bitm2007-05-19d1t01.flac?

I corrupted it (a copy) with a hex editor so I knew the routine was actually working.
Audio
* AKG SE-300B / CK 91 > Zoom H6
* powered by i.Sound Portable Power Max - 16000 mAh
Video
*coming soon??**

LMA uploads
bt.etree uploads
YouTube Playlists

Offline if_then_else

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 428
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #7 on: December 05, 2016, 01:52:54 AM »
<3 u guys :D

I appreciate the input and will research it in the upcoming week. I want to learn coding in a proper language so any resources for dummies would be nice!

I quickly ported the shell script above to Perl.
The various modules used by this script should already be included in any major Perl distribution (such as ActivePerl, Strawberry Perl or their counterparts on UNIX/Linux).

Code: [Select]
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long qw(GetOptions);
use File::Find;
use POSIX;
use File::Glob;
 
my $usage = "Usage: $0 --r REPORT --d FLAC_DIRECTORY\n";

my $logfile;
my $flac_dir;
my @flac_files;

GetOptions(
'r=s' => \$logfile,
'd=s' => \$flac_dir
) or die "$usage";


$logfile = glob("$logfile");
$flac_dir = glob("$flac_dir");

if (($logfile eq "") or
($flac_dir eq "")) {
die "$usage";
}
unless (-d $flac_dir){
die "Parameter passed for flac input directory doesn't correspond to a directory\n";
}

sub check_dependencies {
my $flac_version = qx(flac -v);
$flac_version =~ s/[\r\n]+$//;
unless ($flac_version =~ /^(flac){1,1}[\t\s]+([\d]*\.)+[\d]*/) {
die "Dependency to flac not met or binary not in your \$PATH.
Please install the missing package respectively binary first.\n";
}
}

sub test_flac_files {
my $counter_tests_passed = 0;
my $counter_tests_failed = 0;

find ( \&wanted, $flac_dir );

open( my $fh_out, ">", $logfile ) || die "Can't open $logfile for writing: $!";
my $start_time_hr = strftime("%Y-%m-%d %H:%M:%S", localtime(time));
my $start_time_epoch = time();
print $fh_out "Check started at: ".$start_time_hr."\n";

for my $flac_file (@flac_files){
my $result = qx(flac -s -t "$flac_file" 2>&1);
my $status = $?;
if ($status != 0) {
print $fh_out "Integrity check FAILED for ".$flac_file.".
Please check the log file.\n";
print $fh_out "$result\n";
++$counter_tests_failed;
}
else {
print $fh_out "Integrity check PASSED for ".$flac_file.".\n";
++$counter_tests_passed;
}
}

my $end_time_hr = strftime("%Y-%m-%d %H:%M:%S", localtime(time));
my $end_time_epoch = time();
my $execution_time = $end_time_epoch - $start_time_epoch;

print $fh_out "Check finalised at: ".$end_time_hr."\n";
print $fh_out "Total execution time was ".$execution_time." seconds\n";

print "Total number of checks PASSED: ".$counter_tests_passed."\n";
print $fh_out "Total number of checks PASSED: ".$counter_tests_passed."\n";
print "Total number of checks FAILED: ".$counter_tests_failed."\n";
print $fh_out "Total number of checks FAILED: ".$counter_tests_failed."\n";
if ($counter_tests_failed > 0){
print "Check the log file for details.\n";
}

close $fh_out;
}

sub wanted {
if ((-f $_) and (/\.(flac)$/i)) {
push @flac_files, $File::Find::name;
}
}

&check_dependencies;
&test_flac_files;

Code: [Select]
~ $ perl  reflacs.pl --r "report.txt" --d "Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/"
Total number of checks PASSED: 9
Total number of checks FAILED: 1
Check the log file for details.

~ $ cat report.txt
Check started at: 2016-12-05 07:40:05
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/01 Track 01.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/03 Track 03.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/05 Track 05.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/06 Track 06.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/02 Track 02.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/09 Track 09.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/04 Track 04.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/07 Track 07.flac.
Integrity check PASSED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/08 Track 08.flac.
Integrity check FAILED for Musik/hey_colossus-magasin4-20140926-16bit-44100Hz/Arab Strap 2016-09-26 BBC Radio Scotland t03.flac.
Please check the log file.
Arab Strap 2016-09-26 BBC Radio Scotland t03.flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC

The input file is either not a FLAC file or is corrupted.  If you are
convinced it is a FLAC file, you can rerun the same command and add the
-F parameter to try and recover as much as possible from the file.
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC

Check finalised at: 2016-12-05 07:40:08
Total execution time was 3 seconds
Total number of checks PASSED: 9
Total number of checks FAILED: 1

BTW: The error above was thrown due to some renamed mp3 file...
« Last Edit: December 06, 2016, 12:06:32 PM by if_then_else »

Offline BlingFree

  • Trade Count: (2)
  • Taperssection Member
  • ***
  • Posts: 943
  • Gender: Male
  • Working the dumb end of a digital recorder.
    • Lossless Legs
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #8 on: December 05, 2016, 11:28:30 AM »

I quickly ported the shell script above to Perl.
The various modules used by this script should already be included in any major Perl distribution (such as ActivePerl, Strawberry Perl or their counterparts on UNIX/Linux).


Nice! I'll take some time this week to study what you've done and see what I can learn.

Note: I may be unclear of the usage.. I'll paste my i/o

Code: [Select]
noam@noam-GX614AA-ABA-a6330f:~/Desktop$ perl reflacs.pl --r report.txt --d /home/noam/desktop/

Parameter passed for flac input directory doesn't correspond to a directory
noam@noam-GX614AA-ABA-a6330f:~/Desktop$ perl reflacs.pl --r report.txt --d /home/noam/Desktop/
Total number of checks PASSED: 23
Total number of checks FAILED: 1
Check the log file for details.

Not sure where i went wrong but that was my output. I already have a few ideas so hopefully perl isn't too meaty for my vegetable head.
Audio
* AKG SE-300B / CK 91 > Zoom H6
* powered by i.Sound Portable Power Max - 16000 mAh
Video
*coming soon??**

LMA uploads
bt.etree uploads
YouTube Playlists

Offline if_then_else

  • Trade Count: (0)
  • Taperssection Member
  • ***
  • Posts: 428
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #9 on: December 05, 2016, 11:34:14 AM »
Note: I may be unclear of the usage.. I'll paste my i/o

Code: [Select]
noam@noam-GX614AA-ABA-a6330f:~/Desktop$ perl reflacs.pl --r report.txt --d /home/noam/desktop/

Parameter passed for flac input directory doesn't correspond to a directory
noam@noam-GX614AA-ABA-a6330f:~/Desktop$ perl reflacs.pl --r report.txt --d /home/noam/Desktop/
Total number of checks PASSED: 23
Total number of checks FAILED: 1
Check the log file for details.

Not sure where i went wrong but that was my output. I already have a few ideas so hopefully perl isn't too meaty for my vegetable head.

UNIX path names are case-specific. It's /home/noam/Desktop/ - not /home/noam/desktop/.

Also be careful when passing some "shortcuts" to this script (e.g. ~ instead of /home/noam), although it wasn't the source of error here. Might be worth expanding the user input via File::Glob which can handle the tilde character.

EDIT: Fixed one regex and the potential issue with the expansion of the tilde character in the Perl script above.
« Last Edit: December 06, 2016, 11:53:15 AM by if_then_else »

Offline rastasean

  • in paradise
  • Trade Count: (23)
  • Needs to get out more...
  • *****
  • Posts: 3699
  • Gender: Male
Re: reflacs.sh v0.0.1 - Recursive FLAC tester for Linux
« Reply #10 on: December 08, 2016, 01:39:05 AM »
ah, I get what the script is doing. You're using flac to run its own test. very cool. I also like the built in fail test to make sure it's working as expected.

FWIW, flac hasn't been released in a couple years but there's very recent work in the git repo.

maybe we'll get a 1.3.2 release soon:
commit 8594c5c4db683a1f1efb5a1ae509cf514741b996
Author: Erik de Castro Lopo <erikd@mega-nerd.com>
Date:   Tue Dec 6 20:04:18 2016 +1100

    doc/html/changelog.html: More updates for 1.3.2 release

but it's very easy to compile from source anyway.
Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than it’s worth.

 

RSS | Mobile
Page created in 0.083 seconds with 40 queries.
© 2002-2024 Taperssection.com
Powered by SMF