1
# -*- coding: utf-8 -*-
3
# Author: Ingelrest François (Francois.Ingelrest@gmail.com)
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU Library General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
from media.format import createFileTrack
22
def getTrack(filename):
23
""" Return a Track created from a WavPack file """
24
from mutagen.wavpack import WavPack
26
wvFile = WavPack(filename)
28
length = int(round(wvFile.info.length))
29
samplerate = int(wvFile.info.sample_rate)
31
try: title = str(wvFile['Title'][0])
34
try: album = str(wvFile['Album'][0])
37
try: artist = str(wvFile['Artist'][0])
40
try: albumArtist = str(wvFile['Album Artist'][0])
41
except: albumArtist = None
43
try: genre = str(wvFile['genre'][0])
46
try: trackNumber = str(wvFile['Track'][0])
47
except: trackNumber = None
49
try: discNumber = str(wvFile['Disc'][0])
50
except: discNumber = None
52
try: date = str(wvFile['Year'][0])
55
return createFileTrack(filename, -1, length, samplerate, False, title, album, artist, albumArtist,
56
None, genre, trackNumber, date, discNumber)