public
Description: A collection of audio handling programs which work from the command line.
Homepage: http://audiotools.sourceforge.net
Clone URL: git://github.com/tuffy/python-audio-tools.git
100644 492 lines (488 sloc) 21.82 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
* DONE Fix WAVE/MP3 formats to support MP3 audio in a WAVE container
  Instead of WaveAudio generating a nasty "compression not supported" error,
  its is_type() classmethod should return False.
  And, MP3Audio's is_type() classmethod should check for MP3 compressed
  RIFF WAVE containers.
  This isn't likely to mess up decoding, but may confuse ID3 tagging.
* DONE Allow file template to be specified on the command line
  When making new files with track2track, cd2track, etc.
* DONE Update the website with the latest documentation
* DONE Allow a unified %(album_track_number)s file template field
  If there's no album number, it's simply 2 digits of track number.
  Otherwise, it's a combination of the two fields.
  For example, album_number = 2 and track_number = 13 results in
  "213" for a value.
* DONE Update trackcat to take a cuesheet argument when outputting FLACs
  Thus, one can perform:
  trackcat --cuesheet=file.cue file1.wav file2.wav file3.wav -t flac -o cd.flac
  which will embed "file.cue" into "cd.flac" using metaflac.
  Though no other format I'm aware of supports this kind of cuesheet handling,
  being able to easily build solid disc images of a single FLAC file
  is much of the reason for trackcat/tracksplit.
* DONE Don't remove undone tracklint entries from its undo DB
  Since its checksum will change anyway and no longer match,
  explicitly removing the entry is no longer necessary
* DONE Support FLAC padding
  If changes to FLAC metadata are small enough, write over the
  padding (if present) rather than rewrite the whole file - like metaflac.
  This approach should speed up tagging considerably.
* DONE Fix image support in ID3v2
  Very large images can take a very long time to load.
* DONE Fix programs to key on album number and track number
  Certain programs, such as trackcmp, work on tracks across two directories
  and key on track number to determine which to compare to which.
  These need to be updated to use both track number and album number.
* DONE Adjust wave conversions to use album number, if present
  For example, converting track_number 15 and album_number 2 to WAVE
  should make a file "track215.cdda.wav" which then properly converts
  back to track_number 15 and album_number 2 if read.
* DONE Improve XMCD handling
  Support for XMCD files often breaks down if one or more tracks
  are missing.
  In some cases, there's no fix to be had (track2xmcd)
  but in most instances it should be made to work correctly.
* DONE Perform type inference wherever possible
  Anything with a single output file (trackcat and record2track)
  should be able to infer its output type from the track suffix, if possible.
* DONE Add "comment" field support to all metadata types
  Don't forget to add unit tests for comment field.
** TODO Sort "comment" fields correctly across all metadata types
** TODO Add --comment support to tracktag
* DONE Fix ID3v2 image support to handle Unicode descriptions
  The current implementation falls down on UTF-16 input,
  but I should have a solution from the COMM frame handler.
* DONE Limit ID3v2.2/2.3 to UCS-2 encoding
  The current implementation treats UCS-2 the same as UTF-16.
  This needs to be fixed so that really high unicode characters
  (above U+FFFF) are replaced with something within spec.
* DONE Unify ID3v2 frame handling
  In the beginning, there were text frames and Everything Else.
  Text frames were unicode strings,
  and Everything Else was a binary string of whatever.
  Now that ID3 is cluttered with APIC frames and COMM frames that need
  special treatment, ID3v2 needs an overhaul to more resemble FlacMetaData.
** DONE Ensure unknown frames are displayed correctly
   Anything that's not text, images or comments should get some sort
   of proper display instead of a Python object string.
* DONE Add app testing to the unit test suite
  Though not everything is unit-testable
  (such as the CD handling programs or anything X11)
  a lot of the batch programs are to some degree:
- [X] coverdump
- [X] track2track
- [X] trackcat
- [X] trackcmp
- [X] tracklength
- [X] tracklint
- [X] trackrename
- [X] tracksplit
- [X] tracktag
* DONE Add verbosity levels to programs
  Every batch program should support a -V --verbose flag
  with options for "silence","normal" (the default) and "debug".
  Silence shuts off everything but error messages.
  Normal is standard output behavior.
  Debug for additional debugging output.
