metadata window fixes + maybe config
This commit is contained in:
parent
23d0cdf437
commit
a30054b6dc
@ -9,8 +9,7 @@ git clone https://github.com/billypom/musicpom
|
|||||||
```
|
```
|
||||||
install system packages
|
install system packages
|
||||||
```
|
```
|
||||||
sudo apt install ffmpeg
|
sudo apt install ffmpeg, python3-pyqt5
|
||||||
sudo apt install python3-pyqt5
|
|
||||||
```
|
```
|
||||||
create environment
|
create environment
|
||||||
```
|
```
|
||||||
|
|||||||
@ -74,23 +74,22 @@ class MetadataWindow(QDialog):
|
|||||||
tag_sets[tag].append(song_data[tag].text[0])
|
tag_sets[tag].append(song_data[tag].text[0])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
print("tag sets:")
|
||||||
|
print(tag_sets)
|
||||||
|
|
||||||
# UI Creation
|
# UI Creation
|
||||||
current_layout = QHBoxLayout()
|
current_layout = QHBoxLayout()
|
||||||
for idx, (tag, value) in enumerate(tag_sets.items()):
|
for idx, (tag, value) in enumerate(tag_sets.items()):
|
||||||
# Layout creation
|
# Layout creation
|
||||||
if idx == 0:
|
# if idx == 0:
|
||||||
pass
|
# pass
|
||||||
elif idx % 2 == 0:
|
if idx % 2 == 0:
|
||||||
# Make a new horizontal layout for every 2 items
|
# Make a new horizontal layout for every 2 items
|
||||||
layout.addLayout(current_layout)
|
layout.addLayout(current_layout)
|
||||||
current_layout = QHBoxLayout()
|
current_layout = QHBoxLayout()
|
||||||
|
|
||||||
# print(f"type: {type(value)} | value: {value}")
|
|
||||||
|
|
||||||
# Field Creation
|
# Field Creation
|
||||||
if value == list(set(value)):
|
if len(set(value)) <= 1:
|
||||||
print(value)
|
|
||||||
# If the ID3 tag is the same for every item we're editing
|
# If the ID3 tag is the same for every item we're editing
|
||||||
field_text = str(value[0]) if value else ""
|
field_text = str(value[0]) if value else ""
|
||||||
# Normal field
|
# Normal field
|
||||||
@ -98,11 +97,10 @@ class MetadataWindow(QDialog):
|
|||||||
input_field = ID3LineEdit(field_text, tag)
|
input_field = ID3LineEdit(field_text, tag)
|
||||||
input_field.setStyleSheet(None)
|
input_field.setStyleSheet(None)
|
||||||
else:
|
else:
|
||||||
print(value)
|
|
||||||
# Danger field
|
# Danger field
|
||||||
# this means the metadata differs between the selected items for this tag
|
# this means the metadata differs between the selected items for this tag
|
||||||
# so be careful...dangerous
|
# so be careful...dangerous
|
||||||
field_text = str(value[0]) if value else ""
|
field_text = ""
|
||||||
label = QLabel(str(self.id3_tag_mapping[tag]))
|
label = QLabel(str(self.id3_tag_mapping[tag]))
|
||||||
input_field = ID3LineEdit(field_text, tag)
|
input_field = ID3LineEdit(field_text, tag)
|
||||||
input_field.setStyleSheet("border: 1px solid red")
|
input_field.setStyleSheet("border: 1px solid red")
|
||||||
@ -124,20 +122,6 @@ class MetadataWindow(QDialog):
|
|||||||
for tag, field in self.input_fields.items():
|
for tag, field in self.input_fields.items():
|
||||||
if field.text() is not None and field.text() != "":
|
if field.text() is not None and field.text() != "":
|
||||||
if field.has_changed():
|
if field.has_changed():
|
||||||
# date crap...
|
|
||||||
# if tag == "TYER":
|
|
||||||
# continue
|
|
||||||
# if tag == "TDAT":
|
|
||||||
# match = re.match(
|
|
||||||
# r"(\d{4})[-/](\d{2})[-/](\d{2})", field.text()
|
|
||||||
# )
|
|
||||||
# if not match:
|
|
||||||
# continue
|
|
||||||
# year, _, _ = match.groups()
|
|
||||||
# _ = set_id3_tag(
|
|
||||||
# filepath=song[0], tag_name="TYER", value=str(year)
|
|
||||||
# )
|
|
||||||
# BUSINESS AS USUAL
|
|
||||||
# Update the ID3 tag if the tag is not blank,
|
# Update the ID3 tag if the tag is not blank,
|
||||||
# and has been edited
|
# and has been edited
|
||||||
success = set_id3_tag(
|
success = set_id3_tag(
|
||||||
|
|||||||
8
main.py
8
main.py
@ -431,6 +431,7 @@ class ApplicationWindow(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
print("its main")
|
||||||
# First run initialization
|
# First run initialization
|
||||||
if not os.path.exists("config.ini"):
|
if not os.path.exists("config.ini"):
|
||||||
# Create config file from sample
|
# Create config file from sample
|
||||||
@ -440,9 +441,10 @@ if __name__ == "__main__":
|
|||||||
db_name = config.get("db", "database")
|
db_name = config.get("db", "database")
|
||||||
db_path = db_name.split("/")
|
db_path = db_name.split("/")
|
||||||
db_path.pop()
|
db_path.pop()
|
||||||
path_as_string = "/".join(db_path)
|
db_path_as_string = "/".join(db_path)
|
||||||
if not os.path.exists(path_as_string):
|
print(f"db_path_as_string: {db_path_as_string}")
|
||||||
os.makedirs(path_as_string)
|
if not os.path.exists(db_path_as_string):
|
||||||
|
os.makedirs(db_path_as_string)
|
||||||
# Create database on first run
|
# Create database on first run
|
||||||
with DBA.DBAccess() as db:
|
with DBA.DBAccess() as db:
|
||||||
with open("utils/init.sql", "r") as file:
|
with open("utils/init.sql", "r") as file:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user