need to fix another fcking thing fck refactoring

This commit is contained in:
Lars Noack
2022-11-22 15:55:34 +01:00
parent 993545eb9d
commit 09fbb57380
5 changed files with 42 additions and 21 deletions

View File

@@ -4,6 +4,8 @@ from ..utils.shared import (
)
import os
from mutagen.easyid3 import EasyID3
class Target:
def __init__(self) -> None:
@@ -46,6 +48,22 @@ class Source:
self.src = self.src_data['src']
self.url = self.src_data['url']
class Metadata:
def __init__(self) -> None:
self.data = {}
def get_all_metadata(self):
pass
def __setitem__(self, item, value):
if item in EasyID3.valid_keys.keys():
self.data[item] = value
def __getitem__(self, item):
if item not in self.data:
return None
return self.data[item]
class Song:
def __init__(self, json_response) -> None:
@@ -68,6 +86,10 @@ class Song:
self.target.file = self.json_data['file']
self.target.path = self.json_data['path']
# initialize id3 metadata
self.metadata = Metadata()
# EasyID3.valid_keys.keys()
def __str__(self) -> str:
return f"\"{self.title}\" by {', '.join([str(a) for a in self.artists])}"