- [X] cd2track
- [X] cd2xmcd
- [X] coverdump
- [X] record2track
- [X] track2cd (this will need to forward verbosity to cdrecord)
- [X] track2track
- [X] track2xmcd
- [X] trackcmp
- [X] trackrename
- [X] tracksplit
- [X] tracktag
- [X] tracklint
* DONE Add compression percentage display to trackinfo
  Though not massively useful, it'd be neat to see just how
  compressed audio tracks are, as a percentage of their original size.
* DONE Add support for W??? frames to ID3v2
  The various W??? frames are really just URLs and don't need to
  be displayed as hex-encoded blobs.
* DONE Add CUE/TOC support to track2cd
  It should be possible to burn a selection of tracks, or a disc image,
  from a cuesheet with all its indexes/ISRC/catalog data intact
  by passing --cue to track2cd.
* DONE Unify CUE/TOC support
  Cuesheets and cdrdao TOC files are largely interchangeable.
  They both feature a listing of track offsets and, optionally,
  CD-TEXT data, ISRCs and so on.
  These formats should be unified such that any program will
  handle them both automatically.
- [X] tracksplit
- [X] trackcat
- [X] tracktag
** DONE Update docs to mention CUE/TOC interchangeability
- [X] tracksplit
- [X] trackcat
- [X] tracktag
** DONE Support cuesheet from FlacMetaData directly
   Since we're parsing CUE/TOC files anyway, this data can be used
   to build FLAC CUESHEET blocks directly instead of punting
   this task to metaflac.
** DONE Add unit tests for TOC/CUE files, as well as embedded FLAC cuesheets
* DONE Update copyright text for 2009
* DONE Preserve metadata when using trackcat
  Any fields shared by all tracks should be merged into metadata
  for the newly combined track.
* DONE Don't route data though WAVE files unless necessary
  Currently, track2track routes through WAVE if both ends happen to
  support foreign RIFF chunks, whether the files have such chunks or not.
  This behavior needs to be modified such that only source files
  which actually have foreign chunks, and a target format that supports them,
  results in a pass through RIFF WAVE.
* DONE Convert editxmcd to PyGTK
  Although the dialog(1)-based version works in terminals and is curses-based,
  it's extremely hokey, error-prone and doesn't support any cut & paste.
  This needs to be reimplemented in PyGTK (since coverview already uses it)
  and made into a stable app someone would want to use.
** DONE Update XMCD support
   The current handling of XMCD files treats them only as very primative
   AlbumMetaData implementations. This must be updated into something
   round-trippable if editxmcd is to be modernized.
*** DONE Add XMCD unit tests
*** DONE Update XMCD API documentation
* DONE Require Python 2.5
  Since Python 2.4 is in bugfix-only mode and barely supported,
  it's best to move the minimum version to Python 2.5 or better
  (which has already been superceded by Python 2.6).
  This reduces the amount of Python versions to test on
  and allows the use of more modern Python features which
  makes the code less clunky.
** TODO Update documentation to mention Python 2.5 requirement.
* DONE Expand WavPack's APEv2 tag coverage
  WavPack's official specification defines APEv2 tags such as
  "Cuesheet" and "Cover Art" which the APEv2 standard does not.
  It would be helpful to make WavPack's APEv2 tags a superset of regular APEv2.
** DONE Add image support to WavePackAPEv2
** DONE Add cuesheet support to WavePackAPEv2
* DONE Build unified cuesheet interface
  Once both FLAC and WavPack support embedded cuesheets,
  there will need to be a unified interface to support them.
  I expect this will be a simple pair of get_cuesheet/set_cuesheet
  methods, probably attached to the AudioFiles themselves
  rather than to MetaData objects.
** DONE Alter FLAC-specific cuesheet documentation to be more general
** DONE Ensure cuesheets are transferred properly when transcoding
** DONE Update trackcat to use the interface
** DONE Update tracksplit to use the interface
** DONE Update track2cd to use the interface
** DONE Document cuesheet interface
** DONE Add unit tests for embedded cuesheets across all formats
** DONE Add cuesheet import option to tracktag
   This can also use the --cue flag,
   for consistency with other image-handling programs like tracksplit.
   If given with a single, album-length track, --cue will import a cuesheet.
   If given with multiple tracks or a single track that's too short,
   --cue will function like --xmcd and act as a metadata source.
