Giter Site home page Giter Site logo

cmcginty / mktoc Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 6.0 1.24 MB

Simple command line tool to create TOC files for CD burning with cdrdao.

Home Page: http://packages.python.org/mktoc/

License: Other

Python 47.08% Makefile 0.85% TeX 52.07%
unix-command python cuesheet cue toc toc-generator

mktoc's Introduction

Mktoc simplifies the steps needed to create audio CD TOC files for the cdrdao CD burning program. For users familiar with ExactAudioCopy or CdrWin, TOC files are synonymous with CUE sheets. The primary goal of mktoc is to create TOC files using a previously generated CUE sheet.

Features

  • Create a TOC file from a list of WAV files.
  • Convert an ExactAudioCopy (EAC) CUE file to the TOC format that is usable by cdrdao.
  • Multi-session aware CUE parsing, necessary for making CDDB and AccurateRip matchable discs.
  • Non-compliant CUE sheet support.
  • Support for various pregap methods.
  • Can create offset corrected WAV files for true 'bit-for-bit' accurate copies.
  • Fuzzy file name logic can correct common file name spelling variations.
  • Workaround known TOC file parsing bugs in cdrdao.

Usage

mktoc [OPTIONS] < CUE_FILE
mktoc [OPTIONS] [[-f] CUE_FILE] [[-o] TOC_FILE]
mktoc [OPTIONS] -w WAV_FILES [[-o] TOC_FILE]

CUE_FILE must contain a valid CUE format. When *_FILE is not provided, the program will read from STDIN. All output will be sent to STDOUT.

All attempts will be made to preserve any and all information from the input file. For any case where the CUE file contains unknown or bad values, the user will be notified on STDERR.

Options

--version show program's version number and exit
-h show help message and exit
--help show detailed usage instructions and exit
-a, --allow-missing-wav
 do not abort when WAV file(s) are missing, (experts only). It is possible when using this option that a bug in cdrdao will create a CD that ignores the pregap definitions in the TOC file. Only use this option if the CUE file does not contain pregaps, or if you do not wish to retain the pregap information.
-c <WAV_OFFSET>, --offset-correction=<WAV_OFFSET>
 correct reader/writer offset by creating WAV file(s) shifted by WAV_OFFSET samples (original data is not modified)
-d, --debug enable debugging statements
-f <CUE_FILE>, --file=<CUE_FILE>
 specify the input CUE file to read
-m, --multi for safety, this option must be set when creating a mulit-session TOC file
-o <TOC_FILE>, --output=<TOC_FILE>
 specify the output TOC file to write
-t, --use-temp write offset corrected WAV files to /tmp directory
-w, --wave write a TOC file using list of WAV files
-z, --no-multi disable multi-session support; program assumes TOC will be written in single-session mode

Examples

  1. Create a TOC file from a set of WAV files:

    mktoc -w *.wav
    
  2. Write a TOC file to toc_file.toc, from a set of WAV files:

    mktoc -w *.wav toc_file.toc
    mktoc -w *.wav > toc_file.toc
    mktoc -w *.wav -o toc_file.toc
    
  3. Create a TOC file from a valid CUE file:

    mktoc cue_file.cue
    mktoc < cue_file.cue
    mktoc -f cue_file.cue
    
  4. Write a TOC file to toc_file.toc, given an input CUE file:

    mktoc cue_file.cue toc_file.toc
    mktoc < cue_file.cue > toc_file.toc
    mktoc -f cue_file.cue -o toc_file.toc
    
  5. Tell mktoc to ignore missing WAV file errors. There is a potential that the result TOC file will cause cdrdao to loose pregap information during the burn process (see above):

    mktoc -a cue_file.cue
    
  6. Adjust WAV files for a CD writer offset value. For example, if your CD writer has a -30 sample write offset, it can be corrected by offsetting the input WAV files by +30 samples. New WAV files will be placed in the working directory in a new dir called wav+30:

    mktoc -c 30 < cue_file.cue
    
  7. Adjust WAV files for a CD writer offset value, but create new files in the /tmp directory:

    mktoc -c 30 -t < cue_file.cue
    

