mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 00:14:02 +01:00
Initial python3 changes
Mostly just updating libraries, removing string encoding/decoding, fixing some edge cases. No new functionality was added in this commit.
This commit is contained in:
+13
-13
@@ -13,15 +13,15 @@ PY2 = sys.version_info[0] == 2
|
||||
PY3 = not PY2
|
||||
|
||||
if PY2:
|
||||
from StringIO import StringIO
|
||||
from io import StringIO
|
||||
BytesIO = StringIO
|
||||
from cStringIO import StringIO as cBytesIO
|
||||
from itertools import izip
|
||||
from io import StringIO as cBytesIO
|
||||
|
||||
|
||||
long_ = long
|
||||
integer_types = (int, long)
|
||||
string_types = (str, unicode)
|
||||
text_type = unicode
|
||||
long_ = int
|
||||
integer_types = (int, int)
|
||||
string_types = (str, str)
|
||||
text_type = str
|
||||
|
||||
xrange = xrange
|
||||
cmp = cmp
|
||||
@@ -30,9 +30,9 @@ if PY2:
|
||||
def endswith(text, end):
|
||||
return text.endswith(end)
|
||||
|
||||
iteritems = lambda d: d.iteritems()
|
||||
itervalues = lambda d: d.itervalues()
|
||||
iterkeys = lambda d: d.iterkeys()
|
||||
iteritems = lambda d: iter(d.items())
|
||||
itervalues = lambda d: iter(d.values())
|
||||
iterkeys = lambda d: iter(d.keys())
|
||||
|
||||
iterbytes = lambda b: iter(b)
|
||||
|
||||
@@ -73,9 +73,9 @@ elif PY3:
|
||||
end = end.encode("ascii")
|
||||
return text.endswith(end)
|
||||
|
||||
iteritems = lambda d: iter(d.items())
|
||||
itervalues = lambda d: iter(d.values())
|
||||
iterkeys = lambda d: iter(d.keys())
|
||||
iteritems = lambda d: iter(list(d.items()))
|
||||
itervalues = lambda d: iter(list(d.values()))
|
||||
iterkeys = lambda d: iter(list(d.keys()))
|
||||
|
||||
iterbytes = lambda b: (bytes([v]) for v in b)
|
||||
|
||||
|
||||
+192
-192
@@ -8,197 +8,197 @@
|
||||
"""Constants used by Mutagen."""
|
||||
|
||||
GENRES = [
|
||||
u"Blues",
|
||||
u"Classic Rock",
|
||||
u"Country",
|
||||
u"Dance",
|
||||
u"Disco",
|
||||
u"Funk",
|
||||
u"Grunge",
|
||||
u"Hip-Hop",
|
||||
u"Jazz",
|
||||
u"Metal",
|
||||
u"New Age",
|
||||
u"Oldies",
|
||||
u"Other",
|
||||
u"Pop",
|
||||
u"R&B",
|
||||
u"Rap",
|
||||
u"Reggae",
|
||||
u"Rock",
|
||||
u"Techno",
|
||||
u"Industrial",
|
||||
u"Alternative",
|
||||
u"Ska",
|
||||
u"Death Metal",
|
||||
u"Pranks",
|
||||
u"Soundtrack",
|
||||
u"Euro-Techno",
|
||||
u"Ambient",
|
||||
u"Trip-Hop",
|
||||
u"Vocal",
|
||||
u"Jazz+Funk",
|
||||
u"Fusion",
|
||||
u"Trance",
|
||||
u"Classical",
|
||||
u"Instrumental",
|
||||
u"Acid",
|
||||
u"House",
|
||||
u"Game",
|
||||
u"Sound Clip",
|
||||
u"Gospel",
|
||||
u"Noise",
|
||||
u"Alt. Rock",
|
||||
u"Bass",
|
||||
u"Soul",
|
||||
u"Punk",
|
||||
u"Space",
|
||||
u"Meditative",
|
||||
u"Instrumental Pop",
|
||||
u"Instrumental Rock",
|
||||
u"Ethnic",
|
||||
u"Gothic",
|
||||
u"Darkwave",
|
||||
u"Techno-Industrial",
|
||||
u"Electronic",
|
||||
u"Pop-Folk",
|
||||
u"Eurodance",
|
||||
u"Dream",
|
||||
u"Southern Rock",
|
||||
u"Comedy",
|
||||
u"Cult",
|
||||
u"Gangsta Rap",
|
||||
u"Top 40",
|
||||
u"Christian Rap",
|
||||
u"Pop/Funk",
|
||||
u"Jungle",
|
||||
u"Native American",
|
||||
u"Cabaret",
|
||||
u"New Wave",
|
||||
u"Psychedelic",
|
||||
u"Rave",
|
||||
u"Showtunes",
|
||||
u"Trailer",
|
||||
u"Lo-Fi",
|
||||
u"Tribal",
|
||||
u"Acid Punk",
|
||||
u"Acid Jazz",
|
||||
u"Polka",
|
||||
u"Retro",
|
||||
u"Musical",
|
||||
u"Rock & Roll",
|
||||
u"Hard Rock",
|
||||
u"Folk",
|
||||
u"Folk-Rock",
|
||||
u"National Folk",
|
||||
u"Swing",
|
||||
u"Fast-Fusion",
|
||||
u"Bebop",
|
||||
u"Latin",
|
||||
u"Revival",
|
||||
u"Celtic",
|
||||
u"Bluegrass",
|
||||
u"Avantgarde",
|
||||
u"Gothic Rock",
|
||||
u"Progressive Rock",
|
||||
u"Psychedelic Rock",
|
||||
u"Symphonic Rock",
|
||||
u"Slow Rock",
|
||||
u"Big Band",
|
||||
u"Chorus",
|
||||
u"Easy Listening",
|
||||
u"Acoustic",
|
||||
u"Humour",
|
||||
u"Speech",
|
||||
u"Chanson",
|
||||
u"Opera",
|
||||
u"Chamber Music",
|
||||
u"Sonata",
|
||||
u"Symphony",
|
||||
u"Booty Bass",
|
||||
u"Primus",
|
||||
u"Porn Groove",
|
||||
u"Satire",
|
||||
u"Slow Jam",
|
||||
u"Club",
|
||||
u"Tango",
|
||||
u"Samba",
|
||||
u"Folklore",
|
||||
u"Ballad",
|
||||
u"Power Ballad",
|
||||
u"Rhythmic Soul",
|
||||
u"Freestyle",
|
||||
u"Duet",
|
||||
u"Punk Rock",
|
||||
u"Drum Solo",
|
||||
u"A Cappella",
|
||||
u"Euro-House",
|
||||
u"Dance Hall",
|
||||
u"Goa",
|
||||
u"Drum & Bass",
|
||||
u"Club-House",
|
||||
u"Hardcore",
|
||||
u"Terror",
|
||||
u"Indie",
|
||||
u"BritPop",
|
||||
u"Afro-Punk",
|
||||
u"Polsk Punk",
|
||||
u"Beat",
|
||||
u"Christian Gangsta Rap",
|
||||
u"Heavy Metal",
|
||||
u"Black Metal",
|
||||
u"Crossover",
|
||||
u"Contemporary Christian",
|
||||
u"Christian Rock",
|
||||
u"Merengue",
|
||||
u"Salsa",
|
||||
u"Thrash Metal",
|
||||
u"Anime",
|
||||
u"JPop",
|
||||
u"Synthpop",
|
||||
u"Abstract",
|
||||
u"Art Rock",
|
||||
u"Baroque",
|
||||
u"Bhangra",
|
||||
u"Big Beat",
|
||||
u"Breakbeat",
|
||||
u"Chillout",
|
||||
u"Downtempo",
|
||||
u"Dub",
|
||||
u"EBM",
|
||||
u"Eclectic",
|
||||
u"Electro",
|
||||
u"Electroclash",
|
||||
u"Emo",
|
||||
u"Experimental",
|
||||
u"Garage",
|
||||
u"Global",
|
||||
u"IDM",
|
||||
u"Illbient",
|
||||
u"Industro-Goth",
|
||||
u"Jam Band",
|
||||
u"Krautrock",
|
||||
u"Leftfield",
|
||||
u"Lounge",
|
||||
u"Math Rock",
|
||||
u"New Romantic",
|
||||
u"Nu-Breakz",
|
||||
u"Post-Punk",
|
||||
u"Post-Rock",
|
||||
u"Psytrance",
|
||||
u"Shoegaze",
|
||||
u"Space Rock",
|
||||
u"Trop Rock",
|
||||
u"World Music",
|
||||
u"Neoclassical",
|
||||
u"Audiobook",
|
||||
u"Audio Theatre",
|
||||
u"Neue Deutsche Welle",
|
||||
u"Podcast",
|
||||
u"Indie Rock",
|
||||
u"G-Funk",
|
||||
u"Dubstep",
|
||||
u"Garage Rock",
|
||||
u"Psybient",
|
||||
"Blues",
|
||||
"Classic Rock",
|
||||
"Country",
|
||||
"Dance",
|
||||
"Disco",
|
||||
"Funk",
|
||||
"Grunge",
|
||||
"Hip-Hop",
|
||||
"Jazz",
|
||||
"Metal",
|
||||
"New Age",
|
||||
"Oldies",
|
||||
"Other",
|
||||
"Pop",
|
||||
"R&B",
|
||||
"Rap",
|
||||
"Reggae",
|
||||
"Rock",
|
||||
"Techno",
|
||||
"Industrial",
|
||||
"Alternative",
|
||||
"Ska",
|
||||
"Death Metal",
|
||||
"Pranks",
|
||||
"Soundtrack",
|
||||
"Euro-Techno",
|
||||
"Ambient",
|
||||
"Trip-Hop",
|
||||
"Vocal",
|
||||
"Jazz+Funk",
|
||||
"Fusion",
|
||||
"Trance",
|
||||
"Classical",
|
||||
"Instrumental",
|
||||
"Acid",
|
||||
"House",
|
||||
"Game",
|
||||
"Sound Clip",
|
||||
"Gospel",
|
||||
"Noise",
|
||||
"Alt. Rock",
|
||||
"Bass",
|
||||
"Soul",
|
||||
"Punk",
|
||||
"Space",
|
||||
"Meditative",
|
||||
"Instrumental Pop",
|
||||
"Instrumental Rock",
|
||||
"Ethnic",
|
||||
"Gothic",
|
||||
"Darkwave",
|
||||
"Techno-Industrial",
|
||||
"Electronic",
|
||||
"Pop-Folk",
|
||||
"Eurodance",
|
||||
"Dream",
|
||||
"Southern Rock",
|
||||
"Comedy",
|
||||
"Cult",
|
||||
"Gangsta Rap",
|
||||
"Top 40",
|
||||
"Christian Rap",
|
||||
"Pop/Funk",
|
||||
"Jungle",
|
||||
"Native American",
|
||||
"Cabaret",
|
||||
"New Wave",
|
||||
"Psychedelic",
|
||||
"Rave",
|
||||
"Showtunes",
|
||||
"Trailer",
|
||||
"Lo-Fi",
|
||||
"Tribal",
|
||||
"Acid Punk",
|
||||
"Acid Jazz",
|
||||
"Polka",
|
||||
"Retro",
|
||||
"Musical",
|
||||
"Rock & Roll",
|
||||
"Hard Rock",
|
||||
"Folk",
|
||||
"Folk-Rock",
|
||||
"National Folk",
|
||||
"Swing",
|
||||
"Fast-Fusion",
|
||||
"Bebop",
|
||||
"Latin",
|
||||
"Revival",
|
||||
"Celtic",
|
||||
"Bluegrass",
|
||||
"Avantgarde",
|
||||
"Gothic Rock",
|
||||
"Progressive Rock",
|
||||
"Psychedelic Rock",
|
||||
"Symphonic Rock",
|
||||
"Slow Rock",
|
||||
"Big Band",
|
||||
"Chorus",
|
||||
"Easy Listening",
|
||||
"Acoustic",
|
||||
"Humour",
|
||||
"Speech",
|
||||
"Chanson",
|
||||
"Opera",
|
||||
"Chamber Music",
|
||||
"Sonata",
|
||||
"Symphony",
|
||||
"Booty Bass",
|
||||
"Primus",
|
||||
"Porn Groove",
|
||||
"Satire",
|
||||
"Slow Jam",
|
||||
"Club",
|
||||
"Tango",
|
||||
"Samba",
|
||||
"Folklore",
|
||||
"Ballad",
|
||||
"Power Ballad",
|
||||
"Rhythmic Soul",
|
||||
"Freestyle",
|
||||
"Duet",
|
||||
"Punk Rock",
|
||||
"Drum Solo",
|
||||
"A Cappella",
|
||||
"Euro-House",
|
||||
"Dance Hall",
|
||||
"Goa",
|
||||
"Drum & Bass",
|
||||
"Club-House",
|
||||
"Hardcore",
|
||||
"Terror",
|
||||
"Indie",
|
||||
"BritPop",
|
||||
"Afro-Punk",
|
||||
"Polsk Punk",
|
||||
"Beat",
|
||||
"Christian Gangsta Rap",
|
||||
"Heavy Metal",
|
||||
"Black Metal",
|
||||
"Crossover",
|
||||
"Contemporary Christian",
|
||||
"Christian Rock",
|
||||
"Merengue",
|
||||
"Salsa",
|
||||
"Thrash Metal",
|
||||
"Anime",
|
||||
"JPop",
|
||||
"Synthpop",
|
||||
"Abstract",
|
||||
"Art Rock",
|
||||
"Baroque",
|
||||
"Bhangra",
|
||||
"Big Beat",
|
||||
"Breakbeat",
|
||||
"Chillout",
|
||||
"Downtempo",
|
||||
"Dub",
|
||||
"EBM",
|
||||
"Eclectic",
|
||||
"Electro",
|
||||
"Electroclash",
|
||||
"Emo",
|
||||
"Experimental",
|
||||
"Garage",
|
||||
"Global",
|
||||
"IDM",
|
||||
"Illbient",
|
||||
"Industro-Goth",
|
||||
"Jam Band",
|
||||
"Krautrock",
|
||||
"Leftfield",
|
||||
"Lounge",
|
||||
"Math Rock",
|
||||
"New Romantic",
|
||||
"Nu-Breakz",
|
||||
"Post-Punk",
|
||||
"Post-Rock",
|
||||
"Psytrance",
|
||||
"Shoegaze",
|
||||
"Space Rock",
|
||||
"Trop Rock",
|
||||
"World Music",
|
||||
"Neoclassical",
|
||||
"Audiobook",
|
||||
"Audio Theatre",
|
||||
"Neue Deutsche Welle",
|
||||
"Podcast",
|
||||
"Indie Rock",
|
||||
"G-Funk",
|
||||
"Dubstep",
|
||||
"Garage Rock",
|
||||
"Psybient",
|
||||
]
|
||||
"""The ID3v1 genre list."""
|
||||
|
||||
@@ -94,7 +94,7 @@ class FileType(DictMixin):
|
||||
if self.tags is None:
|
||||
return []
|
||||
else:
|
||||
return self.tags.keys()
|
||||
return list(self.tags.keys())
|
||||
|
||||
@loadfile(writable=True)
|
||||
def delete(self, filething):
|
||||
@@ -286,7 +286,7 @@ def File(filething, options=None, easy=False):
|
||||
results = [(Kind.score(filething.name, fileobj, header), Kind.__name__)
|
||||
for Kind in options]
|
||||
|
||||
results = list(izip(results, options))
|
||||
results = list(zip(results, options))
|
||||
results.sort()
|
||||
(score, name), Kind = results[-1]
|
||||
if score > 0:
|
||||
|
||||
@@ -20,20 +20,21 @@ PY3 = not PY2
|
||||
|
||||
|
||||
if PY2:
|
||||
from urlparse import urlparse, urlunparse
|
||||
from urllib.parse import urlparse, urlunparse
|
||||
urlparse, urlunparse
|
||||
from urllib import pathname2url, url2pathname, quote, unquote
|
||||
from urllib.request import pathname2url, url2pathname
|
||||
from urllib.parse import quote, unquote
|
||||
pathname2url, url2pathname, quote, unquote
|
||||
|
||||
from StringIO import StringIO
|
||||
from io import StringIO
|
||||
BytesIO = StringIO
|
||||
from io import StringIO as TextIO
|
||||
TextIO
|
||||
|
||||
string_types = (str, unicode)
|
||||
text_type = unicode
|
||||
string_types = (str, str)
|
||||
text_type = str
|
||||
|
||||
iteritems = lambda d: d.iteritems()
|
||||
iteritems = lambda d: iter(d.items())
|
||||
elif PY3:
|
||||
from urllib.parse import urlparse, quote, unquote, urlunparse
|
||||
urlparse, quote, unquote, urlunparse
|
||||
@@ -49,4 +50,4 @@ elif PY3:
|
||||
string_types = (str,)
|
||||
text_type = str
|
||||
|
||||
iteritems = lambda d: iter(d.items())
|
||||
iteritems = lambda d: iter(list(d.items()))
|
||||
|
||||
@@ -86,23 +86,23 @@ def read_windows_environ():
|
||||
res = ctypes.cast(res, ctypes.POINTER(ctypes.c_wchar))
|
||||
|
||||
done = []
|
||||
current = u""
|
||||
current = ""
|
||||
i = 0
|
||||
while 1:
|
||||
c = res[i]
|
||||
i += 1
|
||||
if c == u"\x00":
|
||||
if c == "\x00":
|
||||
if not current:
|
||||
break
|
||||
done.append(current)
|
||||
current = u""
|
||||
current = ""
|
||||
continue
|
||||
current += c
|
||||
|
||||
dict_ = {}
|
||||
for entry in done:
|
||||
try:
|
||||
key, value = entry.split(u"=", 1)
|
||||
key, value = entry.split("=", 1)
|
||||
except ValueError:
|
||||
continue
|
||||
key = _norm_key(key)
|
||||
|
||||
@@ -59,7 +59,7 @@ def _codec_fails_on_encode_surrogates(codec, _cache={}):
|
||||
return _cache[codec]
|
||||
except KeyError:
|
||||
try:
|
||||
u"\uD800\uDC01".encode(codec)
|
||||
"\uD800\uDC01".encode(codec)
|
||||
except UnicodeEncodeError:
|
||||
_cache[codec] = True
|
||||
else:
|
||||
@@ -76,7 +76,7 @@ def _codec_can_decode_with_surrogatepass(codec, _cache={}):
|
||||
return _cache[codec]
|
||||
except KeyError:
|
||||
try:
|
||||
u"\ud83d".encode(
|
||||
"\ud83d".encode(
|
||||
codec, _surrogatepass).decode(codec, _surrogatepass)
|
||||
except UnicodeDecodeError:
|
||||
_cache[codec] = False
|
||||
@@ -173,14 +173,14 @@ def _fsnative(text):
|
||||
path = text.encode("utf-8", _surrogatepass)
|
||||
|
||||
if b"\x00" in path:
|
||||
path = path.replace(b"\x00", fsn2bytes(_fsnative(u"\uFFFD"), None))
|
||||
path = path.replace(b"\x00", fsn2bytes(_fsnative("\uFFFD"), None))
|
||||
|
||||
if PY3:
|
||||
return path.decode(_encoding, "surrogateescape")
|
||||
return path
|
||||
else:
|
||||
if u"\x00" in text:
|
||||
text = text.replace(u"\x00", u"\uFFFD")
|
||||
if "\x00" in text:
|
||||
text = text.replace("\x00", "\uFFFD")
|
||||
return text
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ def _create_fsnative(type_):
|
||||
the `str` only contains ASCII and no NULL.
|
||||
"""
|
||||
|
||||
def __new__(cls, text=u""):
|
||||
def __new__(cls, text=""):
|
||||
return _fsnative(text)
|
||||
|
||||
new_type = meta("fsnative", (object,), dict(impl.__dict__))
|
||||
@@ -259,7 +259,7 @@ def _typecheck_fsnative(path):
|
||||
return False
|
||||
|
||||
if PY3 or is_win:
|
||||
if u"\x00" in path:
|
||||
if "\x00" in path:
|
||||
return False
|
||||
|
||||
if is_unix and not _is_unicode_encoding:
|
||||
@@ -309,7 +309,7 @@ def _fsn2native(path):
|
||||
if b"\x00" in path:
|
||||
raise TypeError("fsnative can't contain nulls")
|
||||
else:
|
||||
if u"\x00" in path:
|
||||
if "\x00" in path:
|
||||
raise TypeError("fsnative can't contain nulls")
|
||||
|
||||
return path
|
||||
@@ -370,7 +370,7 @@ def path2fsn(path):
|
||||
if b"\x00" in data:
|
||||
raise ValueError("embedded null")
|
||||
else:
|
||||
if u"\x00" in path:
|
||||
if "\x00" in path:
|
||||
raise ValueError("embedded null")
|
||||
|
||||
if not isinstance(path, fsnative_type):
|
||||
@@ -495,7 +495,7 @@ def bytes2fsn(data, encoding):
|
||||
path = _bytes2winpath(data, encoding)
|
||||
except LookupError:
|
||||
raise ValueError("invalid encoding %r" % encoding)
|
||||
if u"\x00" in path:
|
||||
if "\x00" in path:
|
||||
raise ValueError("contains nulls")
|
||||
return path
|
||||
else:
|
||||
@@ -548,7 +548,7 @@ def uri2fsn(uri):
|
||||
path = "\\\\" + path
|
||||
if PY2:
|
||||
path = path.decode("utf-8")
|
||||
if u"\x00" in path:
|
||||
if "\x00" in path:
|
||||
raise ValueError("embedded null")
|
||||
return path
|
||||
else:
|
||||
@@ -607,4 +607,4 @@ def fsn2uri(path):
|
||||
return _quote_path(uri.encode("utf-8", _surrogatepass))
|
||||
|
||||
else:
|
||||
return u"file://" + _quote_path(path)
|
||||
return "file://" + _quote_path(path)
|
||||
|
||||
@@ -155,7 +155,7 @@ def _print_windows(objects, sep, end, file, flush):
|
||||
if not isinstance(end, text_type):
|
||||
raise TypeError
|
||||
|
||||
if end == u"\n":
|
||||
if end == "\n":
|
||||
end = os.linesep
|
||||
|
||||
text = sep.join(parts) + end
|
||||
@@ -225,7 +225,7 @@ def _readline_windows():
|
||||
buf = ctypes.create_string_buffer(buf_size * ctypes.sizeof(winapi.WCHAR))
|
||||
read = winapi.DWORD()
|
||||
|
||||
text = u""
|
||||
text = ""
|
||||
while True:
|
||||
if winapi.ReadConsoleW(
|
||||
h, buf, buf_size, ctypes.byref(read), None) == 0:
|
||||
@@ -234,7 +234,7 @@ def _readline_windows():
|
||||
raise ctypes.WinError()
|
||||
data = buf[:read.value * ctypes.sizeof(winapi.WCHAR)]
|
||||
text += data.decode("utf-16-le", _surrogatepass)
|
||||
if text.endswith(u"\r\n"):
|
||||
if text.endswith("\r\n"):
|
||||
return text[:-2]
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ def _decode_codepage(codepage, data):
|
||||
assert isinstance(data, bytes)
|
||||
|
||||
if not data:
|
||||
return u""
|
||||
return ""
|
||||
|
||||
# get the required buffer length first
|
||||
length = winapi.MultiByteToWideChar(codepage, 0, data, len(data), None, 0)
|
||||
|
||||
@@ -38,7 +38,7 @@ def getcwd():
|
||||
"""
|
||||
|
||||
if is_win and PY2:
|
||||
return os.getcwdu()
|
||||
return os.getcwd()
|
||||
return os.getcwd()
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ def ansi_parse(code):
|
||||
return code[-1:], tuple([int(v or "0") for v in code[2:-1].split(";")])
|
||||
|
||||
|
||||
def ansi_split(text, _re=re.compile(u"(\x1b\[(\d*;?)*\S)")):
|
||||
def ansi_split(text, _re=re.compile("(\x1b\[(\d*;?)*\S)")):
|
||||
"""Yields (is_ansi, text)"""
|
||||
|
||||
for part in _re.split(text):
|
||||
|
||||
@@ -52,14 +52,14 @@ def copy(src, dst, merge, write_v1=True, excluded_tags=None, verbose=False):
|
||||
try:
|
||||
id3 = mutagen.id3.ID3(src, translate=False)
|
||||
except mutagen.id3.ID3NoHeaderError:
|
||||
print_(u"No ID3 header found in ", src, file=sys.stderr)
|
||||
print_("No ID3 header found in ", src, file=sys.stderr)
|
||||
return 1
|
||||
except Exception as err:
|
||||
print_(str(err), file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if verbose:
|
||||
print_(u"File", src, u"contains:", file=sys.stderr)
|
||||
print_("File", src, "contains:", file=sys.stderr)
|
||||
print_(id3.pprint(), file=sys.stderr)
|
||||
|
||||
for tag in excluded_tags:
|
||||
@@ -75,7 +75,7 @@ def copy(src, dst, merge, write_v1=True, excluded_tags=None, verbose=False):
|
||||
print_(str(err), file=sys.stderr)
|
||||
return 1
|
||||
else:
|
||||
for frame in id3.values():
|
||||
for frame in list(id3.values()):
|
||||
target.add(frame)
|
||||
|
||||
id3 = target
|
||||
@@ -91,12 +91,12 @@ def copy(src, dst, merge, write_v1=True, excluded_tags=None, verbose=False):
|
||||
try:
|
||||
id3.save(dst, v1=(2 if write_v1 else 0), v2_version=v2_version)
|
||||
except Exception as err:
|
||||
print_(u"Error saving", dst, u":\n%s" % text_type(err),
|
||||
print_("Error saving", dst, ":\n%s" % text_type(err),
|
||||
file=sys.stderr)
|
||||
return 1
|
||||
else:
|
||||
if verbose:
|
||||
print_(u"Successfully saved", dst, file=sys.stderr)
|
||||
print_("Successfully saved", dst, file=sys.stderr)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -120,12 +120,12 @@ def main(argv):
|
||||
(src, dst) = args
|
||||
|
||||
if not os.path.isfile(src):
|
||||
print_(u"File not found:", src, file=sys.stderr)
|
||||
print_("File not found:", src, file=sys.stderr)
|
||||
parser.print_help(file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if not os.path.isfile(dst):
|
||||
printerr(u"File not found:", dst, file=sys.stderr)
|
||||
printerr("File not found:", dst, file=sys.stderr)
|
||||
parser.print_help(file=sys.stderr)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ def update(options, filenames):
|
||||
for filename in filenames:
|
||||
with _sig.block():
|
||||
if verbose != "quiet":
|
||||
print_(u"Updating", filename)
|
||||
print_("Updating", filename)
|
||||
|
||||
if has_id3v1(filename) and not noupdate and force_v1:
|
||||
mutagen.id3.delete(filename, False, True)
|
||||
@@ -84,13 +84,13 @@ def update(options, filenames):
|
||||
id3 = mutagen.id3.ID3(filename)
|
||||
except mutagen.id3.ID3NoHeaderError:
|
||||
if verbose != "quiet":
|
||||
print_(u"No ID3 header found; skipping...")
|
||||
print_("No ID3 header found; skipping...")
|
||||
continue
|
||||
except Exception as err:
|
||||
print_(text_type(err), file=sys.stderr)
|
||||
continue
|
||||
|
||||
for tag in filter(lambda t: t.startswith(("T", "COMM")), id3):
|
||||
for tag in [t for t in id3 if t.startswith(("T", "COMM"))]:
|
||||
frame = id3[tag]
|
||||
if isinstance(frame, mutagen.id3.TimeStampTextFrame):
|
||||
# non-unicode fields
|
||||
@@ -105,7 +105,7 @@ def update(options, filenames):
|
||||
continue
|
||||
else:
|
||||
frame.text = text
|
||||
if not text or min(map(isascii, text)):
|
||||
if not text or min(list(map(isascii, text))):
|
||||
frame.encoding = 3
|
||||
else:
|
||||
frame.encoding = 1
|
||||
@@ -154,9 +154,9 @@ def main(argv):
|
||||
|
||||
for i, arg in enumerate(argv):
|
||||
if arg == "-v1":
|
||||
argv[i] = fsnative(u"--force-v1")
|
||||
argv[i] = fsnative("--force-v1")
|
||||
elif arg == "-removev1":
|
||||
argv[i] = fsnative(u"--remove-v1")
|
||||
argv[i] = fsnative("--remove-v1")
|
||||
|
||||
(options, args) = parser.parse_args(argv[1:])
|
||||
|
||||
|
||||
@@ -55,23 +55,23 @@ Any editing operation will cause the ID3 tag to be upgraded to ID3v2.4.
|
||||
|
||||
|
||||
def list_frames(option, opt, value, parser):
|
||||
items = mutagen.id3.Frames.items()
|
||||
items = list(mutagen.id3.Frames.items())
|
||||
for name, frame in sorted(items):
|
||||
print_(u" --%s %s" % (name, frame.__doc__.split("\n")[0]))
|
||||
print_(" --%s %s" % (name, frame.__doc__.split("\n")[0]))
|
||||
raise SystemExit
|
||||
|
||||
|
||||
def list_frames_2_2(option, opt, value, parser):
|
||||
items = mutagen.id3.Frames_2_2.items()
|
||||
items = list(mutagen.id3.Frames_2_2.items())
|
||||
items.sort()
|
||||
for name, frame in items:
|
||||
print_(u" --%s %s" % (name, frame.__doc__.split("\n")[0]))
|
||||
print_(" --%s %s" % (name, frame.__doc__.split("\n")[0]))
|
||||
raise SystemExit
|
||||
|
||||
|
||||
def list_genres(option, opt, value, parser):
|
||||
for i, genre in enumerate(mutagen.id3.TCON.GENRES):
|
||||
print_(u"%3d: %s" % (i, genre))
|
||||
print_("%3d: %s" % (i, genre))
|
||||
raise SystemExit
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ def delete_tags(filenames, v1, v2):
|
||||
for filename in filenames:
|
||||
with _sig.block():
|
||||
if verbose:
|
||||
print_(u"deleting ID3 tag info in", filename, file=sys.stderr)
|
||||
print_("deleting ID3 tag info in", filename, file=sys.stderr)
|
||||
mutagen.id3.delete(filename, v1, v2)
|
||||
|
||||
|
||||
@@ -95,13 +95,13 @@ def delete_frames(deletes, filenames):
|
||||
for filename in filenames:
|
||||
with _sig.block():
|
||||
if verbose:
|
||||
print_(u"deleting %s from" % deletes, filename,
|
||||
print_("deleting %s from" % deletes, filename,
|
||||
file=sys.stderr)
|
||||
try:
|
||||
id3 = mutagen.id3.ID3(filename)
|
||||
except mutagen.id3.ID3NoHeaderError:
|
||||
if verbose:
|
||||
print_(u"No ID3 header found; skipping.", file=sys.stderr)
|
||||
print_("No ID3 header found; skipping.", file=sys.stderr)
|
||||
except Exception as err:
|
||||
print_(text_type(err), file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
@@ -177,7 +177,7 @@ def write_files(edits, filenames, escape):
|
||||
try:
|
||||
value = value_from_fsnative(value, escape)
|
||||
except ValueError as err:
|
||||
error(u"%s: %s" % (frame, text_type(err)))
|
||||
error("%s: %s" % (frame, text_type(err)))
|
||||
|
||||
assert isinstance(value, text_type)
|
||||
|
||||
@@ -205,18 +205,18 @@ def write_files(edits, filenames, escape):
|
||||
for filename in filenames:
|
||||
with _sig.block():
|
||||
if verbose:
|
||||
print_(u"Writing", filename, file=sys.stderr)
|
||||
print_("Writing", filename, file=sys.stderr)
|
||||
try:
|
||||
id3 = mutagen.id3.ID3(filename)
|
||||
except mutagen.id3.ID3NoHeaderError:
|
||||
if verbose:
|
||||
print_(u"No ID3 header found; creating a new tag",
|
||||
print_("No ID3 header found; creating a new tag",
|
||||
file=sys.stderr)
|
||||
id3 = mutagen.id3.ID3()
|
||||
except Exception as err:
|
||||
print_(str(err), file=sys.stderr)
|
||||
continue
|
||||
for (frame, vlist) in edits.items():
|
||||
for (frame, vlist) in list(edits.items()):
|
||||
if frame == "POPM":
|
||||
for value in vlist:
|
||||
values = string_split(value, ":")
|
||||
@@ -240,13 +240,13 @@ def write_files(edits, filenames, escape):
|
||||
if len(values) >= 2:
|
||||
desc = values[1]
|
||||
else:
|
||||
desc = u"cover"
|
||||
desc = "cover"
|
||||
|
||||
if len(values) >= 3:
|
||||
try:
|
||||
picture_type = int(values[2])
|
||||
except ValueError:
|
||||
error(u"Invalid picture type: %r" % values[1])
|
||||
error("Invalid picture type: %r" % values[1])
|
||||
else:
|
||||
picture_type = PictureType.COVER_FRONT
|
||||
|
||||
@@ -287,7 +287,7 @@ def write_files(edits, filenames, escape):
|
||||
for value in vlist:
|
||||
values = string_split(value, ":")
|
||||
if len(values) != 2:
|
||||
error(u"Invalid value: %r" % values)
|
||||
error("Invalid value: %r" % values)
|
||||
owner = values[0]
|
||||
data = values[1].encode("utf-8")
|
||||
frame = mutagen.id3.UFID(owner=owner, data=data)
|
||||
@@ -318,7 +318,7 @@ def list_tags(filenames):
|
||||
try:
|
||||
id3 = mutagen.id3.ID3(filename, translate=False)
|
||||
except mutagen.id3.ID3NoHeaderError:
|
||||
print_(u"No ID3 header found; skipping.")
|
||||
print_("No ID3 header found; skipping.")
|
||||
except Exception as err:
|
||||
print_(text_type(err), file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
@@ -332,12 +332,12 @@ def list_tags_raw(filenames):
|
||||
try:
|
||||
id3 = mutagen.id3.ID3(filename, translate=False)
|
||||
except mutagen.id3.ID3NoHeaderError:
|
||||
print_(u"No ID3 header found; skipping.")
|
||||
print_("No ID3 header found; skipping.")
|
||||
except Exception as err:
|
||||
print_(text_type(err), file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
else:
|
||||
for frame in id3.values():
|
||||
for frame in list(id3.values()):
|
||||
print_(text_type(repr(frame)))
|
||||
|
||||
|
||||
@@ -387,46 +387,46 @@ def main(argv):
|
||||
parser.add_option(
|
||||
"-a", "--artist", metavar='"ARTIST"', action="callback",
|
||||
help="Set the artist information", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--TPE1"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--TPE1"),
|
||||
args[2])))
|
||||
parser.add_option(
|
||||
"-A", "--album", metavar='"ALBUM"', action="callback",
|
||||
help="Set the album title information", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--TALB"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--TALB"),
|
||||
args[2])))
|
||||
parser.add_option(
|
||||
"-t", "--song", metavar='"SONG"', action="callback",
|
||||
help="Set the song title information", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--TIT2"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--TIT2"),
|
||||
args[2])))
|
||||
parser.add_option(
|
||||
"-c", "--comment", metavar='"DESCRIPTION":"COMMENT":"LANGUAGE"',
|
||||
action="callback", help="Set the comment information", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--COMM"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--COMM"),
|
||||
args[2])))
|
||||
parser.add_option(
|
||||
"-p", "--picture",
|
||||
metavar='"FILENAME":"DESCRIPTION":"IMAGE-TYPE":"MIME-TYPE"',
|
||||
action="callback", help="Set the picture", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--APIC"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--APIC"),
|
||||
args[2])))
|
||||
parser.add_option(
|
||||
"-g", "--genre", metavar='"GENRE"', action="callback",
|
||||
help="Set the genre or genre number", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--TCON"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--TCON"),
|
||||
args[2])))
|
||||
parser.add_option(
|
||||
"-y", "--year", "--date", metavar='YYYY[-MM-DD]', action="callback",
|
||||
help="Set the year/date", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--TDRC"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--TDRC"),
|
||||
args[2])))
|
||||
parser.add_option(
|
||||
"-T", "--track", metavar='"num/num"', action="callback",
|
||||
help="Set the track number/(optional) total tracks", type="string",
|
||||
callback=lambda *args: args[3].edits.append((fsnative(u"--TRCK"),
|
||||
callback=lambda *args: args[3].edits.append((fsnative("--TRCK"),
|
||||
args[2])))
|
||||
|
||||
for key, frame in mutagen.id3.Frames.items():
|
||||
for key, frame in list(mutagen.id3.Frames.items()):
|
||||
if (issubclass(frame, mutagen.id3.TextFrame)
|
||||
or issubclass(frame, mutagen.id3.UrlFrame)
|
||||
or issubclass(frame, mutagen.id3.POPM)
|
||||
|
||||
@@ -66,7 +66,7 @@ def main(argv):
|
||||
if m3u:
|
||||
m3u.write(new_filename + "\r\n")
|
||||
fileobjs[page.serial].write(page.write())
|
||||
for f in fileobjs.values():
|
||||
for f in list(fileobjs.values()):
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
@@ -30,14 +30,14 @@ def main(argv):
|
||||
raise SystemExit(parser.print_help() or 1)
|
||||
|
||||
for filename in args:
|
||||
print_(u"--", filename)
|
||||
print_("--", filename)
|
||||
try:
|
||||
print_(u"-", File(filename).pprint())
|
||||
print_("-", File(filename).pprint())
|
||||
except AttributeError:
|
||||
print_(u"- Unknown file type")
|
||||
print_("- Unknown file type")
|
||||
except Exception as err:
|
||||
print_(text_type(err))
|
||||
print_(u"")
|
||||
print_("")
|
||||
|
||||
|
||||
def entry_point():
|
||||
|
||||
@@ -83,7 +83,7 @@ def check_dir(path):
|
||||
from mutagen.mp3 import MP3
|
||||
|
||||
rep = Report(path)
|
||||
print_(u"Scanning", path)
|
||||
print_("Scanning", path)
|
||||
for path, dirs, files in os.walk(path):
|
||||
files.sort()
|
||||
for fn in files:
|
||||
@@ -105,7 +105,7 @@ def check_dir(path):
|
||||
|
||||
def main(argv):
|
||||
if len(argv) == 1:
|
||||
print_(u"Usage:", argv[0], u"directory ...")
|
||||
print_("Usage:", argv[0], "directory ...")
|
||||
else:
|
||||
for path in argv[1:]:
|
||||
check_dir(path)
|
||||
|
||||
+21
-21
@@ -93,7 +93,7 @@ def fileobj_name(fileobj):
|
||||
path type, but might be empty or non-existent.
|
||||
"""
|
||||
|
||||
value = getattr(fileobj, "name", u"")
|
||||
value = getattr(fileobj, "name", "")
|
||||
if not isinstance(value, (text_type, bytes)):
|
||||
value = text_type(value)
|
||||
return value
|
||||
@@ -360,7 +360,7 @@ def flags(cls):
|
||||
def str_(self):
|
||||
value = int(self)
|
||||
matches = []
|
||||
for k, v in map_.items():
|
||||
for k, v in list(map_.items()):
|
||||
if value & k:
|
||||
matches.append("%s.%s" % (type(self).__name__, v))
|
||||
value &= ~k
|
||||
@@ -395,7 +395,7 @@ class DictMixin(object):
|
||||
"""
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.keys())
|
||||
return iter(list(self.keys()))
|
||||
|
||||
def __has_key(self, key):
|
||||
try:
|
||||
@@ -411,19 +411,19 @@ class DictMixin(object):
|
||||
__contains__ = __has_key
|
||||
|
||||
if PY2:
|
||||
iterkeys = lambda self: iter(self.keys())
|
||||
iterkeys = lambda self: iter(list(self.keys()))
|
||||
|
||||
def values(self):
|
||||
return [self[k] for k in self.keys()]
|
||||
return [self[k] for k in list(self.keys())]
|
||||
|
||||
if PY2:
|
||||
itervalues = lambda self: iter(self.values())
|
||||
itervalues = lambda self: iter(list(self.values()))
|
||||
|
||||
def items(self):
|
||||
return list(izip(self.keys(), self.values()))
|
||||
return list(zip(list(self.keys()), list(self.values())))
|
||||
|
||||
if PY2:
|
||||
iteritems = lambda s: iter(s.items())
|
||||
iteritems = lambda s: iter(list(s.items()))
|
||||
|
||||
def clear(self):
|
||||
for key in list(self.keys()):
|
||||
@@ -443,7 +443,7 @@ class DictMixin(object):
|
||||
return value
|
||||
|
||||
def popitem(self):
|
||||
for key in self.keys():
|
||||
for key in list(self.keys()):
|
||||
break
|
||||
else:
|
||||
raise KeyError("dictionary is empty")
|
||||
@@ -455,7 +455,7 @@ class DictMixin(object):
|
||||
other = {}
|
||||
|
||||
try:
|
||||
for key, value in other.items():
|
||||
for key, value in list(other.items()):
|
||||
self.__setitem__(key, value)
|
||||
except AttributeError:
|
||||
for key, value in other:
|
||||
@@ -475,18 +475,18 @@ class DictMixin(object):
|
||||
return default
|
||||
|
||||
def __repr__(self):
|
||||
return repr(dict(self.items()))
|
||||
return repr(dict(list(self.items())))
|
||||
|
||||
def __eq__(self, other):
|
||||
return dict(self.items()) == other
|
||||
return dict(list(self.items())) == other
|
||||
|
||||
def __lt__(self, other):
|
||||
return dict(self.items()) < other
|
||||
return dict(list(self.items())) < other
|
||||
|
||||
__hash__ = object.__hash__
|
||||
|
||||
def __len__(self):
|
||||
return len(self.keys())
|
||||
return len(list(self.keys()))
|
||||
|
||||
|
||||
class DictProxy(DictMixin):
|
||||
@@ -504,7 +504,7 @@ class DictProxy(DictMixin):
|
||||
del(self.__dict[key])
|
||||
|
||||
def keys(self):
|
||||
return self.__dict.keys()
|
||||
return list(self.__dict.keys())
|
||||
|
||||
|
||||
def _fill_cdata(cls):
|
||||
@@ -568,8 +568,8 @@ class cdata(object):
|
||||
error = error
|
||||
|
||||
bitswap = b''.join(
|
||||
chr_(sum(((val >> i) & 1) << (7 - i) for i in xrange(8)))
|
||||
for val in xrange(256))
|
||||
chr_(sum(((val >> i) & 1) << (7 - i) for i in range(8)))
|
||||
for val in range(256))
|
||||
|
||||
test_bit = staticmethod(lambda value, n: bool((value >> n) & 1))
|
||||
|
||||
@@ -976,15 +976,15 @@ def decode_terminated(data, encoding, strict=True):
|
||||
r = []
|
||||
for i, b in enumerate(iterbytes(data)):
|
||||
c = decoder.decode(b)
|
||||
if c == u"\x00":
|
||||
return u"".join(r), data[i + 1:]
|
||||
if c == "\x00":
|
||||
return "".join(r), data[i + 1:]
|
||||
r.append(c)
|
||||
else:
|
||||
# make sure the decoder is finished
|
||||
r.append(decoder.decode(b"", True))
|
||||
if strict:
|
||||
raise ValueError("not null terminated")
|
||||
return u"".join(r), b""
|
||||
return "".join(r), b""
|
||||
|
||||
|
||||
class BitReaderError(Exception):
|
||||
@@ -1037,7 +1037,7 @@ class BitReader(object):
|
||||
raise BitReaderError("not enough data")
|
||||
return data
|
||||
|
||||
return bytes(bytearray(self.bits(8) for _ in xrange(count)))
|
||||
return bytes(bytearray(self.bits(8) for _ in range(count)))
|
||||
|
||||
def skip(self, count):
|
||||
"""Skip `count` bits.
|
||||
|
||||
@@ -71,7 +71,7 @@ class VComment(mutagen.Tags, list):
|
||||
vendor (text): the stream 'vendor' (i.e. writer); default 'Mutagen'
|
||||
"""
|
||||
|
||||
vendor = u"Mutagen " + mutagen.version_string
|
||||
vendor = "Mutagen " + mutagen.version_string
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
self._size = 0
|
||||
@@ -104,7 +104,7 @@ class VComment(mutagen.Tags, list):
|
||||
vendor_length = cdata.uint_le(fileobj.read(4))
|
||||
self.vendor = fileobj.read(vendor_length).decode('utf-8', errors)
|
||||
count = cdata.uint_le(fileobj.read(4))
|
||||
for i in xrange(count):
|
||||
for i in range(count):
|
||||
length = cdata.uint_le(fileobj.read(4))
|
||||
try:
|
||||
string = fileobj.read(length).decode('utf-8', errors)
|
||||
@@ -116,7 +116,7 @@ class VComment(mutagen.Tags, list):
|
||||
if errors == "ignore":
|
||||
continue
|
||||
elif errors == "replace":
|
||||
tag, value = u"unknown%d" % i, string
|
||||
tag, value = "unknown%d" % i, string
|
||||
else:
|
||||
reraise(VorbisEncodingError, err, sys.exc_info()[2])
|
||||
try:
|
||||
@@ -217,8 +217,8 @@ class VComment(mutagen.Tags, list):
|
||||
return value.decode('utf-8', 'replace')
|
||||
return value
|
||||
|
||||
tags = [u"%s=%s" % (_decode(k), _decode(v)) for k, v in self]
|
||||
return u"\n".join(tags)
|
||||
tags = ["%s=%s" % (_decode(k), _decode(v)) for k, v in self]
|
||||
return "\n".join(tags)
|
||||
|
||||
|
||||
class VCommentDict(VComment, DictMixin):
|
||||
@@ -324,4 +324,4 @@ class VCommentDict(VComment, DictMixin):
|
||||
def as_dict(self):
|
||||
"""Return a copy of the comment data in a real dict."""
|
||||
|
||||
return dict([(key, self[key]) for key in self.keys()])
|
||||
return dict([(key, self[key]) for key in list(self.keys())])
|
||||
|
||||
+5
-5
@@ -243,7 +243,7 @@ class ProgramConfigElement(object):
|
||||
elms = num_front_channel_elements + num_side_channel_elements + \
|
||||
num_back_channel_elements
|
||||
channels = 0
|
||||
for i in xrange(elms):
|
||||
for i in range(elms):
|
||||
channels += 1
|
||||
element_is_cpe = r.bits(1)
|
||||
if element_is_cpe:
|
||||
@@ -323,7 +323,7 @@ class AACInfo(StreamInfo):
|
||||
self.channels = pce.channels
|
||||
|
||||
# other pces..
|
||||
for i in xrange(npce):
|
||||
for i in range(npce):
|
||||
ProgramConfigElement(r)
|
||||
r.align()
|
||||
except BitReaderError as e:
|
||||
@@ -347,7 +347,7 @@ class AACInfo(StreamInfo):
|
||||
# Try up to X times to find a sync word and read up to Y frames.
|
||||
# If more than Z frames are valid we assume a valid stream
|
||||
offset = start_offset
|
||||
for i in xrange(max_sync_tries):
|
||||
for i in range(max_sync_tries):
|
||||
fileobj.seek(offset)
|
||||
s = _ADTSStream.find_stream(fileobj, max_initial_read)
|
||||
if s is None:
|
||||
@@ -355,7 +355,7 @@ class AACInfo(StreamInfo):
|
||||
# start right after the last found offset
|
||||
offset += s.offset + 1
|
||||
|
||||
for i in xrange(frames_max):
|
||||
for i in range(frames_max):
|
||||
if not s.parse_frame():
|
||||
break
|
||||
if not s.sync(max_resync_read):
|
||||
@@ -378,7 +378,7 @@ class AACInfo(StreamInfo):
|
||||
self.length = float(s.samples * stream_size) / (s.size * s.frequency)
|
||||
|
||||
def pprint(self):
|
||||
return u"AAC (%s), %d Hz, %.2f seconds, %d channel(s), %d bps" % (
|
||||
return "AAC (%s), %d Hz, %.2f seconds, %d channel(s), %d bps" % (
|
||||
self._type, self.sample_rate, self.length, self.channels,
|
||||
self.bitrate)
|
||||
|
||||
|
||||
+13
-13
@@ -39,8 +39,8 @@ _HUGE_VAL = 1.79769313486231e+308
|
||||
def is_valid_chunk_id(id):
|
||||
assert isinstance(id, text_type)
|
||||
|
||||
return ((len(id) <= 4) and (min(id) >= u' ') and
|
||||
(max(id) <= u'~'))
|
||||
return ((len(id) <= 4) and (min(id) >= ' ') and
|
||||
(max(id) <= '~'))
|
||||
|
||||
|
||||
def read_float(data): # 10 bytes
|
||||
@@ -140,7 +140,7 @@ class IFFFile(object):
|
||||
# AIFF Files always start with the FORM chunk which contains a 4 byte
|
||||
# ID before the start of other chunks
|
||||
fileobj.seek(0)
|
||||
self.__chunks[u'FORM'] = IFFChunk(fileobj)
|
||||
self.__chunks['FORM'] = IFFChunk(fileobj)
|
||||
|
||||
# Skip past the 4 byte FORM id
|
||||
fileobj.seek(IFFChunk.HEADER_SIZE + 4)
|
||||
@@ -153,7 +153,7 @@ class IFFFile(object):
|
||||
# Load all of the chunks
|
||||
while True:
|
||||
try:
|
||||
chunk = IFFChunk(fileobj, self[u'FORM'])
|
||||
chunk = IFFChunk(fileobj, self['FORM'])
|
||||
except InvalidChunk:
|
||||
break
|
||||
self.__chunks[chunk.id.strip()] = chunk
|
||||
@@ -209,8 +209,8 @@ class IFFFile(object):
|
||||
self.__fileobj.seek(self.__next_offset)
|
||||
self.__fileobj.write(pack('>4si', id_.ljust(4).encode('ascii'), 0))
|
||||
self.__fileobj.seek(self.__next_offset)
|
||||
chunk = IFFChunk(self.__fileobj, self[u'FORM'])
|
||||
self[u'FORM']._update_size(self[u'FORM'].data_size + chunk.size)
|
||||
chunk = IFFChunk(self.__fileobj, self['FORM'])
|
||||
self['FORM']._update_size(self['FORM'].data_size + chunk.size)
|
||||
|
||||
self.__chunks[id_] = chunk
|
||||
self.__next_offset = chunk.offset + chunk.size
|
||||
@@ -242,7 +242,7 @@ class AIFFInfo(StreamInfo):
|
||||
|
||||
iff = IFFFile(fileobj)
|
||||
try:
|
||||
common_chunk = iff[u'COMM']
|
||||
common_chunk = iff['COMM']
|
||||
except KeyError as e:
|
||||
raise error(str(e))
|
||||
|
||||
@@ -260,7 +260,7 @@ class AIFFInfo(StreamInfo):
|
||||
self.length = frame_count / float(self.sample_rate)
|
||||
|
||||
def pprint(self):
|
||||
return u"%d channel AIFF @ %d bps, %s Hz, %.2f seconds" % (
|
||||
return "%d channel AIFF @ %d bps, %s Hz, %.2f seconds" % (
|
||||
self.channels, self.bitrate, self.sample_rate, self.length)
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ class _IFFID3(ID3):
|
||||
|
||||
def _pre_load_header(self, fileobj):
|
||||
try:
|
||||
fileobj.seek(IFFFile(fileobj)[u'ID3'].data_offset)
|
||||
fileobj.seek(IFFFile(fileobj)['ID3'].data_offset)
|
||||
except (InvalidChunk, KeyError):
|
||||
raise ID3NoHeaderError("No ID3 chunk")
|
||||
|
||||
@@ -282,10 +282,10 @@ class _IFFID3(ID3):
|
||||
|
||||
iff_file = IFFFile(fileobj)
|
||||
|
||||
if u'ID3' not in iff_file:
|
||||
iff_file.insert_chunk(u'ID3')
|
||||
if 'ID3' not in iff_file:
|
||||
iff_file.insert_chunk('ID3')
|
||||
|
||||
chunk = iff_file[u'ID3']
|
||||
chunk = iff_file['ID3']
|
||||
|
||||
try:
|
||||
data = self._prepare_data(
|
||||
@@ -316,7 +316,7 @@ def delete(filething):
|
||||
"""Completely removes the ID3 chunk from the AIFF file"""
|
||||
|
||||
try:
|
||||
del IFFFile(filething.fileobj)[u'ID3']
|
||||
del IFFFile(filething.fileobj)['ID3']
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
+19
-19
@@ -52,16 +52,16 @@ def is_valid_apev2_key(key):
|
||||
return False
|
||||
|
||||
# PY26 - Change to set literal syntax (since set is faster than list here)
|
||||
return ((2 <= len(key) <= 255) and (min(key) >= u' ') and
|
||||
(max(key) <= u'~') and
|
||||
(key not in [u"OggS", u"TAG", u"ID3", u"MP+"]))
|
||||
return ((2 <= len(key) <= 255) and (min(key) >= ' ') and
|
||||
(max(key) <= '~') and
|
||||
(key not in ["OggS", "TAG", "ID3", "MP+"]))
|
||||
|
||||
# There are three different kinds of APE tag values.
|
||||
# "0: Item contains text information coded in UTF-8
|
||||
# 1: Item contains binary information
|
||||
# 2: Item is a locator of external stored information [e.g. URL]
|
||||
# 3: reserved"
|
||||
TEXT, BINARY, EXTERNAL = xrange(3)
|
||||
TEXT, BINARY, EXTERNAL = range(3)
|
||||
|
||||
HAS_HEADER = 1 << 31
|
||||
HAS_NO_FOOTER = 1 << 30
|
||||
@@ -263,7 +263,7 @@ class _CIDictProxy(DictMixin):
|
||||
del(self.__dict[lower])
|
||||
|
||||
def keys(self):
|
||||
return [self.__casemap.get(key, key) for key in self.__dict.keys()]
|
||||
return [self.__casemap.get(key, key) for key in list(self.__dict.keys())]
|
||||
|
||||
|
||||
class APEv2(_CIDictProxy, Metadata):
|
||||
@@ -280,7 +280,7 @@ class APEv2(_CIDictProxy, Metadata):
|
||||
"""Return tag key=value pairs in a human-readable format."""
|
||||
|
||||
items = sorted(self.items())
|
||||
return u"\n".join(u"%s=%s" % (k, v.pprint()) for k, v in items)
|
||||
return "\n".join("%s=%s" % (k, v.pprint()) for k, v in items)
|
||||
|
||||
@convert_error(IOError, error)
|
||||
@loadfile()
|
||||
@@ -303,7 +303,7 @@ class APEv2(_CIDictProxy, Metadata):
|
||||
|
||||
fileobj = cBytesIO(tag)
|
||||
|
||||
for i in xrange(count):
|
||||
for i in range(count):
|
||||
tag_data = fileobj.read(8)
|
||||
# someone writes wrong item counts
|
||||
if not tag_data:
|
||||
@@ -401,7 +401,7 @@ class APEv2(_CIDictProxy, Metadata):
|
||||
items.append(v)
|
||||
|
||||
# list? text.
|
||||
value = APEValue(u"\0".join(items), TEXT)
|
||||
value = APEValue("\0".join(items), TEXT)
|
||||
else:
|
||||
if PY3:
|
||||
value = APEValue(value, BINARY)
|
||||
@@ -441,7 +441,7 @@ class APEv2(_CIDictProxy, Metadata):
|
||||
fileobj.seek(0, 2)
|
||||
|
||||
tags = []
|
||||
for key, value in self.items():
|
||||
for key, value in list(self.items()):
|
||||
# Packed format for an item:
|
||||
# 4B: Value length
|
||||
# 4B: Value type
|
||||
@@ -627,13 +627,13 @@ class APETextValue(_APEUtf8Value, MutableSequence):
|
||||
def __iter__(self):
|
||||
"""Iterate over the strings of the value (not the characters)"""
|
||||
|
||||
return iter(self.value.split(u"\0"))
|
||||
return iter(self.value.split("\0"))
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.value.split(u"\0")[index]
|
||||
return self.value.split("\0")[index]
|
||||
|
||||
def __len__(self):
|
||||
return self.value.count(u"\0") + 1
|
||||
return self.value.count("\0") + 1
|
||||
|
||||
def __setitem__(self, index, value):
|
||||
if not isinstance(value, text_type):
|
||||
@@ -644,7 +644,7 @@ class APETextValue(_APEUtf8Value, MutableSequence):
|
||||
|
||||
values = list(self)
|
||||
values[index] = value
|
||||
self.value = u"\0".join(values)
|
||||
self.value = "\0".join(values)
|
||||
|
||||
def insert(self, index, value):
|
||||
if not isinstance(value, text_type):
|
||||
@@ -655,15 +655,15 @@ class APETextValue(_APEUtf8Value, MutableSequence):
|
||||
|
||||
values = list(self)
|
||||
values.insert(index, value)
|
||||
self.value = u"\0".join(values)
|
||||
self.value = "\0".join(values)
|
||||
|
||||
def __delitem__(self, index):
|
||||
values = list(self)
|
||||
del values[index]
|
||||
self.value = u"\0".join(values)
|
||||
self.value = "\0".join(values)
|
||||
|
||||
def pprint(self):
|
||||
return u" / ".join(self)
|
||||
return " / ".join(self)
|
||||
|
||||
|
||||
@swap_to_string
|
||||
@@ -697,7 +697,7 @@ class APEBinaryValue(_APEValue):
|
||||
return self.value < other
|
||||
|
||||
def pprint(self):
|
||||
return u"[%d bytes]" % len(self)
|
||||
return "[%d bytes]" % len(self)
|
||||
|
||||
|
||||
class APEExtValue(_APEUtf8Value):
|
||||
@@ -709,7 +709,7 @@ class APEExtValue(_APEUtf8Value):
|
||||
kind = EXTERNAL
|
||||
|
||||
def pprint(self):
|
||||
return u"[External] %s" % self.value
|
||||
return "[External] %s" % self.value
|
||||
|
||||
|
||||
class APEv2File(FileType):
|
||||
@@ -731,7 +731,7 @@ class APEv2File(FileType):
|
||||
|
||||
@staticmethod
|
||||
def pprint():
|
||||
return u"Unknown format with APEv2 tag."
|
||||
return "Unknown format with APEv2 tag."
|
||||
|
||||
@loadfile()
|
||||
def load(self, filething):
|
||||
|
||||
@@ -51,26 +51,26 @@ class ASFInfo(StreamInfo):
|
||||
sample_rate = 0
|
||||
bitrate = 0
|
||||
channels = 0
|
||||
codec_type = u""
|
||||
codec_name = u""
|
||||
codec_description = u""
|
||||
codec_type = ""
|
||||
codec_name = ""
|
||||
codec_description = ""
|
||||
|
||||
def __init__(self):
|
||||
self.length = 0.0
|
||||
self.sample_rate = 0
|
||||
self.bitrate = 0
|
||||
self.channels = 0
|
||||
self.codec_type = u""
|
||||
self.codec_name = u""
|
||||
self.codec_description = u""
|
||||
self.codec_type = ""
|
||||
self.codec_name = ""
|
||||
self.codec_description = ""
|
||||
|
||||
def pprint(self):
|
||||
"""Returns:
|
||||
text: a stream information text summary
|
||||
"""
|
||||
|
||||
s = u"ASF (%s) %d bps, %s Hz, %d channels, %.2f seconds" % (
|
||||
self.codec_type or self.codec_name or u"???", self.bitrate,
|
||||
s = "ASF (%s) %d bps, %s Hz, %d channels, %.2f seconds" % (
|
||||
self.codec_type or self.codec_name or "???", self.bitrate,
|
||||
self.sample_rate, self.channels, self.length)
|
||||
return s
|
||||
|
||||
@@ -163,7 +163,7 @@ class ASFTags(list, DictMixin, Tags):
|
||||
def keys(self):
|
||||
"""Return a sequence of all keys in the comment."""
|
||||
|
||||
return self and set(next(izip(*self)))
|
||||
return self and set(next(zip(*self)))
|
||||
|
||||
def as_dict(self):
|
||||
"""Return a copy of the comment data in a real dict."""
|
||||
|
||||
+18
-18
@@ -89,7 +89,7 @@ class HeaderObject(BaseObject):
|
||||
remaining_header, num_objects = cls.parse_size(fileobj)
|
||||
remaining_header -= 30
|
||||
|
||||
for i in xrange(num_objects):
|
||||
for i in range(num_objects):
|
||||
obj_header_size = 24
|
||||
if remaining_header < obj_header_size:
|
||||
raise ASFHeaderError("invalid header size")
|
||||
@@ -180,11 +180,11 @@ class ContentDescriptionObject(BaseObject):
|
||||
GUID = guid2bytes("75B22633-668E-11CF-A6D9-00AA0062CE6C")
|
||||
|
||||
NAMES = [
|
||||
u"Title",
|
||||
u"Author",
|
||||
u"Copyright",
|
||||
u"Description",
|
||||
u"Rating",
|
||||
"Title",
|
||||
"Author",
|
||||
"Copyright",
|
||||
"Description",
|
||||
"Rating",
|
||||
]
|
||||
|
||||
def parse(self, asf, data):
|
||||
@@ -195,12 +195,12 @@ class ContentDescriptionObject(BaseObject):
|
||||
for length in lengths:
|
||||
end = pos + length
|
||||
if length > 0:
|
||||
texts.append(data[pos:end].decode("utf-16-le").strip(u"\x00"))
|
||||
texts.append(data[pos:end].decode("utf-16-le").strip("\x00"))
|
||||
else:
|
||||
texts.append(None)
|
||||
pos = end
|
||||
|
||||
for key, value in izip(self.NAMES, texts):
|
||||
for key, value in zip(self.NAMES, texts):
|
||||
if value is not None:
|
||||
value = ASFUnicodeAttribute(value=value)
|
||||
asf._tags.setdefault(self.GUID, []).append((key, value))
|
||||
@@ -214,7 +214,7 @@ class ContentDescriptionObject(BaseObject):
|
||||
return b""
|
||||
|
||||
texts = [render_text(x) for x in self.NAMES]
|
||||
data = struct.pack("<HHHHH", *map(len, texts)) + b"".join(texts)
|
||||
data = struct.pack("<HHHHH", *list(map(len, texts))) + b"".join(texts)
|
||||
return self.GUID + struct.pack("<Q", 24 + len(data)) + data
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ class ExtendedContentDescriptionObject(BaseObject):
|
||||
super(ExtendedContentDescriptionObject, self).parse(asf, data)
|
||||
num_attributes, = struct.unpack("<H", data[0:2])
|
||||
pos = 2
|
||||
for i in xrange(num_attributes):
|
||||
for i in range(num_attributes):
|
||||
name_length, = struct.unpack("<H", data[pos:pos + 2])
|
||||
pos += 2
|
||||
name = data[pos:pos + name_length]
|
||||
@@ -242,7 +242,7 @@ class ExtendedContentDescriptionObject(BaseObject):
|
||||
asf._tags.setdefault(self.GUID, []).append((name, attr))
|
||||
|
||||
def render(self, asf):
|
||||
attrs = asf.to_extended_content_description.items()
|
||||
attrs = list(asf.to_extended_content_description.items())
|
||||
data = b"".join(attr.render(name) for (name, attr) in attrs)
|
||||
data = struct.pack("<QH", 26 + len(data), len(attrs)) + data
|
||||
return self.GUID + data
|
||||
@@ -292,7 +292,7 @@ class CodecListObject(BaseObject):
|
||||
try:
|
||||
name = data[offset:next_offset].decode("utf-16-le").strip("\x00")
|
||||
except UnicodeDecodeError:
|
||||
name = u""
|
||||
name = ""
|
||||
offset = next_offset
|
||||
|
||||
units, offset = cdata.uint16_le_from(data, offset)
|
||||
@@ -300,12 +300,12 @@ class CodecListObject(BaseObject):
|
||||
try:
|
||||
desc = data[offset:next_offset].decode("utf-16-le").strip("\x00")
|
||||
except UnicodeDecodeError:
|
||||
desc = u""
|
||||
desc = ""
|
||||
offset = next_offset
|
||||
|
||||
bytes_, offset = cdata.uint16_le_from(data, offset)
|
||||
next_offset = offset + bytes_
|
||||
codec = u""
|
||||
codec = ""
|
||||
if bytes_ == 2:
|
||||
codec_id = cdata.uint16_le_from(data, offset)[0]
|
||||
if codec_id in CODECS:
|
||||
@@ -319,7 +319,7 @@ class CodecListObject(BaseObject):
|
||||
|
||||
offset = 16
|
||||
count, offset = cdata.uint32_le_from(data, offset)
|
||||
for i in xrange(count):
|
||||
for i in range(count):
|
||||
try:
|
||||
offset, type_, name, desc, codec = \
|
||||
self._parse_entry(data, offset)
|
||||
@@ -407,7 +407,7 @@ class MetadataObject(BaseObject):
|
||||
super(MetadataObject, self).parse(asf, data)
|
||||
num_attributes, = struct.unpack("<H", data[0:2])
|
||||
pos = 2
|
||||
for i in xrange(num_attributes):
|
||||
for i in range(num_attributes):
|
||||
(reserved, stream, name_length, value_type,
|
||||
value_length) = struct.unpack("<HHHHI", data[pos:pos + 12])
|
||||
pos += 12
|
||||
@@ -423,7 +423,7 @@ class MetadataObject(BaseObject):
|
||||
asf._tags.setdefault(self.GUID, []).append((name, attr))
|
||||
|
||||
def render(self, asf):
|
||||
attrs = asf.to_metadata.items()
|
||||
attrs = list(asf.to_metadata.items())
|
||||
data = b"".join([attr.render_m(name) for (name, attr) in attrs])
|
||||
return (self.GUID + struct.pack("<QH", 26 + len(data), len(attrs)) +
|
||||
data)
|
||||
@@ -439,7 +439,7 @@ class MetadataLibraryObject(BaseObject):
|
||||
super(MetadataLibraryObject, self).parse(asf, data)
|
||||
num_attributes, = struct.unpack("<H", data[0:2])
|
||||
pos = 2
|
||||
for i in xrange(num_attributes):
|
||||
for i in range(num_attributes):
|
||||
(language, stream, name_length, value_type,
|
||||
value_length) = struct.unpack("<HHHHI", data[pos:pos + 12])
|
||||
pos += 12
|
||||
|
||||
+261
-261
@@ -52,265 +52,265 @@ def bytes2guid(s):
|
||||
|
||||
# Names from http://windows.microsoft.com/en-za/windows7/c00d10d1-[0-9A-F]{1,4}
|
||||
CODECS = {
|
||||
0x0000: u"Unknown Wave Format",
|
||||
0x0001: u"Microsoft PCM Format",
|
||||
0x0002: u"Microsoft ADPCM Format",
|
||||
0x0003: u"IEEE Float",
|
||||
0x0004: u"Compaq Computer VSELP",
|
||||
0x0005: u"IBM CVSD",
|
||||
0x0006: u"Microsoft CCITT A-Law",
|
||||
0x0007: u"Microsoft CCITT u-Law",
|
||||
0x0008: u"Microsoft DTS",
|
||||
0x0009: u"Microsoft DRM",
|
||||
0x000A: u"Windows Media Audio 9 Voice",
|
||||
0x000B: u"Windows Media Audio 10 Voice",
|
||||
0x000C: u"OGG Vorbis",
|
||||
0x000D: u"FLAC",
|
||||
0x000E: u"MOT AMR",
|
||||
0x000F: u"Nice Systems IMBE",
|
||||
0x0010: u"OKI ADPCM",
|
||||
0x0011: u"Intel IMA ADPCM",
|
||||
0x0012: u"Videologic MediaSpace ADPCM",
|
||||
0x0013: u"Sierra Semiconductor ADPCM",
|
||||
0x0014: u"Antex Electronics G.723 ADPCM",
|
||||
0x0015: u"DSP Solutions DIGISTD",
|
||||
0x0016: u"DSP Solutions DIGIFIX",
|
||||
0x0017: u"Dialogic OKI ADPCM",
|
||||
0x0018: u"MediaVision ADPCM",
|
||||
0x0019: u"Hewlett-Packard CU codec",
|
||||
0x001A: u"Hewlett-Packard Dynamic Voice",
|
||||
0x0020: u"Yamaha ADPCM",
|
||||
0x0021: u"Speech Compression SONARC",
|
||||
0x0022: u"DSP Group True Speech",
|
||||
0x0023: u"Echo Speech EchoSC1",
|
||||
0x0024: u"Ahead Inc. Audiofile AF36",
|
||||
0x0025: u"Audio Processing Technology APTX",
|
||||
0x0026: u"Ahead Inc. AudioFile AF10",
|
||||
0x0027: u"Aculab Prosody 1612",
|
||||
0x0028: u"Merging Technologies S.A. LRC",
|
||||
0x0030: u"Dolby Labs AC2",
|
||||
0x0031: u"Microsoft GSM 6.10",
|
||||
0x0032: u"Microsoft MSNAudio",
|
||||
0x0033: u"Antex Electronics ADPCME",
|
||||
0x0034: u"Control Resources VQLPC",
|
||||
0x0035: u"DSP Solutions Digireal",
|
||||
0x0036: u"DSP Solutions DigiADPCM",
|
||||
0x0037: u"Control Resources CR10",
|
||||
0x0038: u"Natural MicroSystems VBXADPCM",
|
||||
0x0039: u"Crystal Semiconductor IMA ADPCM",
|
||||
0x003A: u"Echo Speech EchoSC3",
|
||||
0x003B: u"Rockwell ADPCM",
|
||||
0x003C: u"Rockwell DigiTalk",
|
||||
0x003D: u"Xebec Multimedia Solutions",
|
||||
0x0040: u"Antex Electronics G.721 ADPCM",
|
||||
0x0041: u"Antex Electronics G.728 CELP",
|
||||
0x0042: u"Intel G.723",
|
||||
0x0043: u"Intel G.723.1",
|
||||
0x0044: u"Intel G.729 Audio",
|
||||
0x0045: u"Sharp G.726 Audio",
|
||||
0x0050: u"Microsoft MPEG-1",
|
||||
0x0052: u"InSoft RT24",
|
||||
0x0053: u"InSoft PAC",
|
||||
0x0055: u"MP3 - MPEG Layer III",
|
||||
0x0059: u"Lucent G.723",
|
||||
0x0060: u"Cirrus Logic",
|
||||
0x0061: u"ESS Technology ESPCM",
|
||||
0x0062: u"Voxware File-Mode",
|
||||
0x0063: u"Canopus Atrac",
|
||||
0x0064: u"APICOM G.726 ADPCM",
|
||||
0x0065: u"APICOM G.722 ADPCM",
|
||||
0x0066: u"Microsoft DSAT",
|
||||
0x0067: u"Microsoft DSAT Display",
|
||||
0x0069: u"Voxware Byte Aligned",
|
||||
0x0070: u"Voxware AC8",
|
||||
0x0071: u"Voxware AC10",
|
||||
0x0072: u"Voxware AC16",
|
||||
0x0073: u"Voxware AC20",
|
||||
0x0074: u"Voxware RT24 MetaVoice",
|
||||
0x0075: u"Voxware RT29 MetaSound",
|
||||
0x0076: u"Voxware RT29HW",
|
||||
0x0077: u"Voxware VR12",
|
||||
0x0078: u"Voxware VR18",
|
||||
0x0079: u"Voxware TQ40",
|
||||
0x007A: u"Voxware SC3",
|
||||
0x007B: u"Voxware SC3",
|
||||
0x0080: u"Softsound",
|
||||
0x0081: u"Voxware TQ60",
|
||||
0x0082: u"Microsoft MSRT24",
|
||||
0x0083: u"AT&T Labs G.729A",
|
||||
0x0084: u"Motion Pixels MVI MV12",
|
||||
0x0085: u"DataFusion Systems G.726",
|
||||
0x0086: u"DataFusion Systems GSM610",
|
||||
0x0088: u"Iterated Systems ISIAudio",
|
||||
0x0089: u"Onlive",
|
||||
0x008A: u"Multitude FT SX20",
|
||||
0x008B: u"Infocom ITS ACM G.721",
|
||||
0x008C: u"Convedia G.729",
|
||||
0x008D: u"Congruency Audio",
|
||||
0x0091: u"Siemens Business Communications SBC24",
|
||||
0x0092: u"Sonic Foundry Dolby AC3 SPDIF",
|
||||
0x0093: u"MediaSonic G.723",
|
||||
0x0094: u"Aculab Prosody 8KBPS",
|
||||
0x0097: u"ZyXEL ADPCM",
|
||||
0x0098: u"Philips LPCBB",
|
||||
0x0099: u"Studer Professional Audio AG Packed",
|
||||
0x00A0: u"Malden Electronics PHONYTALK",
|
||||
0x00A1: u"Racal Recorder GSM",
|
||||
0x00A2: u"Racal Recorder G720.a",
|
||||
0x00A3: u"Racal Recorder G723.1",
|
||||
0x00A4: u"Racal Recorder Tetra ACELP",
|
||||
0x00B0: u"NEC AAC",
|
||||
0x00FF: u"CoreAAC Audio",
|
||||
0x0100: u"Rhetorex ADPCM",
|
||||
0x0101: u"BeCubed Software IRAT",
|
||||
0x0111: u"Vivo G.723",
|
||||
0x0112: u"Vivo Siren",
|
||||
0x0120: u"Philips CELP",
|
||||
0x0121: u"Philips Grundig",
|
||||
0x0123: u"Digital G.723",
|
||||
0x0125: u"Sanyo ADPCM",
|
||||
0x0130: u"Sipro Lab Telecom ACELP.net",
|
||||
0x0131: u"Sipro Lab Telecom ACELP.4800",
|
||||
0x0132: u"Sipro Lab Telecom ACELP.8V3",
|
||||
0x0133: u"Sipro Lab Telecom ACELP.G.729",
|
||||
0x0134: u"Sipro Lab Telecom ACELP.G.729A",
|
||||
0x0135: u"Sipro Lab Telecom ACELP.KELVIN",
|
||||
0x0136: u"VoiceAge AMR",
|
||||
0x0140: u"Dictaphone G.726 ADPCM",
|
||||
0x0141: u"Dictaphone CELP68",
|
||||
0x0142: u"Dictaphone CELP54",
|
||||
0x0150: u"Qualcomm PUREVOICE",
|
||||
0x0151: u"Qualcomm HALFRATE",
|
||||
0x0155: u"Ring Zero Systems TUBGSM",
|
||||
0x0160: u"Windows Media Audio Standard",
|
||||
0x0161: u"Windows Media Audio 9 Standard",
|
||||
0x0162: u"Windows Media Audio 9 Professional",
|
||||
0x0163: u"Windows Media Audio 9 Lossless",
|
||||
0x0164: u"Windows Media Audio Pro over SPDIF",
|
||||
0x0170: u"Unisys NAP ADPCM",
|
||||
0x0171: u"Unisys NAP ULAW",
|
||||
0x0172: u"Unisys NAP ALAW",
|
||||
0x0173: u"Unisys NAP 16K",
|
||||
0x0174: u"Sycom ACM SYC008",
|
||||
0x0175: u"Sycom ACM SYC701 G725",
|
||||
0x0176: u"Sycom ACM SYC701 CELP54",
|
||||
0x0177: u"Sycom ACM SYC701 CELP68",
|
||||
0x0178: u"Knowledge Adventure ADPCM",
|
||||
0x0180: u"Fraunhofer IIS MPEG-2 AAC",
|
||||
0x0190: u"Digital Theater Systems DTS",
|
||||
0x0200: u"Creative Labs ADPCM",
|
||||
0x0202: u"Creative Labs FastSpeech8",
|
||||
0x0203: u"Creative Labs FastSpeech10",
|
||||
0x0210: u"UHER informatic GmbH ADPCM",
|
||||
0x0215: u"Ulead DV Audio",
|
||||
0x0216: u"Ulead DV Audio",
|
||||
0x0220: u"Quarterdeck",
|
||||
0x0230: u"I-link Worldwide ILINK VC",
|
||||
0x0240: u"Aureal Semiconductor RAW SPORT",
|
||||
0x0249: u"Generic Passthru",
|
||||
0x0250: u"Interactive Products HSX",
|
||||
0x0251: u"Interactive Products RPELP",
|
||||
0x0260: u"Consistent Software CS2",
|
||||
0x0270: u"Sony SCX",
|
||||
0x0271: u"Sony SCY",
|
||||
0x0272: u"Sony ATRAC3",
|
||||
0x0273: u"Sony SPC",
|
||||
0x0280: u"Telum Audio",
|
||||
0x0281: u"Telum IA Audio",
|
||||
0x0285: u"Norcom Voice Systems ADPCM",
|
||||
0x0300: u"Fujitsu TOWNS SND",
|
||||
0x0350: u"Micronas SC4 Speech",
|
||||
0x0351: u"Micronas CELP833",
|
||||
0x0400: u"Brooktree BTV Digital",
|
||||
0x0401: u"Intel Music Coder",
|
||||
0x0402: u"Intel Audio",
|
||||
0x0450: u"QDesign Music",
|
||||
0x0500: u"On2 AVC0 Audio",
|
||||
0x0501: u"On2 AVC1 Audio",
|
||||
0x0680: u"AT&T Labs VME VMPCM",
|
||||
0x0681: u"AT&T Labs TPC",
|
||||
0x08AE: u"ClearJump Lightwave Lossless",
|
||||
0x1000: u"Olivetti GSM",
|
||||
0x1001: u"Olivetti ADPCM",
|
||||
0x1002: u"Olivetti CELP",
|
||||
0x1003: u"Olivetti SBC",
|
||||
0x1004: u"Olivetti OPR",
|
||||
0x1100: u"Lernout & Hauspie",
|
||||
0x1101: u"Lernout & Hauspie CELP",
|
||||
0x1102: u"Lernout & Hauspie SBC8",
|
||||
0x1103: u"Lernout & Hauspie SBC12",
|
||||
0x1104: u"Lernout & Hauspie SBC16",
|
||||
0x1400: u"Norris Communication",
|
||||
0x1401: u"ISIAudio",
|
||||
0x1500: u"AT&T Labs Soundspace Music Compression",
|
||||
0x1600: u"Microsoft MPEG ADTS AAC",
|
||||
0x1601: u"Microsoft MPEG RAW AAC",
|
||||
0x1608: u"Nokia MPEG ADTS AAC",
|
||||
0x1609: u"Nokia MPEG RAW AAC",
|
||||
0x181C: u"VoxWare MetaVoice RT24",
|
||||
0x1971: u"Sonic Foundry Lossless",
|
||||
0x1979: u"Innings Telecom ADPCM",
|
||||
0x1FC4: u"NTCSoft ALF2CD ACM",
|
||||
0x2000: u"Dolby AC3",
|
||||
0x2001: u"DTS",
|
||||
0x4143: u"Divio AAC",
|
||||
0x4201: u"Nokia Adaptive Multi-Rate",
|
||||
0x4243: u"Divio G.726",
|
||||
0x4261: u"ITU-T H.261",
|
||||
0x4263: u"ITU-T H.263",
|
||||
0x4264: u"ITU-T H.264",
|
||||
0x674F: u"Ogg Vorbis Mode 1",
|
||||
0x6750: u"Ogg Vorbis Mode 2",
|
||||
0x6751: u"Ogg Vorbis Mode 3",
|
||||
0x676F: u"Ogg Vorbis Mode 1+",
|
||||
0x6770: u"Ogg Vorbis Mode 2+",
|
||||
0x6771: u"Ogg Vorbis Mode 3+",
|
||||
0x7000: u"3COM NBX Audio",
|
||||
0x706D: u"FAAD AAC Audio",
|
||||
0x77A1: u"True Audio Lossless Audio",
|
||||
0x7A21: u"GSM-AMR CBR 3GPP Audio",
|
||||
0x7A22: u"GSM-AMR VBR 3GPP Audio",
|
||||
0xA100: u"Comverse Infosys G723.1",
|
||||
0xA101: u"Comverse Infosys AVQSBC",
|
||||
0xA102: u"Comverse Infosys SBC",
|
||||
0xA103: u"Symbol Technologies G729a",
|
||||
0xA104: u"VoiceAge AMR WB",
|
||||
0xA105: u"Ingenient Technologies G.726",
|
||||
0xA106: u"ISO/MPEG-4 Advanced Audio Coding (AAC)",
|
||||
0xA107: u"Encore Software Ltd's G.726",
|
||||
0xA108: u"ZOLL Medical Corporation ASAO",
|
||||
0xA109: u"Speex Voice",
|
||||
0xA10A: u"Vianix MASC Speech Compression",
|
||||
0xA10B: u"Windows Media 9 Spectrum Analyzer Output",
|
||||
0xA10C: u"Media Foundation Spectrum Analyzer Output",
|
||||
0xA10D: u"GSM 6.10 (Full-Rate) Speech",
|
||||
0xA10E: u"GSM 6.20 (Half-Rate) Speech",
|
||||
0xA10F: u"GSM 6.60 (Enchanced Full-Rate) Speech",
|
||||
0xA110: u"GSM 6.90 (Adaptive Multi-Rate) Speech",
|
||||
0xA111: u"GSM Adaptive Multi-Rate WideBand Speech",
|
||||
0xA112: u"Polycom G.722",
|
||||
0xA113: u"Polycom G.728",
|
||||
0xA114: u"Polycom G.729a",
|
||||
0xA115: u"Polycom Siren",
|
||||
0xA116: u"Global IP Sound ILBC",
|
||||
0xA117: u"Radio Time Time Shifted Radio",
|
||||
0xA118: u"Nice Systems ACA",
|
||||
0xA119: u"Nice Systems ADPCM",
|
||||
0xA11A: u"Vocord Group ITU-T G.721",
|
||||
0xA11B: u"Vocord Group ITU-T G.726",
|
||||
0xA11C: u"Vocord Group ITU-T G.722.1",
|
||||
0xA11D: u"Vocord Group ITU-T G.728",
|
||||
0xA11E: u"Vocord Group ITU-T G.729",
|
||||
0xA11F: u"Vocord Group ITU-T G.729a",
|
||||
0xA120: u"Vocord Group ITU-T G.723.1",
|
||||
0xA121: u"Vocord Group LBC",
|
||||
0xA122: u"Nice G.728",
|
||||
0xA123: u"France Telecom G.729 ACM Audio",
|
||||
0xA124: u"CODIAN Audio",
|
||||
0xCC12: u"Intel YUV12 Codec",
|
||||
0xCFCC: u"Digital Processing Systems Perception Motion JPEG",
|
||||
0xD261: u"DEC H.261",
|
||||
0xD263: u"DEC H.263",
|
||||
0xFFFE: u"Extensible Wave Format",
|
||||
0xFFFF: u"Unregistered",
|
||||
0x0000: "Unknown Wave Format",
|
||||
0x0001: "Microsoft PCM Format",
|
||||
0x0002: "Microsoft ADPCM Format",
|
||||
0x0003: "IEEE Float",
|
||||
0x0004: "Compaq Computer VSELP",
|
||||
0x0005: "IBM CVSD",
|
||||
0x0006: "Microsoft CCITT A-Law",
|
||||
0x0007: "Microsoft CCITT u-Law",
|
||||
0x0008: "Microsoft DTS",
|
||||
0x0009: "Microsoft DRM",
|
||||
0x000A: "Windows Media Audio 9 Voice",
|
||||
0x000B: "Windows Media Audio 10 Voice",
|
||||
0x000C: "OGG Vorbis",
|
||||
0x000D: "FLAC",
|
||||
0x000E: "MOT AMR",
|
||||
0x000F: "Nice Systems IMBE",
|
||||
0x0010: "OKI ADPCM",
|
||||
0x0011: "Intel IMA ADPCM",
|
||||
0x0012: "Videologic MediaSpace ADPCM",
|
||||
0x0013: "Sierra Semiconductor ADPCM",
|
||||
0x0014: "Antex Electronics G.723 ADPCM",
|
||||
0x0015: "DSP Solutions DIGISTD",
|
||||
0x0016: "DSP Solutions DIGIFIX",
|
||||
0x0017: "Dialogic OKI ADPCM",
|
||||
0x0018: "MediaVision ADPCM",
|
||||
0x0019: "Hewlett-Packard CU codec",
|
||||
0x001A: "Hewlett-Packard Dynamic Voice",
|
||||
0x0020: "Yamaha ADPCM",
|
||||
0x0021: "Speech Compression SONARC",
|
||||
0x0022: "DSP Group True Speech",
|
||||
0x0023: "Echo Speech EchoSC1",
|
||||
0x0024: "Ahead Inc. Audiofile AF36",
|
||||
0x0025: "Audio Processing Technology APTX",
|
||||
0x0026: "Ahead Inc. AudioFile AF10",
|
||||
0x0027: "Aculab Prosody 1612",
|
||||
0x0028: "Merging Technologies S.A. LRC",
|
||||
0x0030: "Dolby Labs AC2",
|
||||
0x0031: "Microsoft GSM 6.10",
|
||||
0x0032: "Microsoft MSNAudio",
|
||||
0x0033: "Antex Electronics ADPCME",
|
||||
0x0034: "Control Resources VQLPC",
|
||||
0x0035: "DSP Solutions Digireal",
|
||||
0x0036: "DSP Solutions DigiADPCM",
|
||||
0x0037: "Control Resources CR10",
|
||||
0x0038: "Natural MicroSystems VBXADPCM",
|
||||
0x0039: "Crystal Semiconductor IMA ADPCM",
|
||||
0x003A: "Echo Speech EchoSC3",
|
||||
0x003B: "Rockwell ADPCM",
|
||||
0x003C: "Rockwell DigiTalk",
|
||||
0x003D: "Xebec Multimedia Solutions",
|
||||
0x0040: "Antex Electronics G.721 ADPCM",
|
||||
0x0041: "Antex Electronics G.728 CELP",
|
||||
0x0042: "Intel G.723",
|
||||
0x0043: "Intel G.723.1",
|
||||
0x0044: "Intel G.729 Audio",
|
||||
0x0045: "Sharp G.726 Audio",
|
||||
0x0050: "Microsoft MPEG-1",
|
||||
0x0052: "InSoft RT24",
|
||||
0x0053: "InSoft PAC",
|
||||
0x0055: "MP3 - MPEG Layer III",
|
||||
0x0059: "Lucent G.723",
|
||||
0x0060: "Cirrus Logic",
|
||||
0x0061: "ESS Technology ESPCM",
|
||||
0x0062: "Voxware File-Mode",
|
||||
0x0063: "Canopus Atrac",
|
||||
0x0064: "APICOM G.726 ADPCM",
|
||||
0x0065: "APICOM G.722 ADPCM",
|
||||
0x0066: "Microsoft DSAT",
|
||||
0x0067: "Microsoft DSAT Display",
|
||||
0x0069: "Voxware Byte Aligned",
|
||||
0x0070: "Voxware AC8",
|
||||
0x0071: "Voxware AC10",
|
||||
0x0072: "Voxware AC16",
|
||||
0x0073: "Voxware AC20",
|
||||
0x0074: "Voxware RT24 MetaVoice",
|
||||
0x0075: "Voxware RT29 MetaSound",
|
||||
0x0076: "Voxware RT29HW",
|
||||
0x0077: "Voxware VR12",
|
||||
0x0078: "Voxware VR18",
|
||||
0x0079: "Voxware TQ40",
|
||||
0x007A: "Voxware SC3",
|
||||
0x007B: "Voxware SC3",
|
||||
0x0080: "Softsound",
|
||||
0x0081: "Voxware TQ60",
|
||||
0x0082: "Microsoft MSRT24",
|
||||
0x0083: "AT&T Labs G.729A",
|
||||
0x0084: "Motion Pixels MVI MV12",
|
||||
0x0085: "DataFusion Systems G.726",
|
||||
0x0086: "DataFusion Systems GSM610",
|
||||
0x0088: "Iterated Systems ISIAudio",
|
||||
0x0089: "Onlive",
|
||||
0x008A: "Multitude FT SX20",
|
||||
0x008B: "Infocom ITS ACM G.721",
|
||||
0x008C: "Convedia G.729",
|
||||
0x008D: "Congruency Audio",
|
||||
0x0091: "Siemens Business Communications SBC24",
|
||||
0x0092: "Sonic Foundry Dolby AC3 SPDIF",
|
||||
0x0093: "MediaSonic G.723",
|
||||
0x0094: "Aculab Prosody 8KBPS",
|
||||
0x0097: "ZyXEL ADPCM",
|
||||
0x0098: "Philips LPCBB",
|
||||
0x0099: "Studer Professional Audio AG Packed",
|
||||
0x00A0: "Malden Electronics PHONYTALK",
|
||||
0x00A1: "Racal Recorder GSM",
|
||||
0x00A2: "Racal Recorder G720.a",
|
||||
0x00A3: "Racal Recorder G723.1",
|
||||
0x00A4: "Racal Recorder Tetra ACELP",
|
||||
0x00B0: "NEC AAC",
|
||||
0x00FF: "CoreAAC Audio",
|
||||
0x0100: "Rhetorex ADPCM",
|
||||
0x0101: "BeCubed Software IRAT",
|
||||
0x0111: "Vivo G.723",
|
||||
0x0112: "Vivo Siren",
|
||||
0x0120: "Philips CELP",
|
||||
0x0121: "Philips Grundig",
|
||||
0x0123: "Digital G.723",
|
||||
0x0125: "Sanyo ADPCM",
|
||||
0x0130: "Sipro Lab Telecom ACELP.net",
|
||||
0x0131: "Sipro Lab Telecom ACELP.4800",
|
||||
0x0132: "Sipro Lab Telecom ACELP.8V3",
|
||||
0x0133: "Sipro Lab Telecom ACELP.G.729",
|
||||
0x0134: "Sipro Lab Telecom ACELP.G.729A",
|
||||
0x0135: "Sipro Lab Telecom ACELP.KELVIN",
|
||||
0x0136: "VoiceAge AMR",
|
||||
0x0140: "Dictaphone G.726 ADPCM",
|
||||
0x0141: "Dictaphone CELP68",
|
||||
0x0142: "Dictaphone CELP54",
|
||||
0x0150: "Qualcomm PUREVOICE",
|
||||
0x0151: "Qualcomm HALFRATE",
|
||||
0x0155: "Ring Zero Systems TUBGSM",
|
||||
0x0160: "Windows Media Audio Standard",
|
||||
0x0161: "Windows Media Audio 9 Standard",
|
||||
0x0162: "Windows Media Audio 9 Professional",
|
||||
0x0163: "Windows Media Audio 9 Lossless",
|
||||
0x0164: "Windows Media Audio Pro over SPDIF",
|
||||
0x0170: "Unisys NAP ADPCM",
|
||||
0x0171: "Unisys NAP ULAW",
|
||||
0x0172: "Unisys NAP ALAW",
|
||||
0x0173: "Unisys NAP 16K",
|
||||
0x0174: "Sycom ACM SYC008",
|
||||
0x0175: "Sycom ACM SYC701 G725",
|
||||
0x0176: "Sycom ACM SYC701 CELP54",
|
||||
0x0177: "Sycom ACM SYC701 CELP68",
|
||||
0x0178: "Knowledge Adventure ADPCM",
|
||||
0x0180: "Fraunhofer IIS MPEG-2 AAC",
|
||||
0x0190: "Digital Theater Systems DTS",
|
||||
0x0200: "Creative Labs ADPCM",
|
||||
0x0202: "Creative Labs FastSpeech8",
|
||||
0x0203: "Creative Labs FastSpeech10",
|
||||
0x0210: "UHER informatic GmbH ADPCM",
|
||||
0x0215: "Ulead DV Audio",
|
||||
0x0216: "Ulead DV Audio",
|
||||
0x0220: "Quarterdeck",
|
||||
0x0230: "I-link Worldwide ILINK VC",
|
||||
0x0240: "Aureal Semiconductor RAW SPORT",
|
||||
0x0249: "Generic Passthru",
|
||||
0x0250: "Interactive Products HSX",
|
||||
0x0251: "Interactive Products RPELP",
|
||||
0x0260: "Consistent Software CS2",
|
||||
0x0270: "Sony SCX",
|
||||
0x0271: "Sony SCY",
|
||||
0x0272: "Sony ATRAC3",
|
||||
0x0273: "Sony SPC",
|
||||
0x0280: "Telum Audio",
|
||||
0x0281: "Telum IA Audio",
|
||||
0x0285: "Norcom Voice Systems ADPCM",
|
||||
0x0300: "Fujitsu TOWNS SND",
|
||||
0x0350: "Micronas SC4 Speech",
|
||||
0x0351: "Micronas CELP833",
|
||||
0x0400: "Brooktree BTV Digital",
|
||||
0x0401: "Intel Music Coder",
|
||||
0x0402: "Intel Audio",
|
||||
0x0450: "QDesign Music",
|
||||
0x0500: "On2 AVC0 Audio",
|
||||
0x0501: "On2 AVC1 Audio",
|
||||
0x0680: "AT&T Labs VME VMPCM",
|
||||
0x0681: "AT&T Labs TPC",
|
||||
0x08AE: "ClearJump Lightwave Lossless",
|
||||
0x1000: "Olivetti GSM",
|
||||
0x1001: "Olivetti ADPCM",
|
||||
0x1002: "Olivetti CELP",
|
||||
0x1003: "Olivetti SBC",
|
||||
0x1004: "Olivetti OPR",
|
||||
0x1100: "Lernout & Hauspie",
|
||||
0x1101: "Lernout & Hauspie CELP",
|
||||
0x1102: "Lernout & Hauspie SBC8",
|
||||
0x1103: "Lernout & Hauspie SBC12",
|
||||
0x1104: "Lernout & Hauspie SBC16",
|
||||
0x1400: "Norris Communication",
|
||||
0x1401: "ISIAudio",
|
||||
0x1500: "AT&T Labs Soundspace Music Compression",
|
||||
0x1600: "Microsoft MPEG ADTS AAC",
|
||||
0x1601: "Microsoft MPEG RAW AAC",
|
||||
0x1608: "Nokia MPEG ADTS AAC",
|
||||
0x1609: "Nokia MPEG RAW AAC",
|
||||
0x181C: "VoxWare MetaVoice RT24",
|
||||
0x1971: "Sonic Foundry Lossless",
|
||||
0x1979: "Innings Telecom ADPCM",
|
||||
0x1FC4: "NTCSoft ALF2CD ACM",
|
||||
0x2000: "Dolby AC3",
|
||||
0x2001: "DTS",
|
||||
0x4143: "Divio AAC",
|
||||
0x4201: "Nokia Adaptive Multi-Rate",
|
||||
0x4243: "Divio G.726",
|
||||
0x4261: "ITU-T H.261",
|
||||
0x4263: "ITU-T H.263",
|
||||
0x4264: "ITU-T H.264",
|
||||
0x674F: "Ogg Vorbis Mode 1",
|
||||
0x6750: "Ogg Vorbis Mode 2",
|
||||
0x6751: "Ogg Vorbis Mode 3",
|
||||
0x676F: "Ogg Vorbis Mode 1+",
|
||||
0x6770: "Ogg Vorbis Mode 2+",
|
||||
0x6771: "Ogg Vorbis Mode 3+",
|
||||
0x7000: "3COM NBX Audio",
|
||||
0x706D: "FAAD AAC Audio",
|
||||
0x77A1: "True Audio Lossless Audio",
|
||||
0x7A21: "GSM-AMR CBR 3GPP Audio",
|
||||
0x7A22: "GSM-AMR VBR 3GPP Audio",
|
||||
0xA100: "Comverse Infosys G723.1",
|
||||
0xA101: "Comverse Infosys AVQSBC",
|
||||
0xA102: "Comverse Infosys SBC",
|
||||
0xA103: "Symbol Technologies G729a",
|
||||
0xA104: "VoiceAge AMR WB",
|
||||
0xA105: "Ingenient Technologies G.726",
|
||||
0xA106: "ISO/MPEG-4 Advanced Audio Coding (AAC)",
|
||||
0xA107: "Encore Software Ltd's G.726",
|
||||
0xA108: "ZOLL Medical Corporation ASAO",
|
||||
0xA109: "Speex Voice",
|
||||
0xA10A: "Vianix MASC Speech Compression",
|
||||
0xA10B: "Windows Media 9 Spectrum Analyzer Output",
|
||||
0xA10C: "Media Foundation Spectrum Analyzer Output",
|
||||
0xA10D: "GSM 6.10 (Full-Rate) Speech",
|
||||
0xA10E: "GSM 6.20 (Half-Rate) Speech",
|
||||
0xA10F: "GSM 6.60 (Enchanced Full-Rate) Speech",
|
||||
0xA110: "GSM 6.90 (Adaptive Multi-Rate) Speech",
|
||||
0xA111: "GSM Adaptive Multi-Rate WideBand Speech",
|
||||
0xA112: "Polycom G.722",
|
||||
0xA113: "Polycom G.728",
|
||||
0xA114: "Polycom G.729a",
|
||||
0xA115: "Polycom Siren",
|
||||
0xA116: "Global IP Sound ILBC",
|
||||
0xA117: "Radio Time Time Shifted Radio",
|
||||
0xA118: "Nice Systems ACA",
|
||||
0xA119: "Nice Systems ADPCM",
|
||||
0xA11A: "Vocord Group ITU-T G.721",
|
||||
0xA11B: "Vocord Group ITU-T G.726",
|
||||
0xA11C: "Vocord Group ITU-T G.722.1",
|
||||
0xA11D: "Vocord Group ITU-T G.728",
|
||||
0xA11E: "Vocord Group ITU-T G.729",
|
||||
0xA11F: "Vocord Group ITU-T G.729a",
|
||||
0xA120: "Vocord Group ITU-T G.723.1",
|
||||
0xA121: "Vocord Group LBC",
|
||||
0xA122: "Nice G.728",
|
||||
0xA123: "France Telecom G.729 ACM Audio",
|
||||
0xA124: "CODIAN Audio",
|
||||
0xCC12: "Intel YUV12 Codec",
|
||||
0xCFCC: "Digital Processing Systems Perception Motion JPEG",
|
||||
0xD261: "DEC H.261",
|
||||
0xD263: "DEC H.263",
|
||||
0xFFFE: "Extensible Wave Format",
|
||||
0xFFFF: "Unregistered",
|
||||
}
|
||||
|
||||
+6
-6
@@ -90,8 +90,8 @@ class DSDChunk(DSFChunk):
|
||||
self.fileobj.write(f.getvalue())
|
||||
|
||||
def pprint(self):
|
||||
return (u"DSD Chunk (Total file size = %d, "
|
||||
u"Pointer to Metadata chunk = %d)" % (
|
||||
return ("DSD Chunk (Total file size = %d, "
|
||||
"Pointer to Metadata chunk = %d)" % (
|
||||
self.total_size, self.offset_metdata_chunk))
|
||||
|
||||
|
||||
@@ -148,8 +148,8 @@ class FormatChunk(DSFChunk):
|
||||
self.sample_count = cdata.ulonglong_le(data[36:44])
|
||||
|
||||
def pprint(self):
|
||||
return u"fmt Chunk (Channel Type = %d, Channel Num = %d, " \
|
||||
u"Sampling Frequency = %d, %.2f seconds)" % \
|
||||
return "fmt Chunk (Channel Type = %d, Channel Num = %d, " \
|
||||
"Sampling Frequency = %d, %.2f seconds)" % \
|
||||
(self.channel_type, self.channel_num, self.sampling_frequency,
|
||||
self.length)
|
||||
|
||||
@@ -181,7 +181,7 @@ class DataChunk(DSFChunk):
|
||||
raise error("DSF data header size mismatch")
|
||||
|
||||
def pprint(self):
|
||||
return u"data Chunk (Chunk Offset = %d, Chunk Size = %d)" % (
|
||||
return "data Chunk (Chunk Offset = %d, Chunk Size = %d)" % (
|
||||
self.chunk_offset, self.chunk_size)
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ class DSFInfo(StreamInfo):
|
||||
return self.sample_rate * self.bits_per_sample * self.channels
|
||||
|
||||
def pprint(self):
|
||||
return u"%d channel DSF @ %d bits, %s Hz, %.2f seconds" % (
|
||||
return "%d channel DSF @ %d bits, %s Hz, %.2f seconds" % (
|
||||
self.channels, self.bits_per_sample, self.sample_rate, self.length)
|
||||
|
||||
|
||||
|
||||
+25
-25
@@ -153,7 +153,7 @@ class EasyID3(DictMixin, Metadata):
|
||||
enc = 0
|
||||
# Store 8859-1 if we can, per MusicBrainz spec.
|
||||
for v in value:
|
||||
if v and max(v) > u'\x7f':
|
||||
if v and max(v) > '\x7f':
|
||||
enc = 3
|
||||
break
|
||||
|
||||
@@ -215,7 +215,7 @@ class EasyID3(DictMixin, Metadata):
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if PY2:
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, str):
|
||||
value = [value]
|
||||
else:
|
||||
if isinstance(value, text_type):
|
||||
@@ -235,7 +235,7 @@ class EasyID3(DictMixin, Metadata):
|
||||
|
||||
def keys(self):
|
||||
keys = []
|
||||
for key in self.Get.keys():
|
||||
for key in list(self.Get.keys()):
|
||||
if key in self.List:
|
||||
keys.extend(self.List[key](self.__id3, key))
|
||||
elif key in self:
|
||||
@@ -398,7 +398,7 @@ def gain_get(id3, key):
|
||||
except KeyError:
|
||||
raise EasyID3KeyError(key)
|
||||
else:
|
||||
return [u"%+f dB" % frame.gain]
|
||||
return ["%+f dB" % frame.gain]
|
||||
|
||||
|
||||
def gain_set(id3, key, value):
|
||||
@@ -432,7 +432,7 @@ def peak_get(id3, key):
|
||||
except KeyError:
|
||||
raise EasyID3KeyError(key)
|
||||
else:
|
||||
return [u"%f" % frame.peak]
|
||||
return ["%f" % frame.peak]
|
||||
|
||||
|
||||
def peak_set(id3, key, value):
|
||||
@@ -520,26 +520,26 @@ EasyID3.RegisterKey("replaygain_*_peak", peak_get, peak_set, peak_delete)
|
||||
# http://bugs.musicbrainz.org/ticket/1383
|
||||
# http://musicbrainz.org/doc/MusicBrainzTag
|
||||
for desc, key in iteritems({
|
||||
u"MusicBrainz Artist Id": "musicbrainz_artistid",
|
||||
u"MusicBrainz Album Id": "musicbrainz_albumid",
|
||||
u"MusicBrainz Album Artist Id": "musicbrainz_albumartistid",
|
||||
u"MusicBrainz TRM Id": "musicbrainz_trmid",
|
||||
u"MusicIP PUID": "musicip_puid",
|
||||
u"MusicMagic Fingerprint": "musicip_fingerprint",
|
||||
u"MusicBrainz Album Status": "musicbrainz_albumstatus",
|
||||
u"MusicBrainz Album Type": "musicbrainz_albumtype",
|
||||
u"MusicBrainz Album Release Country": "releasecountry",
|
||||
u"MusicBrainz Disc Id": "musicbrainz_discid",
|
||||
u"ASIN": "asin",
|
||||
u"ALBUMARTISTSORT": "albumartistsort",
|
||||
u"PERFORMER": "performer",
|
||||
u"BARCODE": "barcode",
|
||||
u"CATALOGNUMBER": "catalognumber",
|
||||
u"MusicBrainz Release Track Id": "musicbrainz_releasetrackid",
|
||||
u"MusicBrainz Release Group Id": "musicbrainz_releasegroupid",
|
||||
u"MusicBrainz Work Id": "musicbrainz_workid",
|
||||
u"Acoustid Fingerprint": "acoustid_fingerprint",
|
||||
u"Acoustid Id": "acoustid_id",
|
||||
"MusicBrainz Artist Id": "musicbrainz_artistid",
|
||||
"MusicBrainz Album Id": "musicbrainz_albumid",
|
||||
"MusicBrainz Album Artist Id": "musicbrainz_albumartistid",
|
||||
"MusicBrainz TRM Id": "musicbrainz_trmid",
|
||||
"MusicIP PUID": "musicip_puid",
|
||||
"MusicMagic Fingerprint": "musicip_fingerprint",
|
||||
"MusicBrainz Album Status": "musicbrainz_albumstatus",
|
||||
"MusicBrainz Album Type": "musicbrainz_albumtype",
|
||||
"MusicBrainz Album Release Country": "releasecountry",
|
||||
"MusicBrainz Disc Id": "musicbrainz_discid",
|
||||
"ASIN": "asin",
|
||||
"ALBUMARTISTSORT": "albumartistsort",
|
||||
"PERFORMER": "performer",
|
||||
"BARCODE": "barcode",
|
||||
"CATALOGNUMBER": "catalognumber",
|
||||
"MusicBrainz Release Track Id": "musicbrainz_releasetrackid",
|
||||
"MusicBrainz Release Group Id": "musicbrainz_releasegroupid",
|
||||
"MusicBrainz Work Id": "musicbrainz_workid",
|
||||
"Acoustid Fingerprint": "acoustid_fingerprint",
|
||||
"Acoustid Id": "acoustid_id",
|
||||
}):
|
||||
EasyID3.RegisterTXXXKey(key, desc)
|
||||
|
||||
|
||||
+11
-11
@@ -121,7 +121,7 @@ class EasyMP4Tags(DictMixin, Tags):
|
||||
ret = []
|
||||
for (track, total) in tags[atomid]:
|
||||
if total:
|
||||
ret.append(u"%d/%d" % (track, total))
|
||||
ret.append("%d/%d" % (track, total))
|
||||
else:
|
||||
ret.append(text_type(track))
|
||||
return ret
|
||||
@@ -188,7 +188,7 @@ class EasyMP4Tags(DictMixin, Tags):
|
||||
key = key.lower()
|
||||
|
||||
if PY2:
|
||||
if isinstance(value, basestring):
|
||||
if isinstance(value, str):
|
||||
value = [value]
|
||||
else:
|
||||
if isinstance(value, text_type):
|
||||
@@ -210,7 +210,7 @@ class EasyMP4Tags(DictMixin, Tags):
|
||||
|
||||
def keys(self):
|
||||
keys = []
|
||||
for key in self.Get.keys():
|
||||
for key in list(self.Get.keys()):
|
||||
if key in self.List:
|
||||
keys.extend(self.List[key](self.__mp4, key))
|
||||
elif key in self:
|
||||
@@ -226,7 +226,7 @@ class EasyMP4Tags(DictMixin, Tags):
|
||||
strings.append("%s=%s" % (key, value))
|
||||
return "\n".join(strings)
|
||||
|
||||
for atomid, key in {
|
||||
for atomid, key in list({
|
||||
'\xa9nam': 'title',
|
||||
'\xa9alb': 'album',
|
||||
'\xa9ART': 'artist',
|
||||
@@ -242,10 +242,10 @@ for atomid, key in {
|
||||
'soar': 'artistsort',
|
||||
'sonm': 'titlesort',
|
||||
'soco': 'composersort',
|
||||
}.items():
|
||||
}.items()):
|
||||
EasyMP4Tags.RegisterTextKey(key, atomid)
|
||||
|
||||
for name, key in {
|
||||
for name, key in list({
|
||||
'MusicBrainz Artist Id': 'musicbrainz_artistid',
|
||||
'MusicBrainz Track Id': 'musicbrainz_trackid',
|
||||
'MusicBrainz Album Id': 'musicbrainz_albumid',
|
||||
@@ -254,18 +254,18 @@ for name, key in {
|
||||
'MusicBrainz Album Status': 'musicbrainz_albumstatus',
|
||||
'MusicBrainz Album Type': 'musicbrainz_albumtype',
|
||||
'MusicBrainz Release Country': 'releasecountry',
|
||||
}.items():
|
||||
}.items()):
|
||||
EasyMP4Tags.RegisterFreeformKey(key, name)
|
||||
|
||||
for name, key in {
|
||||
for name, key in list({
|
||||
"tmpo": "bpm",
|
||||
}.items():
|
||||
}.items()):
|
||||
EasyMP4Tags.RegisterIntKey(key, name)
|
||||
|
||||
for name, key in {
|
||||
for name, key in list({
|
||||
"trkn": "tracknumber",
|
||||
"disk": "discnumber",
|
||||
}.items():
|
||||
}.items()):
|
||||
EasyMP4Tags.RegisterIntPairKey(key, name)
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -259,7 +259,7 @@ class StreamInfo(MetadataBlock, mutagen.StreamInfo):
|
||||
return f.getvalue()
|
||||
|
||||
def pprint(self):
|
||||
return u"FLAC, %.2f seconds, %d Hz" % (self.length, self.sample_rate)
|
||||
return "FLAC, %.2f seconds, %d Hz" % (self.length, self.sample_rate)
|
||||
|
||||
|
||||
class SeekPoint(tuple):
|
||||
@@ -484,7 +484,7 @@ class CueSheet(MetadataBlock):
|
||||
self.lead_in_samples = lead_in_samples
|
||||
self.compact_disc = bool(flags & 0x80)
|
||||
self.tracks = []
|
||||
for i in xrange(num_tracks):
|
||||
for i in range(num_tracks):
|
||||
track = data.read(self.__CUESHEET_TRACK_SIZE)
|
||||
start_offset, track_number, isrc_padded, flags, num_indexes = \
|
||||
struct.unpack(self.__CUESHEET_TRACK_FORMAT, track)
|
||||
@@ -493,7 +493,7 @@ class CueSheet(MetadataBlock):
|
||||
pre_emphasis = bool(flags & 0x40)
|
||||
val = CueSheetTrack(
|
||||
track_number, start_offset, isrc, type_, pre_emphasis)
|
||||
for j in xrange(num_indexes):
|
||||
for j in range(num_indexes):
|
||||
index = data.read(self.__CUESHEET_TRACKINDEX_SIZE)
|
||||
index_offset, index_number = struct.unpack(
|
||||
self.__CUESHEET_TRACKINDEX_FORMAT, index)
|
||||
@@ -574,8 +574,8 @@ class Picture(MetadataBlock):
|
||||
|
||||
def __init__(self, data=None):
|
||||
self.type = 0
|
||||
self.mime = u''
|
||||
self.desc = u''
|
||||
self.mime = ''
|
||||
self.desc = ''
|
||||
self.width = 0
|
||||
self.height = 0
|
||||
self.depth = 0
|
||||
|
||||
@@ -154,7 +154,7 @@ class ID3(ID3Tags, mutagen.Metadata):
|
||||
raise
|
||||
|
||||
self.version = ID3Header._V11
|
||||
for v in frames.values():
|
||||
for v in list(frames.values()):
|
||||
self.add(v)
|
||||
else:
|
||||
# XXX: attach to the header object so we have it in spec parsing..
|
||||
@@ -352,7 +352,7 @@ class ID3FileType(mutagen.FileType):
|
||||
|
||||
@staticmethod
|
||||
def pprint():
|
||||
return u"Unknown format with ID3 tag"
|
||||
return "Unknown format with ID3 tag"
|
||||
|
||||
@staticmethod
|
||||
def score(filename, fileobj, header_data):
|
||||
|
||||
+29
-29
@@ -61,7 +61,7 @@ class Frame(object):
|
||||
# ask the sub class to fill in our data
|
||||
other._to_other(self)
|
||||
else:
|
||||
for checker, val in izip(self._framespec, args):
|
||||
for checker, val in zip(self._framespec, args):
|
||||
setattr(self, checker.name, val)
|
||||
for checker in self._framespec[len(args):]:
|
||||
setattr(self, checker.name,
|
||||
@@ -329,11 +329,11 @@ class CHAP(Frame):
|
||||
__hash__ = Frame.__hash__
|
||||
|
||||
def _pprint(self):
|
||||
frame_pprint = u""
|
||||
frame_pprint = ""
|
||||
for frame in itervalues(self.sub_frames):
|
||||
for line in frame.pprint().splitlines():
|
||||
frame_pprint += "\n" + " " * 4 + line
|
||||
return u"%s time=%d..%d offset=%d..%d%s" % (
|
||||
return "%s time=%d..%d offset=%d..%d%s" % (
|
||||
self.element_id, self.start_time, self.end_time,
|
||||
self.start_offset, self.end_offset, frame_pprint)
|
||||
|
||||
@@ -368,13 +368,13 @@ class CTOC(Frame):
|
||||
self.child_element_ids == other.child_element_ids
|
||||
|
||||
def _pprint(self):
|
||||
frame_pprint = u""
|
||||
frame_pprint = ""
|
||||
if getattr(self, "sub_frames", None):
|
||||
frame_pprint += "\n" + "\n".join(
|
||||
[" " * 4 + f.pprint() for f in self.sub_frames.values()])
|
||||
return u"%s flags=%d child_element_ids=%s%s" % (
|
||||
[" " * 4 + f.pprint() for f in list(self.sub_frames.values())])
|
||||
return "%s flags=%d child_element_ids=%s%s" % (
|
||||
self.element_id, int(self.flags),
|
||||
u",".join(self.child_element_ids), frame_pprint)
|
||||
",".join(self.child_element_ids), frame_pprint)
|
||||
|
||||
|
||||
@swap_to_string
|
||||
@@ -395,14 +395,14 @@ class TextFrame(Frame):
|
||||
|
||||
_framespec = [
|
||||
EncodingSpec('encoding', default=Encoding.UTF16),
|
||||
MultiSpec('text', EncodedTextSpec('text'), sep=u'\u0000', default=[]),
|
||||
MultiSpec('text', EncodedTextSpec('text'), sep='\u0000', default=[]),
|
||||
]
|
||||
|
||||
def __bytes__(self):
|
||||
return text_type(self).encode('utf-8')
|
||||
|
||||
def __str__(self):
|
||||
return u'\u0000'.join(self.text)
|
||||
return '\u0000'.join(self.text)
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, bytes):
|
||||
@@ -451,7 +451,7 @@ class NumericTextFrame(TextFrame):
|
||||
|
||||
_framespec = [
|
||||
EncodingSpec('encoding', default=Encoding.UTF16),
|
||||
MultiSpec('text', EncodedNumericTextSpec('text'), sep=u'\u0000',
|
||||
MultiSpec('text', EncodedNumericTextSpec('text'), sep='\u0000',
|
||||
default=[]),
|
||||
]
|
||||
|
||||
@@ -472,7 +472,7 @@ class NumericPartTextFrame(TextFrame):
|
||||
|
||||
_framespec = [
|
||||
EncodingSpec('encoding', default=Encoding.UTF16),
|
||||
MultiSpec('text', EncodedNumericPartTextSpec('text'), sep=u'\u0000',
|
||||
MultiSpec('text', EncodedNumericPartTextSpec('text'), sep='\u0000',
|
||||
default=[]),
|
||||
]
|
||||
|
||||
@@ -490,17 +490,17 @@ class TimeStampTextFrame(TextFrame):
|
||||
|
||||
_framespec = [
|
||||
EncodingSpec('encoding', default=Encoding.UTF16),
|
||||
MultiSpec('text', TimeStampSpec('stamp'), sep=u',', default=[]),
|
||||
MultiSpec('text', TimeStampSpec('stamp'), sep=',', default=[]),
|
||||
]
|
||||
|
||||
def __bytes__(self):
|
||||
return text_type(self).encode('utf-8')
|
||||
|
||||
def __str__(self):
|
||||
return u','.join([stamp.text for stamp in self.text])
|
||||
return ','.join([stamp.text for stamp in self.text])
|
||||
|
||||
def _pprint(self):
|
||||
return u" / ".join([stamp.text for stamp in self.text])
|
||||
return " / ".join([stamp.text for stamp in self.text])
|
||||
|
||||
|
||||
@swap_to_string
|
||||
@@ -574,11 +574,11 @@ class TCON(TextFrame):
|
||||
try:
|
||||
genres.append(self.GENRES[int(value)])
|
||||
except IndexError:
|
||||
genres.append(u"Unknown")
|
||||
genres.append("Unknown")
|
||||
elif value == "CR":
|
||||
genres.append(u"Cover")
|
||||
genres.append("Cover")
|
||||
elif value == "RX":
|
||||
genres.append(u"Remix")
|
||||
genres.append("Remix")
|
||||
elif value:
|
||||
newgenres = []
|
||||
genreid, dummy, genrename = genre_re.match(value).groups()
|
||||
@@ -589,11 +589,11 @@ class TCON(TextFrame):
|
||||
gid = text_type(self.GENRES[int(gid)])
|
||||
newgenres.append(gid)
|
||||
elif gid == "CR":
|
||||
newgenres.append(u"Cover")
|
||||
newgenres.append("Cover")
|
||||
elif gid == "RX":
|
||||
newgenres.append(u"Remix")
|
||||
newgenres.append("Remix")
|
||||
else:
|
||||
newgenres.append(u"Unknown")
|
||||
newgenres.append("Unknown")
|
||||
|
||||
if genrename:
|
||||
# "Unescaping" the first parenthesis
|
||||
@@ -860,7 +860,7 @@ class TXXX(TextFrame):
|
||||
_framespec = [
|
||||
EncodingSpec('encoding'),
|
||||
EncodedTextSpec('desc'),
|
||||
MultiSpec('text', EncodedTextSpec('text'), sep=u'\u0000', default=[]),
|
||||
MultiSpec('text', EncodedTextSpec('text'), sep='\u0000', default=[]),
|
||||
]
|
||||
|
||||
@property
|
||||
@@ -1045,7 +1045,7 @@ class USLT(Frame):
|
||||
|
||||
_framespec = [
|
||||
EncodingSpec('encoding', default=Encoding.UTF16),
|
||||
StringSpec('lang', length=3, default=u"XXX"),
|
||||
StringSpec('lang', length=3, default="XXX"),
|
||||
EncodedTextSpec('desc'),
|
||||
EncodedTextSpec('text'),
|
||||
]
|
||||
@@ -1072,7 +1072,7 @@ class SYLT(Frame):
|
||||
|
||||
_framespec = [
|
||||
EncodingSpec('encoding'),
|
||||
StringSpec('lang', length=3, default=u"XXX"),
|
||||
StringSpec('lang', length=3, default="XXX"),
|
||||
ByteSpec('format', default=1),
|
||||
ByteSpec('type', default=0),
|
||||
EncodedTextSpec('desc'),
|
||||
@@ -1089,7 +1089,7 @@ class SYLT(Frame):
|
||||
__hash__ = Frame.__hash__
|
||||
|
||||
def __str__(self):
|
||||
return u"".join(text for (text, time) in self.text)
|
||||
return "".join(text for (text, time) in self.text)
|
||||
|
||||
def __bytes__(self):
|
||||
return text_type(self).encode("utf-8")
|
||||
@@ -1106,7 +1106,7 @@ class COMM(TextFrame):
|
||||
EncodingSpec('encoding'),
|
||||
StringSpec('lang', length=3, default="XXX"),
|
||||
EncodedTextSpec('desc'),
|
||||
MultiSpec('text', EncodedTextSpec('text'), sep=u'\u0000', default=[]),
|
||||
MultiSpec('text', EncodedTextSpec('text'), sep='\u0000', default=[]),
|
||||
]
|
||||
|
||||
@property
|
||||
@@ -1263,7 +1263,7 @@ class APIC(Frame):
|
||||
return '%s:%s' % (self.FrameID, self.desc)
|
||||
|
||||
def _merge_frame(self, other):
|
||||
other.desc += u" "
|
||||
other.desc += " "
|
||||
return other
|
||||
|
||||
def _pprint(self):
|
||||
@@ -1550,7 +1550,7 @@ class USER(Frame):
|
||||
|
||||
_framespec = [
|
||||
EncodingSpec('encoding'),
|
||||
StringSpec('lang', length=3, default=u"XXX"),
|
||||
StringSpec('lang', length=3, default="XXX"),
|
||||
EncodedTextSpec('text'),
|
||||
]
|
||||
|
||||
@@ -1580,7 +1580,7 @@ class OWNE(Frame):
|
||||
_framespec = [
|
||||
EncodingSpec('encoding'),
|
||||
Latin1TextSpec('price'),
|
||||
StringSpec('date', length=8, default=u"19700101"),
|
||||
StringSpec('date', length=8, default="19700101"),
|
||||
EncodedTextSpec('seller'),
|
||||
]
|
||||
|
||||
@@ -1602,7 +1602,7 @@ class COMR(Frame):
|
||||
_framespec = [
|
||||
EncodingSpec('encoding'),
|
||||
Latin1TextSpec('price'),
|
||||
StringSpec('valid_until', length=8, default=u"19700101"),
|
||||
StringSpec('valid_until', length=8, default="19700101"),
|
||||
Latin1TextSpec('contact'),
|
||||
ByteSpec('format', default=0),
|
||||
EncodedTextSpec('seller'),
|
||||
|
||||
@@ -94,8 +94,8 @@ def ParseID3v1(data):
|
||||
def fix(data):
|
||||
return data.split(b"\x00")[0].strip().decode('latin1')
|
||||
|
||||
title, artist, album, year, comment = map(
|
||||
fix, [title, artist, album, year, comment])
|
||||
title, artist, album, year, comment = list(map(
|
||||
fix, [title, artist, album, year, comment]))
|
||||
|
||||
frames = {}
|
||||
if title:
|
||||
@@ -123,8 +123,8 @@ def MakeID3v1(id3):
|
||||
|
||||
v1 = {}
|
||||
|
||||
for v2id, name in {"TIT2": "title", "TPE1": "artist",
|
||||
"TALB": "album"}.items():
|
||||
for v2id, name in list({"TIT2": "title", "TPE1": "artist",
|
||||
"TALB": "album"}.items()):
|
||||
if v2id in id3:
|
||||
text = id3[v2id].text[0].encode('latin1', 'replace')[:30]
|
||||
else:
|
||||
|
||||
+12
-12
@@ -278,7 +278,7 @@ class StringSpec(Spec):
|
||||
|
||||
def __init__(self, name, length, default=None):
|
||||
if default is None:
|
||||
default = u" " * length
|
||||
default = " " * length
|
||||
super(StringSpec, self).__init__(name, default)
|
||||
self.len = length
|
||||
|
||||
@@ -402,7 +402,7 @@ class RVASpec(Spec):
|
||||
class FrameIDSpec(StringSpec):
|
||||
|
||||
def __init__(self, name, length):
|
||||
super(FrameIDSpec, self).__init__(name, length, u"X" * length)
|
||||
super(FrameIDSpec, self).__init__(name, length, "X" * length)
|
||||
|
||||
def validate(self, frame, value):
|
||||
value = super(FrameIDSpec, self).validate(frame, value)
|
||||
@@ -464,7 +464,7 @@ class EncodedTextSpec(Spec):
|
||||
Encoding.UTF8: ('utf8', b'\x00'),
|
||||
}
|
||||
|
||||
def __init__(self, name, default=u""):
|
||||
def __init__(self, name, default=""):
|
||||
super(EncodedTextSpec, self).__init__(name, default)
|
||||
|
||||
def read(self, header, frame, data):
|
||||
@@ -522,7 +522,7 @@ class MultiSpec(Spec):
|
||||
data.append(self.specs[0].write(config, frame, v))
|
||||
else:
|
||||
for record in value:
|
||||
for v, s in izip(record, self.specs):
|
||||
for v, s in zip(record, self.specs):
|
||||
data.append(s.write(config, frame, v))
|
||||
return b''.join(data)
|
||||
|
||||
@@ -534,14 +534,14 @@ class MultiSpec(Spec):
|
||||
return [self.specs[0].validate(frame, v) for v in value]
|
||||
else:
|
||||
return [
|
||||
[s.validate(frame, v) for (v, s) in izip(val, self.specs)]
|
||||
[s.validate(frame, v) for (v, s) in zip(val, self.specs)]
|
||||
for val in value]
|
||||
raise ValueError('Invalid MultiSpec data: %r' % value)
|
||||
|
||||
def _validate23(self, frame, value, **kwargs):
|
||||
if len(self.specs) != 1:
|
||||
return [[s._validate23(frame, v, **kwargs)
|
||||
for (v, s) in izip(val, self.specs)]
|
||||
for (v, s) in zip(val, self.specs)]
|
||||
for val in value]
|
||||
|
||||
spec = self.specs[0]
|
||||
@@ -568,7 +568,7 @@ class EncodedNumericPartTextSpec(EncodedTextSpec):
|
||||
|
||||
class Latin1TextSpec(Spec):
|
||||
|
||||
def __init__(self, name, default=u""):
|
||||
def __init__(self, name, default=""):
|
||||
super(Latin1TextSpec, self).__init__(name, default)
|
||||
|
||||
def read(self, header, frame, data):
|
||||
@@ -602,7 +602,7 @@ class ID3FramesSpec(Spec):
|
||||
from ._tags import ID3Tags
|
||||
|
||||
v = ID3Tags()
|
||||
for frame in value.values():
|
||||
for frame in list(value.values()):
|
||||
v.add(frame._get_v23_frame(**kwargs))
|
||||
return v
|
||||
|
||||
@@ -632,7 +632,7 @@ class Latin1TextListSpec(Spec):
|
||||
def read(self, header, frame, data):
|
||||
count, data = self._bspec.read(header, frame, data)
|
||||
entries = []
|
||||
for i in xrange(count):
|
||||
for i in range(count):
|
||||
entry, data = self._lspec.read(header, frame, data)
|
||||
entries.append(entry)
|
||||
return entries, data
|
||||
@@ -683,7 +683,7 @@ class ID3TimeStamp(object):
|
||||
if part is None:
|
||||
break
|
||||
pieces.append(self.__formats[i] % part + self.__seps[i])
|
||||
return u''.join(pieces)[:-1]
|
||||
return ''.join(pieces)[:-1]
|
||||
|
||||
def set_text(self, text, splitre=re.compile('[-T:/.]|\s+')):
|
||||
year, month, day, hour, minute, second = \
|
||||
@@ -736,7 +736,7 @@ class TimeStampSpec(EncodedTextSpec):
|
||||
|
||||
class ChannelSpec(ByteSpec):
|
||||
(OTHER, MASTER, FRONTRIGHT, FRONTLEFT, BACKRIGHT, BACKLEFT, FRONTCENTRE,
|
||||
BACKCENTRE, SUBWOOFER) = xrange(9)
|
||||
BACKCENTRE, SUBWOOFER) = range(9)
|
||||
|
||||
|
||||
class VolumeAdjustmentSpec(Spec):
|
||||
@@ -771,7 +771,7 @@ class VolumePeakSpec(Spec):
|
||||
if vol_bytes + 1 > len(data):
|
||||
raise SpecError("not enough frame data")
|
||||
shift = ((8 - (bits & 7)) & 7) + (4 - vol_bytes) * 8
|
||||
for i in xrange(1, vol_bytes + 1):
|
||||
for i in range(1, vol_bytes + 1):
|
||||
peak *= 256
|
||||
peak += data_array[i]
|
||||
peak *= 2 ** shift
|
||||
|
||||
@@ -236,7 +236,7 @@ class ID3Tags(DictProxy, Tags):
|
||||
return [self[key]]
|
||||
else:
|
||||
key = key + ":"
|
||||
return [v for s, v in self.items() if s.startswith(key)]
|
||||
return [v for s, v in list(self.items()) if s.startswith(key)]
|
||||
|
||||
def setall(self, key, values):
|
||||
"""Delete frames of the given type and add frames in 'values'.
|
||||
@@ -280,7 +280,7 @@ class ID3Tags(DictProxy, Tags):
|
||||
``POPM=user@example.org=3 128/255``
|
||||
"""
|
||||
|
||||
frames = sorted(Frame.pprint(s) for s in self.values())
|
||||
frames = sorted(Frame.pprint(s) for s in list(self.values()))
|
||||
return "\n".join(frames)
|
||||
|
||||
def _add(self, frame, strict):
|
||||
@@ -371,7 +371,7 @@ class ID3Tags(DictProxy, Tags):
|
||||
# TDAT, TYER, and TIME have been turned into TDRC.
|
||||
try:
|
||||
date = text_type(self.get("TYER", ""))
|
||||
if date.strip(u"\x00"):
|
||||
if date.strip("\x00"):
|
||||
self.pop("TYER")
|
||||
dat = text_type(self.get("TDAT", ""))
|
||||
if dat.strip("\x00"):
|
||||
@@ -482,7 +482,7 @@ class ID3Tags(DictProxy, Tags):
|
||||
def _copy(self):
|
||||
"""Creates a shallow copy of all tags"""
|
||||
|
||||
items = self.items()
|
||||
items = list(self.items())
|
||||
subs = {}
|
||||
for f in (self.getall("CHAP") + self.getall("CTOC")):
|
||||
subs[f.HashKey] = f.sub_frames._copy()
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ class M4ATags(DictProxy, Tags):
|
||||
raise error("deprecated")
|
||||
|
||||
def pprint(self):
|
||||
return u""
|
||||
return ""
|
||||
|
||||
|
||||
class M4AInfo(StreamInfo):
|
||||
@@ -77,7 +77,7 @@ class M4AInfo(StreamInfo):
|
||||
raise error("deprecated")
|
||||
|
||||
def pprint(self):
|
||||
return u""
|
||||
return ""
|
||||
|
||||
|
||||
class M4A(FileType):
|
||||
|
||||
@@ -74,7 +74,7 @@ class MonkeysAudioInfo(StreamInfo):
|
||||
self.length = float(total_blocks) / self.sample_rate
|
||||
|
||||
def pprint(self):
|
||||
return u"Monkey's Audio %.2f, %.2f seconds, %d Hz" % (
|
||||
return "Monkey's Audio %.2f, %.2f seconds, %d Hz" % (
|
||||
self.version, self.length, self.sample_rate)
|
||||
|
||||
|
||||
|
||||
+10
-10
@@ -75,7 +75,7 @@ def _guess_xing_bitrate_mode(xing):
|
||||
|
||||
|
||||
# Mode values.
|
||||
STEREO, JOINTSTEREO, DUALCHANNEL, MONO = xrange(4)
|
||||
STEREO, JOINTSTEREO, DUALCHANNEL, MONO = range(4)
|
||||
|
||||
|
||||
class MPEGFrame(object):
|
||||
@@ -95,7 +95,7 @@ class MPEGFrame(object):
|
||||
}
|
||||
|
||||
__BITRATE[(2, 3)] = __BITRATE[(2, 2)]
|
||||
for i in xrange(1, 4):
|
||||
for i in range(1, 4):
|
||||
__BITRATE[(2.5, i)] = __BITRATE[(2, i)]
|
||||
|
||||
# Map version to sample rates.
|
||||
@@ -197,7 +197,7 @@ class MPEGFrame(object):
|
||||
if xing.bytes != -1 and self.length:
|
||||
self.bitrate = int((xing.bytes * 8) / self.length)
|
||||
if xing.lame_version_desc:
|
||||
self.encoder_info = u"LAME %s" % xing.lame_version_desc
|
||||
self.encoder_info = "LAME %s" % xing.lame_version_desc
|
||||
if lame is not None:
|
||||
self.track_gain = lame.track_gain_adjustment
|
||||
self.track_peak = lame.track_peak
|
||||
@@ -213,7 +213,7 @@ class MPEGFrame(object):
|
||||
pass
|
||||
else:
|
||||
self.bitrate_mode = BitrateMode.VBR
|
||||
self.encoder_info = u"FhG"
|
||||
self.encoder_info = "FhG"
|
||||
self.sketchy = False
|
||||
self.length = float(frame_size * vbri.frames) / self.sample_rate
|
||||
if self.length:
|
||||
@@ -323,8 +323,8 @@ class MPEGInfo(StreamInfo):
|
||||
"""
|
||||
|
||||
sketchy = False
|
||||
encoder_info = u""
|
||||
encoder_settings = u""
|
||||
encoder_info = ""
|
||||
encoder_settings = ""
|
||||
bitrate_mode = BitrateMode.UNKNOWN
|
||||
track_gain = track_peak = album_gain = album_peak = None
|
||||
|
||||
@@ -363,7 +363,7 @@ class MPEGInfo(StreamInfo):
|
||||
if max_syncs <= 0:
|
||||
break
|
||||
|
||||
for _ in xrange(enough_frames):
|
||||
for _ in range(enough_frames):
|
||||
try:
|
||||
frame = MPEGFrame(fileobj)
|
||||
except HeaderNotFoundError:
|
||||
@@ -411,16 +411,16 @@ class MPEGInfo(StreamInfo):
|
||||
def pprint(self):
|
||||
info = str(self.bitrate_mode).split(".", 1)[-1]
|
||||
if self.bitrate_mode == BitrateMode.UNKNOWN:
|
||||
info = u"CBR?"
|
||||
info = "CBR?"
|
||||
if self.encoder_info:
|
||||
info += ", %s" % self.encoder_info
|
||||
if self.encoder_settings:
|
||||
info += ", %s" % self.encoder_settings
|
||||
s = u"MPEG %s layer %d, %d bps (%s), %s Hz, %d chn, %.2f seconds" % (
|
||||
s = "MPEG %s layer %d, %d bps (%s), %s Hz, %d chn, %.2f seconds" % (
|
||||
self.version, self.layer, self.bitrate, info,
|
||||
self.sample_rate, self.channels, self.length)
|
||||
if self.sketchy:
|
||||
s += u" (sketchy)"
|
||||
s += " (sketchy)"
|
||||
return s
|
||||
|
||||
|
||||
|
||||
+41
-41
@@ -194,64 +194,64 @@ class LAMEHeader(object):
|
||||
if self.vbr_method == 2:
|
||||
if version in ((3, 90), (3, 91), (3, 92)) and self.encoding_flags:
|
||||
if self.bitrate < 255:
|
||||
return u"--alt-preset %d" % self.bitrate
|
||||
return "--alt-preset %d" % self.bitrate
|
||||
else:
|
||||
return u"--alt-preset %d+" % self.bitrate
|
||||
return "--alt-preset %d+" % self.bitrate
|
||||
if self.preset_used != 0:
|
||||
return u"--preset %d" % self.preset_used
|
||||
return "--preset %d" % self.preset_used
|
||||
elif self.bitrate < 255:
|
||||
return u"--abr %d" % self.bitrate
|
||||
return "--abr %d" % self.bitrate
|
||||
else:
|
||||
return u"--abr %d+" % self.bitrate
|
||||
return "--abr %d+" % self.bitrate
|
||||
elif self.vbr_method == 1:
|
||||
if self.preset_used == 0:
|
||||
if self.bitrate < 255:
|
||||
return u"-b %d" % self.bitrate
|
||||
return "-b %d" % self.bitrate
|
||||
else:
|
||||
return u"-b 255+"
|
||||
return "-b 255+"
|
||||
elif self.preset_used == 1003:
|
||||
return u"--preset insane"
|
||||
return u"-b %d" % self.preset_used
|
||||
return "--preset insane"
|
||||
return "-b %d" % self.preset_used
|
||||
elif version in ((3, 90), (3, 91), (3, 92)):
|
||||
preset_key = (self.vbr_quality, self.quality, self.vbr_method,
|
||||
self.lowpass_filter, self.ath_type)
|
||||
if preset_key == (1, 2, 4, 19500, 3):
|
||||
return u"--preset r3mix"
|
||||
return "--preset r3mix"
|
||||
if preset_key == (2, 2, 3, 19000, 4):
|
||||
return u"--alt-preset standard"
|
||||
return "--alt-preset standard"
|
||||
if preset_key == (2, 2, 3, 19500, 2):
|
||||
return u"--alt-preset extreme"
|
||||
return "--alt-preset extreme"
|
||||
|
||||
if self.vbr_method == 3:
|
||||
return u"-V %s" % self.vbr_quality
|
||||
return "-V %s" % self.vbr_quality
|
||||
elif self.vbr_method in (4, 5):
|
||||
return u"-V %s --vbr-new" % self.vbr_quality
|
||||
return "-V %s --vbr-new" % self.vbr_quality
|
||||
elif version in ((3, 93), (3, 94), (3, 95), (3, 96), (3, 97)):
|
||||
if self.preset_used == 1001:
|
||||
return u"--preset standard"
|
||||
return "--preset standard"
|
||||
elif self.preset_used == 1002:
|
||||
return u"--preset extreme"
|
||||
return "--preset extreme"
|
||||
elif self.preset_used == 1004:
|
||||
return u"--preset fast standard"
|
||||
return "--preset fast standard"
|
||||
elif self.preset_used == 1005:
|
||||
return u"--preset fast extreme"
|
||||
return "--preset fast extreme"
|
||||
elif self.preset_used == 1006:
|
||||
return u"--preset medium"
|
||||
return "--preset medium"
|
||||
elif self.preset_used == 1007:
|
||||
return u"--preset fast medium"
|
||||
return "--preset fast medium"
|
||||
|
||||
if self.vbr_method == 3:
|
||||
return u"-V %s" % self.vbr_quality
|
||||
return "-V %s" % self.vbr_quality
|
||||
elif self.vbr_method in (4, 5):
|
||||
return u"-V %s --vbr-new" % self.vbr_quality
|
||||
return "-V %s --vbr-new" % self.vbr_quality
|
||||
elif version == (3, 98):
|
||||
if self.vbr_method == 3:
|
||||
return u"-V %s --vbr-old" % self.vbr_quality
|
||||
return "-V %s --vbr-old" % self.vbr_quality
|
||||
elif self.vbr_method in (4, 5):
|
||||
return u"-V %s" % self.vbr_quality
|
||||
return "-V %s" % self.vbr_quality
|
||||
elif version >= (3, 99):
|
||||
if self.vbr_method == 3:
|
||||
return u"-V %s --vbr-old" % self.vbr_quality
|
||||
return "-V %s --vbr-old" % self.vbr_quality
|
||||
elif self.vbr_method in (4, 5):
|
||||
p = self.vbr_quality
|
||||
adjust_key = (p, self.bitrate, self.lowpass_filter)
|
||||
@@ -261,9 +261,9 @@ class LAMEHeader(object):
|
||||
(5, 8, 0): 8,
|
||||
(6, 8, 0): 9,
|
||||
}.get(adjust_key, p)
|
||||
return u"-V %s" % p
|
||||
return "-V %s" % p
|
||||
|
||||
return u""
|
||||
return ""
|
||||
|
||||
@classmethod
|
||||
def parse_version(cls, fileobj):
|
||||
@@ -303,36 +303,36 @@ class LAMEHeader(object):
|
||||
if (major, minor) < (3, 90) or (
|
||||
(major, minor) == (3, 90) and data[-11:-10] == b"("):
|
||||
flag = data.strip(b"\x00").rstrip().decode("ascii")
|
||||
return (major, minor), u"%d.%d%s" % (major, minor, flag), False
|
||||
return (major, minor), "%d.%d%s" % (major, minor, flag), False
|
||||
|
||||
if len(data) < 11:
|
||||
raise LAMEError("Invalid version: too long")
|
||||
|
||||
flag = data[:-11].rstrip(b"\x00")
|
||||
|
||||
flag_string = u""
|
||||
patch = u""
|
||||
flag_string = ""
|
||||
patch = ""
|
||||
if flag == b"a":
|
||||
flag_string = u" (alpha)"
|
||||
flag_string = " (alpha)"
|
||||
elif flag == b"b":
|
||||
flag_string = u" (beta)"
|
||||
flag_string = " (beta)"
|
||||
elif flag == b"r":
|
||||
patch = u".1+"
|
||||
patch = ".1+"
|
||||
elif flag == b" ":
|
||||
if (major, minor) > (3, 96):
|
||||
patch = u".0"
|
||||
patch = ".0"
|
||||
else:
|
||||
patch = u".0+"
|
||||
patch = ".0+"
|
||||
elif flag == b"" or flag == b".":
|
||||
patch = u".0+"
|
||||
patch = ".0+"
|
||||
else:
|
||||
flag_string = u" (?)"
|
||||
flag_string = " (?)"
|
||||
|
||||
# extended header, seek back to 9 bytes for the caller
|
||||
fileobj.seek(-11, 1)
|
||||
|
||||
return (major, minor), \
|
||||
u"%d.%d%s%s" % (major, minor, patch, flag_string), True
|
||||
"%d.%d%s%s" % (major, minor, patch, flag_string), True
|
||||
|
||||
|
||||
class XingHeaderError(Exception):
|
||||
@@ -369,7 +369,7 @@ class XingHeader(object):
|
||||
lame_version = (0, 0)
|
||||
"""The LAME version as two element tuple (major, minor)"""
|
||||
|
||||
lame_version_desc = u""
|
||||
lame_version_desc = ""
|
||||
"""The version of the LAME encoder e.g. '3.99.0'. Empty if unknown"""
|
||||
|
||||
is_info = False
|
||||
@@ -425,7 +425,7 @@ class XingHeader(object):
|
||||
"""Returns the guessed encoder settings"""
|
||||
|
||||
if self.lame_header is None:
|
||||
return u""
|
||||
return ""
|
||||
return self.lame_header.guess_settings(*self.lame_version)
|
||||
|
||||
@classmethod
|
||||
@@ -513,7 +513,7 @@ class VBRIHeader(object):
|
||||
else:
|
||||
raise VBRIHeaderError("Invalid TOC entry size")
|
||||
|
||||
self.toc = [unpack(i)[0] for i in xrange(0, toc_size, toc_entry_size)]
|
||||
self.toc = [unpack(i)[0] for i in range(0, toc_size, toc_entry_size)]
|
||||
|
||||
@classmethod
|
||||
def get_offset(cls, info):
|
||||
|
||||
@@ -246,7 +246,7 @@ def _item_sort_key(key, value):
|
||||
"\xa9gen", "gnre", "trkn", "disk",
|
||||
"\xa9day", "cpil", "pgap", "pcst", "tmpo",
|
||||
"\xa9too", "----", "covr", "\xa9lyr"]
|
||||
order = dict(izip(order, xrange(len(order))))
|
||||
order = dict(zip(order, range(len(order))))
|
||||
last = len(order)
|
||||
# If there's no key-based way to distinguish, order by length.
|
||||
# If there's still no way, go by string comparison on the
|
||||
@@ -393,7 +393,7 @@ class MP4Tags(DictProxy, Tags):
|
||||
def save(self, filething, padding=None):
|
||||
|
||||
values = []
|
||||
items = sorted(self.items(), key=lambda kv: _item_sort_key(*kv))
|
||||
items = sorted(list(self.items()), key=lambda kv: _item_sort_key(*kv))
|
||||
for key, value in items:
|
||||
try:
|
||||
values.append(self._render(key, value))
|
||||
@@ -868,22 +868,22 @@ class MP4Tags(DictProxy, Tags):
|
||||
def to_line(key, value):
|
||||
assert isinstance(key, text_type)
|
||||
if isinstance(value, text_type):
|
||||
return u"%s=%s" % (key, value)
|
||||
return u"%s=%r" % (key, value)
|
||||
return "%s=%s" % (key, value)
|
||||
return "%s=%r" % (key, value)
|
||||
|
||||
values = []
|
||||
for key, value in sorted(iteritems(self)):
|
||||
if not isinstance(key, text_type):
|
||||
key = key.decode("latin-1")
|
||||
if key == "covr":
|
||||
values.append(u"%s=%s" % (key, u", ".join(
|
||||
[u"[%d bytes of data]" % len(data) for data in value])))
|
||||
values.append("%s=%s" % (key, ", ".join(
|
||||
["[%d bytes of data]" % len(data) for data in value])))
|
||||
elif isinstance(value, list):
|
||||
for v in value:
|
||||
values.append(to_line(key, v))
|
||||
else:
|
||||
values.append(to_line(key, value))
|
||||
return u"\n".join(values)
|
||||
return "\n".join(values)
|
||||
|
||||
|
||||
class MP4Info(StreamInfo):
|
||||
@@ -915,8 +915,8 @@ class MP4Info(StreamInfo):
|
||||
channels = 0
|
||||
sample_rate = 0
|
||||
bits_per_sample = 0
|
||||
codec = u""
|
||||
codec_description = u""
|
||||
codec = ""
|
||||
codec_description = ""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if args or kwargs:
|
||||
|
||||
@@ -211,7 +211,7 @@ class BaseDescriptor(object):
|
||||
"""May raise ValueError"""
|
||||
|
||||
value = 0
|
||||
for i in xrange(4):
|
||||
for i in range(4):
|
||||
try:
|
||||
b = cdata.uint8(fileobj.read(1))
|
||||
except cdata.error as e:
|
||||
@@ -318,10 +318,10 @@ class DecoderConfigDescriptor(BaseDescriptor):
|
||||
def codec_param(self):
|
||||
"""string"""
|
||||
|
||||
param = u".%X" % self.objectTypeIndication
|
||||
param = ".%X" % self.objectTypeIndication
|
||||
info = self.decSpecificInfo
|
||||
if info is not None:
|
||||
param += u".%d" % info.audioObjectType
|
||||
param += ".%d" % info.audioObjectType
|
||||
return param
|
||||
|
||||
@property
|
||||
|
||||
@@ -181,7 +181,7 @@ class Atoms(object):
|
||||
"""
|
||||
|
||||
if PY2:
|
||||
if isinstance(names, basestring):
|
||||
if isinstance(names, str):
|
||||
names = names.split(b".")
|
||||
else:
|
||||
if isinstance(names, bytes):
|
||||
|
||||
@@ -44,7 +44,7 @@ def _parse_sv8_int(fileobj, limit=9):
|
||||
"""
|
||||
|
||||
num = 0
|
||||
for i in xrange(limit):
|
||||
for i in range(limit):
|
||||
c = fileobj.read(1)
|
||||
if len(c) != 1:
|
||||
raise EOFError
|
||||
@@ -253,12 +253,12 @@ class MusepackInfo(StreamInfo):
|
||||
def pprint(self):
|
||||
rg_data = []
|
||||
if hasattr(self, "title_gain"):
|
||||
rg_data.append(u"%+0.2f (title)" % self.title_gain)
|
||||
rg_data.append("%+0.2f (title)" % self.title_gain)
|
||||
if hasattr(self, "album_gain"):
|
||||
rg_data.append(u"%+0.2f (album)" % self.album_gain)
|
||||
rg_data.append("%+0.2f (album)" % self.album_gain)
|
||||
rg_data = (rg_data and ", Gain: " + ", ".join(rg_data)) or ""
|
||||
|
||||
return u"Musepack SV%d, %.2f seconds, %d Hz, %d bps%s" % (
|
||||
return "Musepack SV%d, %.2f seconds, %d Hz, %d bps%s" % (
|
||||
self.version, self.length, self.sample_rate, self.bitrate, rg_data)
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -387,8 +387,8 @@ class OggPage(object):
|
||||
|
||||
# Number the new pages starting from the first old page.
|
||||
first = old_pages[0].sequence
|
||||
for page, seq in izip(new_pages,
|
||||
xrange(first, first + len(new_pages))):
|
||||
for page, seq in zip(new_pages,
|
||||
range(first, first + len(new_pages))):
|
||||
page.sequence = seq
|
||||
page.serial = old_pages[0].serial
|
||||
|
||||
@@ -416,7 +416,7 @@ class OggPage(object):
|
||||
offset_adjust = 0
|
||||
new_data_end = None
|
||||
assert len(old_pages) == len(new_data)
|
||||
for old_page, data in izip(old_pages, new_data):
|
||||
for old_page, data in zip(old_pages, new_data):
|
||||
offset = old_page.offset + offset_adjust
|
||||
data_size = len(data)
|
||||
resize_bytes(fileobj, old_page.size, data_size, offset)
|
||||
|
||||
@@ -83,7 +83,7 @@ class OggFLACStreamInfo(StreamInfo):
|
||||
self.length = page.position / float(self.sample_rate)
|
||||
|
||||
def pprint(self):
|
||||
return u"Ogg FLAC, %.2f seconds, %d Hz" % (
|
||||
return "Ogg FLAC, %.2f seconds, %d Hz" % (
|
||||
self.length, self.sample_rate)
|
||||
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class OggOpusInfo(StreamInfo):
|
||||
self.length = (page.position - self.__pre_skip) / float(48000)
|
||||
|
||||
def pprint(self):
|
||||
return u"Ogg Opus, %.2f seconds" % (self.length)
|
||||
return "Ogg Opus, %.2f seconds" % (self.length)
|
||||
|
||||
|
||||
class OggOpusVComment(VCommentDict):
|
||||
|
||||
@@ -70,7 +70,7 @@ class OggSpeexInfo(StreamInfo):
|
||||
self.length = page.position / float(self.sample_rate)
|
||||
|
||||
def pprint(self):
|
||||
return u"Ogg Speex, %.2f seconds" % self.length
|
||||
return "Ogg Speex, %.2f seconds" % self.length
|
||||
|
||||
|
||||
class OggSpeexVComment(VCommentDict):
|
||||
|
||||
@@ -76,7 +76,7 @@ class OggTheoraInfo(StreamInfo):
|
||||
self.length = frames / float(self.fps)
|
||||
|
||||
def pprint(self):
|
||||
return u"Ogg Theora, %.2f seconds, %d bps" % (self.length,
|
||||
return "Ogg Theora, %.2f seconds, %d bps" % (self.length,
|
||||
self.bitrate)
|
||||
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class OggVorbisInfo(StreamInfo):
|
||||
self.length = page.position / float(self.sample_rate)
|
||||
|
||||
def pprint(self):
|
||||
return u"Ogg Vorbis, %.2f seconds, %d bps" % (
|
||||
return "Ogg Vorbis, %.2f seconds, %d bps" % (
|
||||
self.length, self.bitrate)
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class OptimFROGInfo(StreamInfo):
|
||||
self.length = 0.0
|
||||
|
||||
def pprint(self):
|
||||
return u"OptimFROG, %.2f seconds, %d Hz" % (self.length,
|
||||
return "OptimFROG, %.2f seconds, %d Hz" % (self.length,
|
||||
self.sample_rate)
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -36,7 +36,7 @@ def _var_int(data, offset=0):
|
||||
def _read_track(chunk):
|
||||
"""Retuns a list of midi events and tempo change events"""
|
||||
|
||||
TEMPO, MIDI = range(2)
|
||||
TEMPO, MIDI = list(range(2))
|
||||
|
||||
# Deviations: The running status should be reset on non midi events, but
|
||||
# some files contain meta events inbetween.
|
||||
@@ -91,7 +91,7 @@ def _read_track(chunk):
|
||||
def _read_midi_length(fileobj):
|
||||
"""Returns the duration in seconds. Can raise all kind of errors..."""
|
||||
|
||||
TEMPO, MIDI = range(2)
|
||||
TEMPO, MIDI = list(range(2))
|
||||
|
||||
def read_chunk(fileobj):
|
||||
info = fileobj.read(8)
|
||||
@@ -123,7 +123,7 @@ def _read_midi_length(fileobj):
|
||||
# get a list of events and tempo changes for each track
|
||||
tracks = []
|
||||
first_tempos = None
|
||||
for tracknum in xrange(ntracks):
|
||||
for tracknum in range(ntracks):
|
||||
identifier, chunk = read_chunk(fileobj)
|
||||
if identifier != b"MTrk":
|
||||
continue
|
||||
@@ -178,7 +178,7 @@ class SMFInfo(StreamInfo):
|
||||
self.length = _read_midi_length(fileobj)
|
||||
|
||||
def pprint(self):
|
||||
return u"SMF, %.2f seconds" % self.length
|
||||
return "SMF, %.2f seconds" % self.length
|
||||
|
||||
|
||||
class SMF(FileType):
|
||||
|
||||
@@ -54,7 +54,7 @@ class TrueAudioInfo(StreamInfo):
|
||||
self.length = float(samples) / self.sample_rate
|
||||
|
||||
def pprint(self):
|
||||
return u"True Audio, %.2f seconds, %d Hz." % (
|
||||
return "True Audio, %.2f seconds, %d Hz." % (
|
||||
self.length, self.sample_rate)
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class WavPackInfo(StreamInfo):
|
||||
self.length = float(samples) / self.sample_rate
|
||||
|
||||
def pprint(self):
|
||||
return u"WavPack, %.2f seconds, %d Hz" % (self.length,
|
||||
return "WavPack, %.2f seconds, %d Hz" % (self.length,
|
||||
self.sample_rate)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user