Compare commits

..

No commits in common. "b2f826dfccf6cacd210ff3f53894dfe1191d1d6b" and "403c470c8aa5612caab3ce0ec8302488d17267f5" have entirely different histories.

2 changed files with 6 additions and 30 deletions

View File

@ -718,11 +718,7 @@ class Tracks(Base):
"""Search case-insenstively for titles containing str"""
return (
session.execute(
select(cls)
.join(Playdates, isouter=True)
.where(cls.title.like(f"{text}%"))
.group_by(cls.title)
.order_by(cls.title)
select(cls).where(cls.title.like(f"{text}%")).order_by(cls.title)
)
.scalars()
.all()

View File

@ -1892,11 +1892,6 @@ class DbDialog(QDialog):
def __del__(self) -> None:
"""Save dialog size and position"""
# FIXME:
# if record.f_int != self.height():
# ^^^^^^^^^^^^^
# RuntimeError: wrapped C/C++ object of type DbDialog has been deleted
record = Settings.get_int_settings(self.session, "dbdialog_height")
if record.f_int != self.height():
record.update(self.session, {"f_int": self.height()})
@ -1950,26 +1945,18 @@ class DbDialog(QDialog):
self.ui.matchList.clear()
if len(s) > 0:
if self.ui.radioTitle.isChecked():
matches = Tracks.search_titles(self.session, "%" + s)
matches = Tracks.search_titles(self.session, s)
else:
matches = Tracks.search_artists(self.session, s)
if matches:
for track in matches:
last_played = None
show_last_played = False
if len(matches) < 20:
show_last_played = True
last_playdate = max(track.playdates, key=lambda p: p.lastplayed, default=None)
if last_playdate:
last_played = last_playdate.lastplayed
last_played = Playdates.last_played(self.session, track.id)
t = QListWidgetItem()
track_text = (
t.setText(
f"{track.title} - {track.artist} "
f"[{helpers.ms_to_mmss(track.duration)}] "
f"({helpers.get_relative_date(last_played)})"
)
if show_last_played:
track_text += f"({helpers.get_relative_date(last_played)})"
t.setText(track_text)
t.setData(Qt.ItemDataRole.UserRole, track)
self.ui.matchList.addItem(t)
@ -2006,14 +1993,7 @@ class DbDialog(QDialog):
item = self.ui.matchList.currentItem()
track = item.data(Qt.ItemDataRole.UserRole)
last_playdate = max(track.playdates, key=lambda p: p.lastplayed, default=None)
if last_playdate:
last_played = last_playdate.lastplayed
else:
last_played = None
path_text = f"{track.path} ({helpers.get_relative_date(last_played)})"
self.ui.dbPath.setText(path_text)
self.ui.dbPath.setText(track.path)
def title_artist_toggle(self) -> None:
"""