cdparanoia
Você pode obter uma lista de faixas de áudio de CD usando a ferramenta de linha de comando, cdparanoia
.
$ cdparanoia -sQ
Exemplo
$ cdparanoia -sQ
cdparanoia III release 10.2 (September 11, 2008)
Table of contents (audio tracks only):
track length begin copy pre ch
===========================================================
1. 19497 [04:19.72] 0 [00:00.00] OK no 2
2. 20253 [04:30.03] 19497 [04:19.72] OK no 2
3. 29250 [06:30.00] 39750 [08:50.00] OK no 2
4. 34263 [07:36.63] 69000 [15:20.00] OK no 2
5. 28804 [06:24.04] 103263 [22:56.63] OK no 2
6. 21582 [04:47.57] 132067 [29:20.67] OK no 2
7. 33270 [07:23.45] 153649 [34:08.49] OK no 2
8. 29919 [06:38.69] 186919 [41:32.19] OK no 2
9. 29564 [06:34.14] 216838 [48:11.13] OK no 2
10. 18993 [04:13.18] 246402 [54:45.27] OK no 2
11. 35368 [07:51.43] 265395 [58:58.45] OK no 2
TOTAL 300763 [66:50.13] (audio only)
Você pode contar o número de linhas que contêm a string "OK" ou que começam com um número, por exemplo, 1.
.
$ cdparanoia -sQ |& grep OK | wc -l
11
-or-
$ cdparanoia -sQ |& grep -P "^\s+\d+\." | wc -l
11
cdda2wav
Você também pode usar essa ferramenta de linha de comando, cdda2wav
.
$ cdda2wav -J -D /dev/cdrom
Exemplo
$ cdda2wav -J -D /dev/cdrom
Type: ROM, Vendor 'Optiarc ' Model 'DVD RW AD-7930H ' Revision '1.D1' MMC+CDDA
569344 bytes buffer memory requested, 4 buffers, 55 sectors
#icedax version 1.1.11, real time sched., soundcard, libparanoia support
AUDIOtrack pre-emphasis copy-permitted tracktype channels
1-11 no yes audio 2
Table of Contents: total tracks:11, (total time 66:50.13)
1.( 4:19.72), 2.( 4:30.03), 3.( 6:30.00), 4.( 7:36.63), 5.( 6:24.04),
6.( 4:47.57), 7.( 7:23.45), 8.( 6:38.69), 9.( 6:34.14), 10.( 4:13.18),
11.( 7:51.43)
Table of Contents: starting sectors
1.( 0), 2.( 19497), 3.( 39750), 4.( 69000), 5.( 103263),
6.( 132067), 7.( 153649), 8.( 186919), 9.( 216838), 10.( 246402),
11.( 265395), lead-out( 300763)
CDINDEX discid: gteZIAUq3lgZlEmNg_HnbWL6cJc-
CDDB discid: 0x950faa0b
CD-Text: detected
CD-Extra: not detected
Album title: 'Hour of the Olympics' [from Mary Pope Osborne]
Track 1: 'Viking Ships at Sunrise Ch 3'
Track 2: 'Viking Ships at Sunrise Ch 4'
Track 3: 'Viking Ships at Sunrise Ch 5-6'
Track 4: 'Viking Ships at Sunrise Ch 7-8'
Track 5: 'Viking Ships at Sunrise Ch 9-10'
Track 6: 'Hour of the Olympics Ch 1'
Track 7: 'Hour of the Olympics Ch 2-3'
Track 8: 'Hour of the Olympics Ch 4-5'
Track 9: 'Hour of the Olympics Ch 6-8'
Track 10: 'Hour of the Olympics Ch 9'
Track 11: 'Hour of the Olympics Ch 10'
No media catalog number present.
scanning for ISRCs: 11 ...
index scan: 11...
Novamente, você pode solicitar a ajuda de grep
para obter o número de faixas:
# traditional way to parse output
$ cdda2wav -J -D /dev/cdrom |& grep index | sed 's#.*: \(.*\)...##g'
11
# use grep's PCRE capability
$ cdda2wav -J -D /dev/cdrom |& grep -Po '(?<=index scan: )\d+' | tail -1
11