Contact

E-mail

mktoc[@]tuxcoder[dot]com

Info

mktoc's People

Contributors

cmcginty avatar joelametta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mktoc's Issues

setup.py fails on MacOSX

So, I cloned the repo, read the README and didn't see any instructions for install, and I didn't see any script I could run like mktoc in the clone.... but I saw setup.py, so I tried to run it, and... this is what I get:

Traceback (most recent call last):
  File "./setup.py", line 17, in <module>
    import mktoc
  File "/Users/kevin/skydrive/Music/iPhone6 Recorder/mktoc/mktoc/__init__.py", line 166, in <module>
    import mktoc.cmdline
  File "/Users/kevin/skydrive/Music/iPhone6 Recorder/mktoc/mktoc/cmdline.py", line 15, in <module>
    import chardet.universaldetector
ImportError: No module named chardet.universaldetector

I'm on MacOSX...

bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.

python --version
Python 2.7.12

Maybe add something to the README how to install & use this code? If it's buried in the directories, maybe give an example path I can pull it from? If it's setup.py, maybe tell me the prereqs I need installed to avoid the above error?

Seems like mktoc can't handle accented characters

While converting the following .cue file, mktoc throws up the error below:
Traceback (most recent call last):
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/cmdline.py", line 314, in main
CommandLine().run()
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/cmdline.py", line 58, in run
self._run(argv)
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/cmdline.py", line 84, in _run
cd_obj = p.parse( fh_in)
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/parser.py", line 473, in parse
return csm( cue )
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/parser.py", line 284, in call
super(CueStateMachine,self).call(a,*kw)
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/fsm.py", line 65, in call
self.**match_handlers[match_name](match_name, *match_groups)
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/parser.py", line 331, in cmd_index
idx = disc.TrackIndex( idx_num, time, self.file
)
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/disc.py", line 312, in __init**
log.debug( 'creating index %s' % repr(self) )
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 17: ordinal not in range(128)

Thew .cue file that originates this error is:
REM GENRE Folk
REM DATE 1994
REM DISCID C00D4C0D
REM COMMENT "ExactAudioCopy v0.99pb3"
PERFORMER "Modena City Ramblers"
TITLE "Riportando tutto a casa"
FILE "01_In un giorno di pioggia.wav" WAVE
TRACK 01 AUDIO
TITLE "In un giorno di pioggia"
PERFORMER "Modena City Ramblers"
INDEX 00 00:00:00
INDEX 01 00:00:32
FILE "02_Tant par tachér - The Atholl Highlanders.wav" WAVE
TRACK 02 AUDIO
TITLE "Tant par tachér - The Atholl Highlanders"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "03_Quarant'anni.wav" WAVE
TRACK 03 AUDIO
TITLE "Quarant'anni"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "04_Delinqueint ed M'dna.wav" WAVE
TRACK 04 AUDIO
TITLE "Delinqueint ed M'dna"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "05_Morte di un poeta.wav" WAVE
TRACK 05 AUDIO
TITLE "Morte di un poeta"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "06_I funerali di Berlinguer.wav" WAVE
TRACK 06 AUDIO
TITLE "I funerali di Berlinguer"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "07_Il bicchiere dell'addio.wav" WAVE
TRACK 07 AUDIO
TITLE "Il bicchiere dell'addio"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "08_Canto di Natale.wav" WAVE
TRACK 08 AUDIO
TITLE "Canto di Natale"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "09_Ahmed l'ambulante.wav" WAVE
TRACK 09 AUDIO
TITLE "Ahmed l'ambulante"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "10_Contessa.wav" WAVE
TRACK 10 AUDIO
TITLE "Contessa"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "11_Bella ciao.wav" WAVE
TRACK 11 AUDIO
TITLE "Bella ciao"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "12_The Great Song of Indifference.wav" WAVE
TRACK 12 AUDIO
TITLE "The Great Song of Indifference"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00
FILE "13_Ninnananna.wav" WAVE
TRACK 13 AUDIO
TITLE "Ninnananna"
PERFORMER "Modena City Ramblers"
INDEX 01 00:00:00

