1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-09-19 19:01:03 +00:00

Support for eyeD3 version 0.7

This commit is contained in:
Alban 2013-06-07 19:18:24 +02:00
parent 197722c3ed
commit 6160a4990f
2 changed files with 13 additions and 14 deletions

View File

@ -25,7 +25,7 @@ or as a WSGI application (on Apache for instance). But first:
* Python Imaging Library (`apt-get install python-imaging`)
* simplejson (`apt-get install python-simplejson`)
* [requests](http://docs.python-requests.org/) >= 0.12.1 (`pip install requests`)
* [eyeD3](http://eyed3.nicfit.net/) (`apt-get install python-eyed3`)
* [eyeD3](http://eyed3.nicfit.net/) >= 0.7 (`pip install eyed3`)
### Configuration

View File

@ -2,8 +2,7 @@
import os, os.path
import datetime
import eyeD3
import eyed3.id3, eyed3.mp3
import db
class Scanner:
@ -61,18 +60,18 @@ class Scanner:
if not os.path.getmtime(path) > tr.last_modification:
return
tag = eyeD3.Tag()
tag.link(path)
audio_file = eyeD3.Mp3AudioFile(path)
tag = eyed3.id3.Tag()
tag.parse(path)
info = eyed3.mp3.Mp3AudioFile(path).info
tr.disc = tag.getDiscNum()[0] or 1
tr.number = tag.getTrackNum()[0] or 1
tr.title = tag.getTitle()
tr.year = tag.getYear()
tr.genre = tag.getGenre().name if tag.getGenre() else None
tr.duration = audio_file.getPlayTime()
tr.album = self.__find_album(tag.getArtist(), tag.getAlbum())
tr.bitrate = audio_file.getBitRate()[1]
tr.disc = tag.disc_num[0] or 1
tr.number = tag.track_num[0] or 1
tr.title = tag.title
tr.year = tag.release_date.year if tag.release_date else None
tr.genre = tag.genre.name if tag.genre else None
tr.duration = info.time_secs
tr.album = self.__find_album(tag.artist, tag.album)
tr.bitrate = info.bit_rate[1]
tr.last_modification = os.path.getmtime(path)
def __find_album(self, artist, album):