small documentation changes and stuff
This commit is contained in:
parent
40d78066c6
commit
b8195cd3dd
@ -343,7 +343,6 @@ class MusicTable(QTableView):
|
|||||||
"""
|
"""
|
||||||
When a cell is clicked, do some stuff :)
|
When a cell is clicked, do some stuff :)
|
||||||
"""
|
"""
|
||||||
print(f"click - ({index.row()}, {index.column()})")
|
|
||||||
current_index = self.currentIndex()
|
current_index = self.currentIndex()
|
||||||
if index == current_index:
|
if index == current_index:
|
||||||
return
|
return
|
||||||
@ -418,10 +417,12 @@ class MusicTable(QTableView):
|
|||||||
- data returned from the original worker process function are returned here
|
- data returned from the original worker process function are returned here
|
||||||
as the first item in a tuple
|
as the first item in a tuple
|
||||||
"""
|
"""
|
||||||
|
# FIXME:
|
||||||
# TODO: make this prettier, show a table in a window instead of raw text probably
|
# TODO: make this prettier, show a table in a window instead of raw text probably
|
||||||
_, details = args[0][:2]
|
_, details = args[0][:2]
|
||||||
window = DebugWindow(details)
|
if details:
|
||||||
window.exec_()
|
window = DebugWindow(details)
|
||||||
|
window.exec_()
|
||||||
|
|
||||||
# ____________________
|
# ____________________
|
||||||
# | |
|
# | |
|
||||||
@ -774,7 +775,7 @@ class MusicTable(QTableView):
|
|||||||
|
|
||||||
def get_selected_song_metadata(self) -> ID3 | dict:
|
def get_selected_song_metadata(self) -> ID3 | dict:
|
||||||
"""Returns the selected song's ID3 tags"""
|
"""Returns the selected song's ID3 tags"""
|
||||||
return get_id3_tags(self.selected_song_filepath)
|
return get_id3_tags(self.selected_song_filepath)[0]
|
||||||
|
|
||||||
def get_selected_songs_db_ids(self) -> list:
|
def get_selected_songs_db_ids(self) -> list:
|
||||||
"""Returns a list of id's for the selected songs"""
|
"""Returns a list of id's for the selected songs"""
|
||||||
@ -794,7 +795,7 @@ class MusicTable(QTableView):
|
|||||||
|
|
||||||
def get_current_song_metadata(self) -> ID3 | dict:
|
def get_current_song_metadata(self) -> ID3 | dict:
|
||||||
"""Returns the currently playing song's ID3 tags"""
|
"""Returns the currently playing song's ID3 tags"""
|
||||||
return get_id3_tags(self.current_song_filepath)
|
return get_id3_tags(self.current_song_filepath)[0]
|
||||||
|
|
||||||
def get_current_song_album_art(self) -> bytes:
|
def get_current_song_album_art(self) -> bytes:
|
||||||
"""Returns the APIC data (album art lol) for the currently playing song"""
|
"""Returns the APIC data (album art lol) for the currently playing song"""
|
||||||
|
|||||||
@ -5,8 +5,18 @@ from mutagen.id3._frames import TIT2
|
|||||||
from mutagen.id3._util import ID3NoHeaderError
|
from mutagen.id3._util import ID3NoHeaderError
|
||||||
|
|
||||||
|
|
||||||
def get_id3_tags(filename: str) -> tuple[object, str]:
|
def get_id3_tags(filename: str) -> tuple[ID3 | dict, str]:
|
||||||
"""Get the ID3 tags for an audio file"""
|
"""
|
||||||
|
Get the ID3 tags for an audio file
|
||||||
|
Returns a tuple of:
|
||||||
|
- mutagen ID3 object OR python dictionary
|
||||||
|
- string reason for failure (failure = empty dict above)
|
||||||
|
|
||||||
|
Args
|
||||||
|
- filename
|
||||||
|
Returns
|
||||||
|
- tuple(ID3/dict, fail_reason)
|
||||||
|
"""
|
||||||
# debug(filename)
|
# debug(filename)
|
||||||
|
|
||||||
if filename.endswith(".mp3"):
|
if filename.endswith(".mp3"):
|
||||||
@ -37,7 +47,7 @@ def get_id3_tags(filename: str) -> tuple[object, str]:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error(f"Could not assign file ID3 tag: {e}")
|
error(f"Could not assign file ID3 tag: {e}")
|
||||||
return None, f"Could not assign ID3 tag to file: {e}"
|
return {}, f"Could not assign ID3 tag to file: {e}"
|
||||||
return None, "non mp3 file"
|
return {}, "non mp3 file"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user