** DONE Update track2xmcd to support getting an XMCD file from CD image
* DONE Convert to Muspack SV8
  Now that Musepack SV8 is finalized, it should be the new default.
  The old SV7 command-line tools aren't well supported and don't
  seem to work outside of x86 platforms.
  SV7 streams are, in theory, backwards compatible so switching
  shouldn't be a problem.
* DONE Update coverview to look more standard
  It's currently a haphazard assortment of widgets
  rather than anything like a proper GTK app.
  It should be tweaked to look better.
* DONE Improve transcoding robustness
  Just about all of the to_pcm() and from_pcm() methods expect
  that their subprocess calls will work as expected.
  Though rare in practice, these need to be checked in case
  the child processes fail for any reason.
** DONE Check for invalid input/output files/permissions errors
   If an output file can't be read/written to for some reason
   (invalid permissions, etc.) generate a proper error message
   instead of throwing ugly IOExceptions or confusing errors.
- [X] cd2track
- [X] cd2xmcd
- [X] coverdump
- [X] editxmcd
- [X] record2track
- [X] track2cd
- [X] track2track
- [X] track2xmcd
- [X] trackcat
- [X] trackcmp
- [X] trackinfo
- [X] tracklength
- [X] tracklint
- [X] trackplay
- [X] trackrename
- [X] tracksplit
- [X] tracktag
* DONE Make text output consistent
  Currently, command-line programs generate output using a
  selection of scattered print statements - often accompanied by
  if blocks when verbosity is indicated - and haphazardly
  filtered through unicode.
  This should be replaced by a unified message system similar
  to Python's built-in logging module which can abstract away
  these difficulties.
** DONE Convert tty output to gettext-based strings
   This will not only make output messages more consistent across the tools,
   but will also allow for foreign language translations in the future.
- [X] cd2track
- [X] cd2xmcd
- [X] coverdump
- [X] record2track
- [X] track2cd
- [X] track2track
- [X] track2xmcd
- [X] trackcat
- [X] trackcmp
- [X] trackinfo
- [X] tracklength
- [X] tracklint
- [X] trackplay
- [X] trackrename
- [X] tracksplit
- [X] tracktag
*** DONE Convert output from audiotools module to gettext-based strings
- [X] __aiff__.py
- [X] __ape__.py
- [X] __au__.py
- [X] cue.py
- [X] __flac__.py
- [X] __freedb__.py
- [X] __id3__.py
- [X] __id3v1__.py
- [X] __image__.py
- [X] __init__.py
- [X] __m4a__.py
- [X] __mp3__.py
- [X] __musepack__.py
- [X] __speex__.py
- [X] toc.py
- [X] __vorbiscomment__.py
- [X] __vorbis__.py
- [X] __wavpack__.py
- [X] __wav__.py
** DONE Add unit tests for tty output
   All programs which generate output should be unit tested
   so that all code paths are assured of printing the messages they're
   supposed to print, at the streams they're supposed to print on,
   and in the proper encoding settings.
- [X] coverdump
- [X] track2track
- [X] track2xmcd
- [X] trackcat
- [X] trackcmp
- [X] trackinfo
- [X] tracklength
- [X] tracklint
- [X] trackrename
- [X] tracksplit
- [X] tracktag
** DONE Convert --help output to gettext-based strings
** DONE Convert GUI programs to gettext-based strings
- [X] coverview
- [X] editxmcd
** DONE Convert "Usage" output to gettext-based strings
* DONE Update tracksplit's man page
  It now supports more of track2track's options
* DONE Support total tracks/total albums metadata fields
** DONE Add support for fields in the metadata tags
- [X] Add support in Vorbis Comments
- [X] Add support in ID3v2
- [X] Add support in M4A
- [X] Add support in APEv2
** DONE Add support in utilities
- [X] Add support in tracktag
- [X] Add support in cd2track
- [X] Add support in tracksplit
- [X] Add support in trackcat
** DONE Add unit tests
** DONE Add fields to --format output
** DONE Update man pages with fields information
* DONE Integrate better MetaData merging
  There's a few areas in which MetaData from multiple sources must
  be merged in an intelligent manner,
  such as where tracksplit takes a source track an XMCD file.
  Now that a preliminary MetaData.merge() classmethod is in place,
  this process must be integrated consistently.
