/usr/lib/exaile/xl/externals/mp4.py is in exaile 3.4.0.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | # Copyright (C) 2008-2010 Adam Olsen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# The developers of the Exaile media player hereby grant permission
# for non-GPL compatible GStreamer and Exaile plugins to be used and
# distributed together with GStreamer and Exaile. This permission is
# above and beyond the permissions granted by the GPL license by which
# Exaile is covered. If you modify this code, you may extend this
# exception to your version of the code, but you are not obligated to
# do so. If you do not wish to do so, delete this exception statement
# from your version.
from xl.metadata._base import BaseFormat, CoverImage
from mutagen import mp4
class MP4Format(BaseFormat):
MutagenType = mp4.MP4
tag_mapping = {
'title': '\xa9nam',
'artist': '\xa9ART',
'albumartist': '\x61ART',
'album': '\xa9alb',
'composer': '\xa9wrt',
'genre': '\xa9gen',
'lyrics': '\xa9lyr',
'encodedby': '\xa9too',
'date': '\xa9day',
'tracknumber': 'trkn',
'discnumber': 'disk',
'copyright': 'cprt',
'bpm': 'tmpo',
'grouping': '\xa9grp',
'comment': '\xa9cmt',
'originaldate':'----:com.apple.iTunes:ORIGYEAR',
'cover': 'covr',
}
others = False
writable = True
def _get_tag(self, f, name):
if not f.has_key(name):
return []
elif name == 'covr':
ret = []
for value in f[name]:
if value.imageformat == mp4.MP4Cover.FORMAT_PNG:
mime = 'image/png'
else:
mime = 'image/jpeg'
ret.append(CoverImage(type=None, desc=None, mime=mime, data=value))
return ret
elif name in ['trkn', 'disk']:
ret = []
for value in f[name]:
ret.append("%d/%d" % (value[0], value[1]))
return ret
else: return [t for t in f[name]]
def _set_tag(self, f, name, value):
if type(value) is not list: value = [value]
if name in ['trkn', 'disk']:
try:
f[name] = []
for val in value:
tmp = map(int, val.split('/'))
f[name].append(tuple(tmp))
except (TypeError, ValueError):
pass
elif name == 'covr':
f[name] = []
for val in value:
if val.mime == 'image/jpeg':
f[name].append(mp4.MP4Cover(val.data, mp4.MP4Cover.FORMAT_JPEG))
elif val.mime == 'image/png':
f[name].append(mp4.MP4Cover(val.data, mp4.MP4Cover.FORMAT_JPEG))
else:
raise ValueError('MP4 does not support cover image type %s' % val.type)
elif name == 'tmpo':
f[name] = [int(v) for v in value]
elif name == '----:com.apple.iTunes:ORIGYEAR':
f[name] = [str(v) for v in value]
else:
f[name] = value
# vim: et sts=4 sw=4
|