From 93f975db15e56a1a423c40d65e1627ac888d42b0 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 13 May 2020 03:39:24 -0400 Subject: add man page for audiocue2bincue --- Makefile | 6 +- audiocue2bincue | 90 +++++++++++ audiocue2bincue.1 | 92 +++++++++++ audiocue2bincue.html | 441 +++++++++++++++++++++++++++++++++++++++++++++++++++ audiocue2bincue.rst | 78 +++++++++ cuerecover.1 | 2 +- cuerecover.html | 4 +- miragextract.1 | 23 ++- miragextract.html | 23 ++- 9 files changed, 742 insertions(+), 17 deletions(-) create mode 100644 audiocue2bincue create mode 100644 audiocue2bincue.1 create mode 100644 audiocue2bincue.html create mode 100644 audiocue2bincue.rst diff --git a/Makefile b/Makefile index 5cca456..13540b1 100644 --- a/Makefile +++ b/Makefile @@ -39,9 +39,9 @@ RST2HTML=rst2html4.py PROJ=miragextract VERSION=0.2.0 -BINS=$(PROJ) cuerecover -MANS=$(PROJ).1 cuerecover.1 -HTMLS=$(PROJ).html cuerecover.html +BINS=$(PROJ) cuerecover audiocue2bincue +MANS=$(PROJ).1 cuerecover.1 audiocue2bincue.1 +HTMLS=$(PROJ).html cuerecover.html audiocue2bincue.html DOCS=README FAQ ChangeLog LICENSE $(PROJ).html cuerecover.html SNDFILE_CFLAGS:=$(shell pkg-config --cflags sndfile) diff --git a/audiocue2bincue b/audiocue2bincue new file mode 100644 index 0000000..84c1582 --- /dev/null +++ b/audiocue2bincue @@ -0,0 +1,90 @@ +#!/usr/bin/env perl -w + +# Convert an audio file based CD image into a raw bin/cue. +# Uses libsndfile to do the audio file decoding and conversion, +# except for mp3 files (use lame for those). + +# Please don't try to convince me to use CPAN modules for things like +# cue sheets or audio format conversions. This is me using perl as a +# 'glue' language, not an 'enterprise applications platform'. + +($self = $0) =~ s,.*/,,; + +if(!@ARGV || $ARGV[0] eq '--help') { + print <", $ARGV[1]; + select $out; +} + +# Everyone always complains about regex looking like gibberish, +# so here's my attempt at writing a readable(ish) one. +$match_file = qr{ + ^\s* # optional leading space/tabs + FILE # required token + \s+ # required one or more spaces before the filename + "? # optional quote (spec doesn't require it) + ([^"]+) # actual filename goes in $1 + "? # optional quote afterwards + \s+ # required space(s) before the type + (\w+) # type (BINARY, WAVE, MP3 maybe, etc) goes in $2 +}x; + +@ARGV = ($ARGV[0]); + +%audiofiles = (); + +while(<>) { + if(/$match_file/) { + my ($file, $type) = ($1, $2); + $audiofiles{$file}++; + print fix_line($_, $file, $type); + } else { + print; + } +} + +for(keys %audiofiles) { + my $newfilename = $new_filenames{$_}; + (my $rawfilename = $newfilename) =~ s/\.bin$/.raw/; + + my @cmd = (); + + if($_ =~ /mp3$/i) { + @cmd = ( "lame", "-t", "--quiet", "--decode" ); + push @cmd, "-x" if $swapbytes; + push @cmd, ( $_, $rawfilename ); + } else { + my $endarg = "-endian=" . ($swapbytes ? "big" : "little"); + @cmd = ( "sndfile-convert", "-pcm16", $endarg, $_, $rawfilename ); + } + + warn "Converting $_ to raw .bin with $cmd[0]\n"; + system(@cmd); + rename($rawfilename, $newfilename); +} + +sub fix_line { + my ($line, $filename, $type) = @_; + my $newfilename; + + if($type eq 'BINARY') { + warn "$filename is already type BINARY, leaving as-is\n"; + return $line; + } + + ($newfilename = $filename) =~ s/(?:\.\w+)?$/.bin/; + $new_filenames{$filename} = $newfilename; + return "FILE \"$newfilename\" BINARY\r\n"; +} diff --git a/audiocue2bincue.1 b/audiocue2bincue.1 new file mode 100644 index 0000000..7097cc6 --- /dev/null +++ b/audiocue2bincue.1 @@ -0,0 +1,92 @@ +.\" Man page generated from reStructuredText. +. +.TH AUDIOCUE2BINCUE 1 "2020-05-13" "0.2.0" "Urchlay" +.SH NAME +audiocue2bincue \- convert audio file based CD images to raw binary +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.\" RST source for audiocue2bincue(1) man page. Convert with: +. +.\" rst2man.py audiocue2bincue.rst > audiocue2bincue.1 +. +.\" rst2man.py comes from the SBo development/docutils package. +. +.\" note to self: don't forget to check the generated man and html pages +. +.\" into git since we don't want to require our users to have rst2man.py. +. +.SH SYNOPSIS +.sp +audiocue2bincue [\fB\-s\fP] [\fB\-n\fP] [\fBinput.cue\fP] [\fBoutput.cue\fP] +.SH DESCRIPTION +.sp +If you have a CD image that consists of a .cue (or .ccd, .mds, etc) file +and a .wav (or .ogg, .mp3, etc) audio file instead of a raw binary image, +you won\(aqt be able to use it with miragextract. +.sp +Since libmirage currently (as of 3.2.4) doesn\(aqt seem to support these, +the audiocue2bincue script is provided as a quick & dirty conversion tool. +.sp +audiocue2bincue reads the .cue sheet from standard input and writes the modified .cue +to standard output if no filenames are given. +.sp +Default action (without \-n) is to go ahead and convert the audio file(s) listed +in the .cue file to raw CD audio. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-s +Swap byte order during audio conversion. +.TP +.B \-n +Don\(aqt convert audio file(s) to .bin image, just write a .cue (which +won\(aqt be very useful, but it\(aqs good for testing). +.UNINDENT +.SH NOTES +.sp +audiocue2bincue is written in Perl, so you\(aqll need your OS\(aqs perl package +installed. It doesn\(aqt use any CPAN modules, so there aren\(aqt a ton of +perl\-blah dependencies. +.sp +Make sure you\(aqve got libsndfile installed, including the sndfile\-convert command on +your $PATH. +.sp +If you have an mp3\-based image, you\(aqll need lame installed and on your $PATH, since +libsndfile doesn\(aqt support mp3. +.sp +audiocue2bincue hasn\(aqt been thoroughly tested. It seems to work fine, but +you may run into nonstandard/weird/broken .cue files that it can\(aqt handle. +.SH AUTHOR +.sp +audiocue2bincue was written by B. Watson <\fI\%yalhcru@gmail.com\fP> and +released under the WTFPL: Do WTF you want with this. +.SH SEE ALSO +.sp +miragextract(1), cuerecover(1), sndfile\-convert(1), lame(1) +.\" Generated by docutils manpage writer. +. diff --git a/audiocue2bincue.html b/audiocue2bincue.html new file mode 100644 index 0000000..28abe75 --- /dev/null +++ b/audiocue2bincue.html @@ -0,0 +1,441 @@ + + + + + + +audiocue2bincue + + + + +
+