- [X] track2track
- [X] trackrename
- [X] tracksplit
- [X] tracktag
** DONE Add unit tests for MetaData merging process
- [X] track2track
- [X] trackrename
- [X] tracksplit
- [X] tracktag
* DONE Improve M4A metadata handling
** DONE Make M4A metadata updating less destructive
  Like FLAC, not all fields need to be wiped out when overwriting
  old metadata with new.
** DONE Add more M4A-specific unit tests
* DONE Add more system information to audiotools-config
  All BIN-referenced binaries should be accounted for.
  Thumbnailing status and requirements should be shown.
* DONE Add cdinfo utility
  Analagous to trackinfo, but for an inserted CD.
  This would be a better location for cd2xmcd's "-i" option.
** DONE Add cdinfo man page
** DONE Link cdinfo man page to other utility man pages
* DONE Add manual page for audiotools.cfg
  It'll be easier to check what the options are from a man page
  rather than having to check the website or PDF doc.
* DONE Convert vorbiscomment dependency to Python
  This would remove the last app-based MetaData-setting utility
  and may pave the way for adding cover art to Ogg Vorbis
  (assuming I can find the standard for a secondary stream of image data)
* DONE Add metadata deletion capability
  It would be helpful to have the low-level capability of deleting
  either part of a MetaData tag or the entire tag altogether.
  For example, deleting the "track_name" field would delete
  a Vorbis comment's "TITLE" field.
  Or, deleting the MetaData from MP3 would remove all the ID3v2/ID3v1 tags.
** DONE Add delattr to ID3v1
* DONE Integrate pyconstruct as a submodule
* DONE Add undo capability to editxmcd
* DONE Add --cue option to track2xmcd
  One should be able to pull metadata from CD images
  without having to embed the cuesheet.
** DONE Add unit tests for track2xmcd's --cue option
** DONE Update man page
* DONE Group --help output more intelligently
  For tools with a large number of options (such as track2track or tracktag)
  the --help output is particularly jumbled.
  Use more of optparse's features to make this output clearer.
- [X] cd2track
- [X] cd2xmcd
- [X] track2track
- [X] track2xmcd
- [X] tracksplit
- [X] tracktag
* DONE Check for FLAC metadata chunk overflow
  Although APEv2 and ID3 tags support very large objects (hundreds of MB),
  FLAC metadata chunks have a maxmimum of about 16MB per chunk,
  which may be hit accidentally.
* DONE Fix or replace Python's built-in aifc module
  The current implementation suffers from bugs.
** DONE Document AIFF better
* DONE Add MusicBrainz support
  It would be helpful to have external metadata support beyond FreeDB,
  since FreeDB is very primitive.
** DONE Ensure that MusicBrainz is interchangeable with FreeDB/XMCD
*** DONE Unify track2xmcd/track2mb, cd2xmcd/cd2mb
    Based on preliminary testing, MusicBrainz's output is better than FreeDB's
    but its album coverage is not as broad.
    In addition, nobody wants to run their albums through two separate tools
    in order to extract metadata for tagging. The best solution is
    for tools to try both and output the one that's most complete.
*** DONE Extend editxmcd to MusicBrainz XML
    Although editxmcd was originally designed specifically for XMCD files
    and MusicBrainz's XML format differs radically, no one should have to
    know whether an album metadata file is one or the other.
    Therefore, editxmcd should be extended with additional fields
    to handle XML backend data if necessary.
*** DONE Handle multiple Release entries with single Disc ID
*** DONE Allow MusicBrainz XML output for new editxmcd files
    FreeDB output should also be an option, however.
