Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
Big bug fix, accidentally blocked all non flac output types for
Browse files Browse the repository at this point in the history
the new flac to flac feature, oops. Also cleaned up and made more
readable the validation logics, which is how I made the mistake
in the first place. Also updated man page to reflect current options.
  • Loading branch information
smxi committed Aug 22, 2020
1 parent 1f8b65b commit 511491c
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 95 deletions.
190 changes: 100 additions & 90 deletions acxi
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ use Data::Dumper;

## SELF INFO ##
my $SELF_NAME = 'acxi';
my $SELF_VERSION = '3.3.26';
my $SELF_DATE = '2020-08-16';
my $SELF_VERSION = '3.3.27';
my $SELF_DATE = '2020-08-22';

## GLOBALS ##
my %run;
Expand Down Expand Up @@ -1814,33 +1814,38 @@ sub check_in_out_types {
eval $print_line_large;
print main::dotify("Checking input and output types");
}
if ($run{'ffmpeg'} && ($INPUT_TYPE !~ /^(flac)$/ || $OUTPUT_TYPE !~ m/^(flac|ogg)$/i) ){
if ($run{'ffmpeg'} && ($INPUT_TYPE !~ /^(flac)$/ || $OUTPUT_TYPE !~ m/^(flac|ogg|opus)$/i) ){
$b_error = 1;
$error_message .= "\n The input/output type combination you entered is not supported: ";
$error_message .= "\n The --ffmpeg input/output type combination you entered is not supported: ";
$error_message .= "in: $INPUT_TYPE out: $OUTPUT_TYPE";
}
if ((!$run{'checksum'} && !$run{'checksum-verify'} &&
$INPUT_TYPE !~ m/^(aiff?|flac|mp3|raw|shn|wav)$/i) ||
(($run{'checksum'} || $run{'checksum-verify'} || $run{'autotag'}) &&
$INPUT_TYPE !~ m/^(flac)$/i)){
if ($INPUT_TYPE !~ m/^(aiff?|flac|mp3|raw|shn|wav)$/i ){
$b_error = 1;
$error_message .= "\n The input type you entered is not supported: ";
$error_message .= "$INPUT_TYPE";
}
if ( $b_check_out && $OUTPUT_TYPE !~ m/^(flac|mp3|ogg|opus)$/i ){
if (($run{'checksum'} || $run{'checksum-verify'} || $run{'autotag'}) &&
$INPUT_TYPE !~ m/^(flac)$/i){
$b_error = 1;
$error_message .= "\n The output type you entered is not supported: ";
$error_message .= "$OUTPUT_TYPE";
}
if ( $b_check_out && $OUTPUT_TYPE eq lc('mp3') && $INPUT_TYPE ne lc('flac') ){
$b_error = 1;
$error_message .= "\n The output type $OUTPUT_TYPE you entered ";
$error_message .= "only supports input type: flac";
$error_message .= "\n The input type you entered is not supported for checksum/tagging operations: ";
$error_message .= "$INPUT_TYPE";
}
if ($b_check_out && $INPUT_TYPE =~ m/^(aiff?|flac|mp3|raw|shn)$/i && $OUTPUT_TYPE ne lc('flac')){
$b_error = 1;
$error_message .= "\n The input type $INPUT_TYPE you entered ";
$error_message .= "only supports output type: flac";
if ($b_check_out){
if ($OUTPUT_TYPE !~ m/^(flac|mp3|ogg|opus)$/i ){
$b_error = 1;
$error_message .= "\n The output type you entered is not supported: ";
$error_message .= "$OUTPUT_TYPE";
}
if ($OUTPUT_TYPE eq lc('mp3') && $INPUT_TYPE ne lc('flac') ){
$b_error = 1;
$error_message .= "\n The output type $OUTPUT_TYPE you entered ";
$error_message .= "only supports input type: flac";
}
if ($INPUT_TYPE =~ m/^(aiff?|mp3|raw|shn)$/i && $OUTPUT_TYPE ne lc('flac')){
$b_error = 1;
$error_message .= "\n The input type $INPUT_TYPE you entered ";
$error_message .= "only supports output type: flac";
}
}
if ( $b_error ){
main::error_handler('unsupported-type',$error_message,0);
Expand Down Expand Up @@ -1887,93 +1892,98 @@ sub check_application_paths {
if ( $LOG_LEVEL > 0 ) {
print main::dotify("Checking required tools paths");
}
if ($b_check_out && $OUTPUT_TYPE eq 'flac') {
$app_paths .= "$COMMAND_FFMPEG";
if ( ! -x "$COMMAND_FFMPEG" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_FFMPEG";
}
}
elsif ($b_check_out && ($OUTPUT_TYPE eq 'ogg' || $OUTPUT_TYPE eq 'opus' ) ) {
if (!$run{'ffmpeg'}){
if ($OUTPUT_TYPE eq 'ogg'){
$app_paths .= "\n $COMMAND_OGG";
if ( ! -x "$COMMAND_OGG" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_OGG";
}
if ($b_check_out){
if ($OUTPUT_TYPE eq 'flac') {
$app_paths .= "$COMMAND_FFMPEG";
if ( ! -x "$COMMAND_FFMPEG" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_FFMPEG";
}
elsif ($OUTPUT_TYPE eq 'opus'){
$app_paths .= "\n $COMMAND_OPUS";
if (!$run{'ffmpeg'}){
if ( ! -x "$COMMAND_OPUS" ) {
}
elsif ($OUTPUT_TYPE eq 'ogg' || $OUTPUT_TYPE eq 'opus' ) {
if (!$run{'ffmpeg'}){
if ($OUTPUT_TYPE eq 'ogg'){
$app_paths .= "\n $COMMAND_OGG";
if ( ! -x "$COMMAND_OGG" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_OPUS";
$error_message .= "\n Encoding application not available: $COMMAND_OGG";
}
}
elsif ($OUTPUT_TYPE eq 'opus'){
$app_paths .= "\n $COMMAND_OPUS";
if (!$run{'ffmpeg'}){
if ( ! -x "$COMMAND_OPUS" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_OPUS";
}
}
}
}
else {
$app_paths .= "\n $COMMAND_FFMPEG";
if ( ! -x "$COMMAND_FFMPEG" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_FFMPEG";
}
}
}
else {
$app_paths .= "\n $COMMAND_FFMPEG";
if ( ! -x "$COMMAND_FFMPEG" ) {
elsif ($OUTPUT_TYPE eq 'mp3' ) {
$app_paths .= "\n $COMMAND_LAME ";
if ( ! -x "$COMMAND_LAME" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_FFMPEG";
$error_message .= "\n Encoding application not available: $COMMAND_LAME";
}
$app_paths .= "$COMMAND_FLAC ";
if ( ! -x "$COMMAND_FLAC" ) {
$b_error = 1;
$error_message .= "\n Input processor $COMMAND_FLAC needed by lame ";
$error_message .= "not available.";
}
}
}
elsif ($b_check_out && $OUTPUT_TYPE eq 'mp3' ) {
$app_paths .= "\n $COMMAND_LAME ";
if ( ! -x "$COMMAND_LAME" ) {
$b_error = 1;
$error_message .= "\n Encoding application not available: $COMMAND_LAME";
}
$app_paths .= "$COMMAND_FLAC ";
if ( ! -x "$COMMAND_FLAC" ) {
$b_error = 1;
$error_message .= "\n Input processor $COMMAND_FLAC needed by lame ";
$error_message .= "not available.";
}
$app_paths .= "$COMMAND_METAFLAC ";
# Added: Odd @2011-03-23 01:55:28
if ( ! -x "$COMMAND_METAFLAC" ) {
$b_error = 1;
$error_message .= "\n $COMMAND_METAFLAC not found. Required to copy ";
$error_message .= "ID3 tags from Flac to MP3.";
}
}
elsif ($run{'checksum'} || $run{'checksum-verify'}){
$app_paths .= "$COMMAND_MD5 ";
# Added: Odd @2011-03-23 01:55:28
if ( ! -x "$COMMAND_MD5" ) {
$b_error = 1;
$error_message .= "\n $COMMAND_MD5 not found. Required to generate ";
$error_message .= "md5 checksum files.";
}
if ($run{'checksum'}){
$app_paths .= "$COMMAND_METAFLAC ";
# Added: Odd @2011-03-23 01:55:28
if ( ! -x "$COMMAND_METAFLAC" ) {
$b_error = 1;
$error_message .= "\n $COMMAND_METAFLAC not found. Required to generate ";
$error_message .= "ffp checksum files.";
$error_message .= "\n $COMMAND_METAFLAC not found. Required to copy ";
$error_message .= "ID3 tags from Flac to MP3.";
}
}
if ($run{'checsum-verify'}){
$app_paths .= "$COMMAND_FLAC ";
if (! -x "$COMMAND_FLAC"){
}
else {
# Note: -AK but not -AV
if ($run{'checksum'} || $run{'checksum-verify'}){
$app_paths .= "$COMMAND_MD5 ";
# Added: Odd @2011-03-23 01:55:28
if ( ! -x "$COMMAND_MD5" ) {
$b_error = 1;
$error_message .= "\n $COMMAND_FLAC not found. Required to verify ";
$error_message .= "$INPUT_TYPE files.";
$error_message .= "\n $COMMAND_MD5 not found. Required to generate ";
$error_message .= "md5 checksum files.";
}
if ($run{'checksum'}){
$app_paths .= "$COMMAND_METAFLAC ";
# Added: Odd @2011-03-23 01:55:28
if ( ! -x "$COMMAND_METAFLAC" ) {
$b_error = 1;
$error_message .= "\n $COMMAND_METAFLAC not found. Required to generate ";
$error_message .= "ffp checksum files.";
}
}
if ($run{'checsum-verify'}){
$app_paths .= "$COMMAND_FLAC ";
if (! -x "$COMMAND_FLAC"){
$b_error = 1;
$error_message .= "\n $COMMAND_FLAC not found. Required to verify ";
$error_message .= "$INPUT_TYPE files.";
}
}
}
}
elsif ($run{'autotag'}){
$app_paths .= "$COMMAND_METAFLAC ";
# Added: Odd @2011-03-23 01:55:28
if ( ! -x "$COMMAND_METAFLAC" ) {
$b_error = 1;
$error_message .= "\n $COMMAND_METAFLAC not found. Required to auto-tag ";
$error_message .= "collection files.";
if ($run{'autotag'}){
$app_paths .= "$COMMAND_METAFLAC ";
# Added: Odd @2011-03-23 01:55:28
if ( ! -x "$COMMAND_METAFLAC" ) {
$b_error = 1;
$error_message .= "\n $COMMAND_METAFLAC not found. Required to auto-tag ";
$error_message .= "collection files.";
}
}
}
if ( $b_error ) {
Expand Down
10 changes: 5 additions & 5 deletions acxi.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH ACXI 1 "2020\-08\-18" acxi "acxi manual"
.TH ACXI 1 "2020\-08\-22" acxi "acxi manual"
.SH NAME
acxi \- Command line audio conversion tool
.SH SYNOPSIS
Expand Down Expand Up @@ -354,7 +354,7 @@ exist. This is useful if you for example want to change compression
quality on existing files.

.TP
.B \-\-fork [0-xx]\fR, \fB\-F\fR
.B \-\-fork [0-xx]\fR, \fB\-F [0-xx]\fR
Uses Perl module \fBParallel::ForkManager\fR to allow for forking of audio
file conversions actions. This can speed up your syncing a lot depending on how
many threads your CPU can support and how many you assign with this option.
Expand All @@ -381,7 +381,7 @@ conversion tools for flac, mp3, ogg, or opus output. Same as \fB\-\-log 3\fR
This help menu.

.TP
.B \-\-image [cover image file name|remove]\fR
.B \-\-image [cover image file name|remove]\fR, \fB\-I [cover image file name|remove]\fR
Flac only. Use only on a single directory. Takes the supplied cover image
file and embeds it into the existing flac files. Use with \fB\-\-remove-images\fR
if you want to remove existing embedded images. If this option is not used, it
Expand All @@ -404,7 +404,7 @@ Sample: \fBacxi \-s ./ \-\-image remove\fR
Sample: \fBacxi \-s ./ \-I cover.jpg \-\-remove\-images\fR

.TP
.B \-\-input [aif|flac|raw|shn|wav]\fR, \fB\-i [flac|raw|shn|wav]\fR
.B \-\-input [aif|flac|raw|shn|wav]\fR, \fB\-i [aif|flac|raw|shn|wav]\fR
Input type. Supported types: flac, wav, raw, shn.

\fBaif/raw/shn\fR \- only support flac output.
Expand Down Expand Up @@ -839,7 +839,7 @@ You can also visit
.B acxi
is a fork and full rewrite of flac2ogg.pl.

Copyright (c) Harald Hope, 2010\-2019
Copyright (c) Harald Hope, 2010\-2020

Forking logic: prupert. 2019-07

Expand Down

0 comments on commit 511491c

Please sign in to comment.