File not open for reading

Each time I try to send output to file, I get the error "File not open for reading". Here is examples:

$ mktoc -w *.wav toc_file.toc
File not open for reading
$

$ mktoc -f CDImage.wav.cue -o CDImage.toc
File not open for reading
$

$ mktoc "CDImage.wav.cue" "CDImage.toc"
File not open for reading
$

$ mktoc --version
mktoc 1.3
$

The first three are just showing I tried a few methods and the second to show all is installed and version.

Still Maintained..?

Hi. I happened upon this app a year or so back and it really does represent the holy grail in terms of enabling the converting of non compliant cue's to toc and also adjusting for write offsets.

I was able to use the most recent version forked by a member of Whipper team, who appear to have assisted the port to Python 3, but when trying to run this in two different distros within the last week, I get build errors.

Now these I'll admit may be as a result of some knowledge gap on my part, but I just thought I'd enquire re whether this is still being maintained, as in my mind at least, this is still a unique tool in Nix land in terms of what it achieved and I'm surprised it hasn't ever been picked up and packaged by many/more distros accordingly.

mktoc yields error

This is what I get whenever I run mktoc-1.2:
Traceback (most recent call last):
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/cmdline.py", line 312, in main
CommandLine().run()
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/cmdline.py", line 58, in run
self._run(argv)
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/cmdline.py", line 121, in run
""" % (cd_obj.last_index.len
.frames-2)) # see note for '-2'
File "/home/paolo/.local/lib64/python2.7/site-packages/mktoc/parser.py", line 72, in last_index
assert self.disc.is_multisession
AssertionError

Command line is:
paolo@paolop ~ $ ~/.local/bin/mktoc -a Obscured\ By\ Clouds.CUE

Wave offset broken for Python3 port

@JoeLametta - I needed this patch for the offset writing to work. Please verify with --offset-correction=6 (or another number, of course)

Maybe we'd need a test for it, too. :p

From: Merlijn Wajer <[email protected]>
Date: Sun, 14 Jul 2019 01:44:01 +0200
Subject: [PATCH] wavoffsetwriter: port to python3

---
 mktoc/wav.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mktoc/wav.py b/mktoc/wav.py
index b345536..d27617d 100644
--- a/mktoc/wav.py
+++ b/mktoc/wav.py
@@ -341,12 +341,12 @@ class WavOffsetWriter(object):
          self._write_frames(wav_out, data ,bytes_p_samp)
          wav_in.close()
       else:    # insert silence if no previous file
-         self._write_frames(wav_out ,'\x00'*offset_bytes, bytes_p_samp)
+         self._write_frames(wav_out ,b'\x00'*offset_bytes, bytes_p_samp)
       # add original file data to output stream
       wav_in = wave.open( fn )
       samples = wav_in.getnframes() - self._offset
       while samples:
-         data = wav_in.readframes( min(samples,self._COPY_SIZE) )
+         data = wav_in.readframes( int(min(samples,self._COPY_SIZE)) )
          samples -= len(data) / bytes_p_samp
          self._write_frames(wav_out, data, bytes_p_samp)
       wav_in.close()
-- 
2.17.1

Python3 Track time calculation

The new python 3 version doesn't work with any of my cuefiles, always erroring out with "Track time calculation resulted in a negative value" if at least one wav file is present. If there are no files there and I override the warning with -a, it successfully prints a toc file with 00:00:00 for all the track timings.

If I add print self._time after line 396

         # extract time from string
         val = [int(x) for x in arg.split(':')]
         self._time = tuple(val)

and compare the behaviour with the py2 version, I get only 2 or 3 lines of track times printed (and then the error), whereas the py2 version prints all the track times.

It seems that the issue isn't with your py3 port commit, but rather with the code that wasn't changed from the original.
The old version works flawlessly. Please could you look into it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.