Skip to content

Commit

Permalink
replace cdrdao.py with much simpler version (#52)
Browse files Browse the repository at this point in the history
* replace cdrdao.py with much simpler version
* more pythonic syntax for cdrdao.read_toc(fast_toc=) switching
* fix silly typo
  • Loading branch information
RecursiveForest authored and JoeLametta committed Oct 22, 2016
1 parent 8721ba1 commit d7f8557
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 565 deletions.
21 changes: 4 additions & 17 deletions morituri/common/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,14 @@ def function(r, t):

ptoc = cache.Persister(toc_pickle or None)
if not ptoc.object:
tries = 0
while True:
tries += 1
t = cdrdao.ReadTOCTask(device=device)
try:
function(runner, t)
break
except:
if tries > 3:
raise
self.debug('failed to read TOC after %d tries, retrying' % tries)

version = t.tasks[1].parser.version
from pkg_resources import parse_version as V
# we've built a cdrdao 1.2.3rc2 modified package with the patch
if V(version) < V('1.2.3rc2p1'):
version = cdrdao.getCDRDAOVersion()
if V(version) < V('1.2.3rc2'):
self.stdout.write('Warning: cdrdao older than 1.2.3 has a '
'pre-gap length bug.\n'
'See http://sourceforge.net/tracker/?func=detail'
'&aid=604751&group_id=2171&atid=102171\n')
t = cdrdao.ReadTOCTask(device)
ptoc.persist(t.table)
toc = ptoc.object
assert toc.hasTOC()
Expand Down Expand Up @@ -173,8 +161,7 @@ def getTable(self, runner, cddbdiscid, mbdiscid, device, offset):
self.debug('getTable: cddbdiscid %s, mbdiscid %s not in cache for offset %s, '
'reading table' % (
cddbdiscid, mbdiscid, offset))
t = cdrdao.ReadTableTask(device=device)
runner.run(t)
t = cdrdao.ReadTableTask(device)
itable = t.table
tdict[offset] = itable
ptable.persist(tdict)
Expand Down
Loading

0 comments on commit d7f8557

Please sign in to comment.