Skip to content

audio-tab: Updated FLAC info #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions nemo-audio-tab/nemo-extension/nemo-audio-tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# for id3 support
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
from mutagen.flac import FLAC, StreamInfo
from mutagen.flac import FLAC

# Import the gettext function and alias it as _
from gettext import gettext as _
Expand Down Expand Up @@ -162,14 +162,15 @@ def get_property_pages(self, files):

# try to read the FLAC information (length, samplerate)
try:
fcinfo = StreamInfo(filename)

file.add_string_attribute('samplerate', str(fcinfo.sample_rate) + " Hz")


file.add_string_attribute('samplerate', (mutaFile.info.sample_rate) + " Hz")

# [SabreWolfy] added consistent formatting of times in format hh:mm:ss
flaclength = "%02i:%02i:%02i" % ((int(mutaFile.info.length/3600)), (int(mutaFile.info.length/60%60)), (int(mutaFile.info.length%60)))
file.add_string_attribute('length', flaclength)
file.add_string_attribute('bitrate', no_info) # flac doesn't really have a bitrate
flacbitrate0 = (mutaFile.info.bitrate) / 1000
flacbitrate = f"{flacbitrate0:.3f} kbps"
file.add_string_attribute('bitrate', flacbitrate)
except:
file.add_string_attribute('bitrate', no_info)
file.add_string_attribute('length', no_info)
Expand Down