started thinking about metadata editing window

This commit is contained in:
tsi-billypom 2024-08-08 16:35:29 -04:00
parent f00852390b
commit 1c5458dc55

View File

@ -8,26 +8,59 @@ from PyQt5.QtWidgets import (
) )
from PyQt5.QtGui import QFont from PyQt5.QtGui import QFont
from mutagen.id3 import ID3 from mutagen.id3 import ID3
from utils.get_id3_tags import get_id3_tags
class MetadataWindow(QDialog): class MetadataWindow(QDialog):
def __init__(self, songs: ID3 | dict): def __init__(self, songs: list):
"""
Takes in a list of songs (absolute paths)
"""
super(MetadataWindow, self).__init__() super(MetadataWindow, self).__init__()
self.id3_tag_mapping = {
"TIT2": "title",
"TPE1": "artist",
"TALB": "album",
"TPE2": "album_artist",
"TCON": "genre",
"TRCK": "track_number",
"APIC": "album_cover",
"TCOP": "copyright",
}
self.setWindowTitle("Edit metadata") self.setWindowTitle("Edit metadata")
self.setMinimumSize(400, 400) self.setMinimumSize(600, 800)
layout = QVBoxLayout() layout = QVBoxLayout()
h_separator = QFrame()
label = QLabel("Edit metadata") h_separator.setFrameShape(QFrame.HLine)
label.setFont(QFont("Sans", weight=QFont.Bold))
layout.addWidget(label)
# Labels and categories and stuff # Labels and categories and stuff
separator = QFrame() # category_label = QLabel("Edit metadata")
separator.setFrameShape(QFrame.HLine) # category_label.setFont(QFont("Sans", weight=QFont.Bold)) # bold category
layout.addWidget(separator) # category_label.setStyleSheet("text-transform:uppercase;") # uppercase category
category_label = QLabel("Edit metadata") layout.addWidget(h_separator)
category_label.setFont(QFont("Sans", weight=QFont.Bold)) # bold category
category_label.setStyleSheet("text-transform:uppercase;") # uppercase category # FIXME: dynamically load fields and stuf
# Dict of sets
# {
# "TIT2": ["song_title1", "song_title2"],
# ...
# }
tag_sets: dict = {}
# List of dictionaries of ID3 tags for each song
# songs_id3_data: list = []
for song in songs:
# songs_id3_data.append(get_id3_tags(song))
song_data = get_id3_tags(song)
for tag in self.id3_tag_mapping:
tag_sets[tag] = song[tag]
for tag, value in tag_sets:
if value == set(value):
# Normal field
input_field = QLineEdit()
else:
pass
# Danger field
# Editable fields # Editable fields
label = QLabel("Title") label = QLabel("Title")