switch CDDB implementation to freedb.py from python-audio-tools (#276)

* freedb: Import from python-audio-tools 660ee2c

License: GPL-2.0+

* freedb: Remove unused code and set client name to whipper.

The removed functions depend on other classes of python-audio-tools,
but aren't needed here.

* cddb-py: replace with newer freedb implementation

The last release of cddb-py was 15 years ago. The freedb code taken
from python-audio-tools speaks protocol version 6 (Unicode) and is
compatible to both Python 2 and 3.

* freedb: Don't allow the pedantic CI test to fail
This commit is contained in:
Andreas Oberritter
2018-06-08 16:40:56 +02:00
committed by Joe
parent 84fa7c0944
commit 542e071443
4 changed files with 228 additions and 14 deletions

View File

@@ -31,6 +31,7 @@ import time
from whipper.common import accurip, cache, checksum, common, mbngs, path
from whipper.program import cdrdao, cdparanoia
from whipper.image import image
from whipper.extern import freedb
from whipper.extern.task import task
import logging
@@ -245,12 +246,10 @@ class Program:
@rtype: str
"""
# FIXME: convert to nonblocking?
import CDDB
try:
code, md = CDDB.query(cddbdiscid)
logger.debug('CDDB query result: %r, %r', code, md)
if code == 200:
return md['title']
md = freedb.perform_lookup(cddbdiscid, 'freedb.freedb.org', 80)
logger.debug('CDDB query result: %r', md)
return [item['DTITLE'] for item in md if 'DTITLE' in item] or None
except IOError as e:
# FIXME: for some reason errno is a str ?