** DONE Add MusicBrainz protocol/format documentation
** DONE Add MusicBrainz-specific unit tests
- [X] track2track
- [X] track2xmcd
- [X] trackrename
- [X] tracksplit
- [X] tracktag
** DONE Update --help text to indicate MusicBrainz compatibility
- [X] cd2xmcd
- [X] editxmcd
- [X] track2track
- [X] track2xmcd
- [X] trackrename
- [X] tracksplit
- [X] tracktag
** DONE Update man pages to indiciate MusicBrainz compatibility
- [X] cd2xmcd
- [X] editxmcd
- [X] track2track
- [X] track2xmcd
- [X] trackrename
- [X] tracksplit
- [X] tracktag
** DONE Update documentation with MusicBrainz config file fields
** DONE Ensure missing XML fields are handled correctly
   The MusicBrainz XML spec allows most fields to be missing altogether
   (such as <title>). editxmcd should add these fields in the proper place
   if necessary.
*** DONE Add unit tests for improperly reordered XML fields
* TODO Ensure non-image cuesheets are handled properly
  There are 4 different types of cuesheets,
  1 single file type and 3 different multiple file variants.
  We should be able to translate between them if necessary, and if possible.
* TODO Replace magic numbers with named constants
  There's still a few instances of magic numbers in use,
  in the __flac__.py module, for instance.
* TODO Add support for genre tag?
  I'm not a big fan of the genre tag.
  Unlike track number, album name, ISRC, etc. in which a value
  can be reliably determined from the source material (e.g. back of the CD),
  genre is akin to a "rating" tag. Its value varies from person to person
  and this makes it less valuable for archival purposes.
 
  In addition, the genre tag itself is implemented in incompatible ways.
  APEv2 uses a chunk of text, ID3v1 uses an integer representing one
  of many designated genre labels, ID3v2 uses a mix of genre byte
  and/or text string, and so on.
 
  That said, the genre field shows up in a lot of players.
  So, some grudging support for it would probably be appreciated.
* TODO More graceful handling of broken files
  A lot of the track handlers assume that once the start of the file is good,
  the rest of it is following the spec. This is not always the case.
  There needs to be sanity checks such that if a file is wildly wrong,
  sensible errors result rather than throwing an ugly pyconstruct exception.
* TODO Add more examples
  A lot of handy new features aren't documented with examples and walkthroughs.
  Examples to add include:
- [X] a full multi-CD example, detailing the use of --album-number
- [X] an image embedding walkthrough
- [ ] examples of how -d,--format,-o work together for different results
- [X] a CD image creation, splitting, burning example involving TOC/CUE files
- [X] an XMCD walkthrough with fetching, editing and tagging
* TODO Add support for System->cdrom_offset
  This will automatically apply offset samples when reading CDs
  so that rips will have the appropate amount of null samples.
** DONE Add offset support when ripping
   Automatically apply the configfile's cdrom_offset value to tracks
   during reading.
** TODO Add offset support when burning?
   cd2track and track2cd should round-trip properly
   If cd2track applies a sample offset when reading, does track2cd
   need to apply that same offset when writing?
   One would presume a drive's read offset and write offset are the same,
   but that may not be correct.
* TODO Add better progress indicator to coverview
  Perhaps performing cover opening in a separate thread
  would make the interface more responsive when opening tracks
  containing many large images.
* TODO Add general-purpose track conversion short-circuiting
  Certain type conversions should pass through specialized routines
  rather than be piped through PCM conversion.
  This is a generalization of the messy to/from_wave() situation
  and allows for smarter, lossless conversion in certain situations.
  For example, going from FLAC to Ogg FLAC should theoretically involve
  wrapping up FLAC frames rather than re-encoding.
  Or going from AAC to M4A should involve simple wrapper manipulation.
* TODO Convert TOC and CUE handling to proper grammars
  Although the current ad-hoc method works in most cases,
  it would be better to use a more formal method to parse these files
  which can be proven to handle all legal files.
  I expect this will require PLY or some similar lexx/yacc mechanism
  which I'll bundle to avoid adding any extra depencies.
* TODO Add Python3 support
  It would be useful to have a build which functions properly on
  Python3 when run through "2to3".
  This requires updating C code and patching any bugs in the unit tests.
** TODO Patch Construct for Python3
   Since pyconstruct hasn't been updated in almost 2 years,
   I'll likely have to update it myself to ensure it'll run on Python3.
* TODO Add numpy support
  All PCM parsing deals with arrays of numbers
  (such as FrameList, the resampling routines, and so forth)
  which are more efficiently handled by numpy.
  But if numpy is not installed, we should fall back on standard arrays.