audiocue2bincue

+

convert audio file based CD images to raw binary

+ +++ + + + + + + + + + +
Manual section:1
Manual group:Urchlay
Date:2020-05-13
Version:0.2.0
+ + + + + +
+

SYNOPSIS

+

audiocue2bincue [-s] [-n] [input.cue] [output.cue]

+
+
+

DESCRIPTION

+

If you have a CD image that consists of a .cue (or .ccd, .mds, etc) file +and a .wav (or .ogg, .mp3, etc) audio file instead of a raw binary image, +you won't be able to use it with miragextract.

+

Since libmirage currently (as of 3.2.4) doesn't seem to support these, +the audiocue2bincue script is provided as a quick & dirty conversion tool.

+

audiocue2bincue reads the .cue sheet from standard input and writes the modified .cue +to standard output if no filenames are given.

+

Default action (without -n) is to go ahead and convert the audio file(s) listed +in the .cue file to raw CD audio.

+
+
+

OPTIONS

+ +++ + + + + + +
+-sSwap byte order during audio conversion.
+-nDon't convert audio file(s) to .bin image, just write a .cue (which +won't be very useful, but it's good for testing).
+
+
+

NOTES

+

audiocue2bincue is written in Perl, so you'll need your OS's perl package +installed. It doesn't use any CPAN modules, so there aren't a ton of +perl-blah dependencies.

