parent
d2e2144148
commit
d8072ae73f
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os.path
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -500,8 +501,7 @@ class Tracks(Base):
|
|||||||
DEBUG(f"Tracks.get_track_from_filename({filename=})")
|
DEBUG(f"Tracks.get_track_from_filename({filename=})")
|
||||||
try:
|
try:
|
||||||
track = session.query(Tracks).filter(Tracks.path.ilike(
|
track = session.query(Tracks).filter(Tracks.path.ilike(
|
||||||
# TODO: filename separator is hardcoded here
|
f'%{os.path.sep}{filename}')).one()
|
||||||
f'%/{filename}')).one()
|
|
||||||
return track
|
return track
|
||||||
except (NoResultFound, MultipleResultsFound):
|
except (NoResultFound, MultipleResultsFound):
|
||||||
return None
|
return None
|
||||||
|
|||||||
@ -132,7 +132,9 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
if self.music.playing():
|
if self.music.playing():
|
||||||
DEBUG("closeEvent() ignored as music is playing")
|
DEBUG("closeEvent() ignored as music is playing")
|
||||||
event.ignore()
|
event.ignore()
|
||||||
# TODO notify user
|
helpers.show_warning(
|
||||||
|
"Track playing",
|
||||||
|
"Can't close application while track is playing")
|
||||||
else:
|
else:
|
||||||
DEBUG("closeEvent() accepted")
|
DEBUG("closeEvent() accepted")
|
||||||
|
|
||||||
@ -516,12 +518,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
silence_at - self.current_track.fade_at
|
silence_at - self.current_track.fade_at
|
||||||
))
|
))
|
||||||
|
|
||||||
def play_previous(self):
|
|
||||||
"Resume playing last track"
|
|
||||||
|
|
||||||
# TODO
|
|
||||||
pass
|
|
||||||
|
|
||||||
def search_database(self):
|
def search_database(self):
|
||||||
with Session() as session:
|
with Session() as session:
|
||||||
dlg = DbDialog(self, session)
|
dlg = DbDialog(self, session)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user