Compare commits

..

No commits in common. "47ec08ec15a70c8234c3be50c9d0774801bf39e8" and "08dec4d5edab220c2c0db21c47607aa4bdc3b453" have entirely different histories.

4 changed files with 4 additions and 25 deletions

View File

@ -2,7 +2,6 @@ from PyQt5.QtWidgets import (
QDialog,
QFrame,
QHBoxLayout,
QMessageBox,
QVBoxLayout,
QLabel,
QLineEdit,
@ -66,15 +65,6 @@ class MetadataWindow(QDialog):
# e.g., { "TIT2": ["song_title1", "song_title2"], ... }
for song in self.songs:
song_data = get_id3_tags(song[0])
if not song_data:
QMessageBox.error(
self,
"Error",
f"Could not retrieve ID3 tags for {song[0]}",
QMessageBox.Ok,
QMessageBox.Ok,
)
return
for tag in self.id3_tag_mapping:
try:
_ = tag_sets[tag]

View File

@ -118,6 +118,7 @@ class MusicTable(QTableView):
"TDRC",
None,
]
# db names of headers
self.database_columns = str(self.config["table"]["columns"]).split(",")
self.vertical_scroll_position = 0
@ -499,7 +500,7 @@ class MusicTable(QTableView):
try:
self.model2.removeRow(index)
except Exception as e:
debug(f"delete_selected_row_indices() failed | {e}")
debug(f" delete_songs() failed | {e}")
self.connect_data_changed()
self.load_music_table()

View File

@ -1,4 +1,3 @@
from PyQt5.QtWidgets import QMessageBox
import DBA
from logging import debug
from utils import get_id3_tags, convert_id3_timestamp_to_datetime
@ -32,14 +31,6 @@ def add_files_to_database(files, progress_callback=None):
progress_callback.emit(filepath)
filename = filepath.split("/")[-1]
audio = get_id3_tags(filepath)
if not audio:
QMessageBox.error(
"Error",
f"Could not retrieve ID3 tags for {filepath}",
QMessageBox.Ok,
QMessageBox.Ok,
)
return
try:
title = audio["TIT2"].text[0]

View File

@ -5,12 +5,9 @@ from mutagen.id3._frames import TIT2
from mutagen.id3._util import ID3NoHeaderError
def get_id3_tags(filename: str):
def get_id3_tags(filename):
"""Get the ID3 tags for an audio file"""
# debug(filename)
if filename.endswith(".flac"):
return
debug(filename)
try:
# Open the MP3 file and read its content