+

Make sure you've got libsndfile installed, including the sndfile-convert command on +your $PATH.

+

If you have an mp3-based image, you'll need lame installed and on your $PATH, since +libsndfile doesn't support mp3.

+

audiocue2bincue hasn't been thoroughly tested. It seems to work fine, but +you may run into nonstandard/weird/broken .cue files that it can't handle.

+
+
+

AUTHOR

+

audiocue2bincue was written by B. Watson <yalhcru@gmail.com> and +released under the WTFPL: Do WTF you want with this.

+
+
+

SEE ALSO

+

miragextract(1), cuerecover(1), sndfile-convert(1), lame(1)

+
+
+ + diff --git a/audiocue2bincue.rst b/audiocue2bincue.rst new file mode 100644 index 0000000..755681e --- /dev/null +++ b/audiocue2bincue.rst @@ -0,0 +1,78 @@ +.. RST source for audiocue2bincue(1) man page. Convert with: +.. rst2man.py audiocue2bincue.rst > audiocue2bincue.1 +.. rst2man.py comes from the SBo development/docutils package. + +.. note to self: don't forget to check the generated man and html pages +.. into git since we don't want to require our users to have rst2man.py. + +.. |version| replace:: 0.2.0 +.. |date| date:: + +=============== +audiocue2bincue +=============== + +------------------------------------------------ +convert audio file based CD images to raw binary +------------------------------------------------ + +:Manual section: 1 +:Manual group: Urchlay +:Date: |date| +:Version: |version| + +SYNOPSIS +======== + +audiocue2bincue [**-s**] [**-n**] [**input.cue**] [**output.cue**] + +DESCRIPTION +=========== + +If you have a CD image that consists of a .cue (or .ccd, .mds, etc) file +and a .wav (or .ogg, .mp3, etc) audio file instead of a raw binary image, +you won't be able to use it with miragextract. + +Since libmirage currently (as of 3.2.4) doesn't seem to support these, +the audiocue2bincue script is provided as a quick & dirty conversion tool. + +audiocue2bincue reads the .cue sheet from standard input and writes the modified .cue +to standard output if no filenames are given. + +Default action (without -n) is to go ahead and convert the audio file(s) listed +in the .cue file to raw CD audio. + +OPTIONS +======= + +-s Swap byte order during audio conversion. + +-n Don't convert audio file(s) to .bin image, just write a .cue (which + won't be very useful, but it's good for testing). + +NOTES +===== + +audiocue2bincue is written in Perl, so you'll need your OS's perl package +installed. It doesn't use any CPAN modules, so there aren't a ton of +perl-blah dependencies. + +Make sure you've got libsndfile installed, including the sndfile-convert command on +your $PATH. + +If you have an mp3-based image, you'll need lame installed and on your $PATH, since +libsndfile doesn't support mp3. + +audiocue2bincue hasn't been thoroughly tested. It seems to work fine, but +you may run into nonstandard/weird/broken .cue files that it can't handle. + +AUTHOR +====== + +audiocue2bincue was written by B. Watson and +released under the WTFPL: Do WTF you want with this. + +SEE ALSO +======== + +miragextract(1), cuerecover(1), sndfile-convert(1), lame(1) diff --git a/cuerecover.1 b/cuerecover.1 index 05c377d..ff4e136 100644 --- a/cuerecover.1 +++ b/cuerecover.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH CUERECOVER 1 "2020-05-12" "0.2.0" "Urchlay" +.TH CUERECOVER 1 "2020-05-13" "0.2.0" "Urchlay" .SH NAME cuerecover \- generate .cue file for CD image .bin . diff --git a/cuerecover.html b/cuerecover.html index b4e3b7e..c4c5967 100644 --- a/cuerecover.html +++ b/cuerecover.html @@ -5,7 +5,7 @@ cuerecover - +