|
11 | 11 | # for id3 support |
12 | 12 | from mutagen.easyid3 import EasyID3 |
13 | 13 | from mutagen.mp3 import MP3 |
14 | | -from mutagen.flac import FLAC, StreamInfo |
| 14 | +from mutagen.flac import FLAC |
15 | 15 |
|
16 | 16 | # Import the gettext function and alias it as _ |
17 | 17 | from gettext import gettext as _ |
@@ -162,14 +162,15 @@ def get_property_pages(self, files): |
162 | 162 |
|
163 | 163 | # try to read the FLAC information (length, samplerate) |
164 | 164 | try: |
165 | | - fcinfo = StreamInfo(filename) |
166 | | - |
167 | | - file.add_string_attribute('samplerate', str(fcinfo.sample_rate) + " Hz") |
168 | | - |
| 165 | + |
| 166 | + file.add_string_attribute('samplerate', (mutaFile.info.sample_rate) + " Hz") |
| 167 | + |
169 | 168 | # [SabreWolfy] added consistent formatting of times in format hh:mm:ss |
170 | 169 | flaclength = "%02i:%02i:%02i" % ((int(mutaFile.info.length/3600)), (int(mutaFile.info.length/60%60)), (int(mutaFile.info.length%60))) |
171 | 170 | file.add_string_attribute('length', flaclength) |
172 | | - file.add_string_attribute('bitrate', no_info) # flac doesn't really have a bitrate |
| 171 | + flacbitrate0 = (mutaFile.info.bitrate) / 1000 |
| 172 | + flacbitrate = f"{flacbitrate0:.3f} kbps" |
| 173 | + file.add_string_attribute('bitrate', flacbitrate) |
173 | 174 | except: |
174 | 175 | file.add_string_attribute('bitrate', no_info) |
175 | 176 | file.add_string_attribute('length', no_info) |
|
0 commit comments