Compare commits

...

4 Commits

Author SHA1 Message Date
Keith Edmunds
e17ef37d61 Improve save_playlist performance 2022-08-02 21:15:22 +01:00
Keith Edmunds
0623dac7a8 Add line_profiler for dev environment 2022-08-02 21:14:30 +01:00
Keith Edmunds
e052a45800 Don't make temp 3db drop the new default 2022-07-24 15:34:31 +01:00
Keith Edmunds
3295e121c2 List open playlists first in playlist selection 2022-07-24 15:00:15 +01:00
7 changed files with 31 additions and 8 deletions

BIN
app/.playlists.py.swo Normal file

Binary file not shown.

View File

@ -306,7 +306,8 @@ class Playlists(Base):
"""Returns a list of all playlists ordered by last use"""
return (
session.query(cls).order_by(cls.last_used.desc())
session.query(cls).order_by(
cls.loaded.desc(), cls.last_used.desc())
).all()
@classmethod

View File

@ -153,14 +153,20 @@ class Music:
with lock:
return self.player.set_time(ms)
def set_volume(self, volume):
"""Set maximum volume used for player"""
def set_volume(self, volume, set_default=True):
"""
Set maximum volume used for player
Update default volume if set_default == True
"""
with lock:
if not self.player:
return
if set_default:
self.max_volume = volume
self.player.audio_set_volume(volume)
def stop(self):

View File

@ -314,9 +314,9 @@ class Window(QMainWindow, Ui_MainWindow):
"""Drop music level by 3db if button checked"""
if self.btnDrop3db.isChecked():
self.music.set_volume(Config.VOLUME_VLC_DROP3db)
self.music.set_volume(Config.VOLUME_VLC_DROP3db, set_default=False)
else:
self.music.set_volume(Config.VOLUME_VLC_DEFAULT)
self.music.set_volume(Config.VOLUME_VLC_DEFAULT, set_default=False)
def enable_play_next_controls(self) -> None:
"""

17
poetry.lock generated
View File

@ -171,6 +171,20 @@ parso = ">=0.8.0,<0.9.0"
qa = ["flake8 (==3.8.3)", "mypy (==0.782)"]
testing = ["Django (<3.1)", "colorama", "docopt", "pytest (<7.0.0)"]
[[package]]
name = "line-profiler"
version = "3.5.1"
description = "Line-by-line profiler."
category = "dev"
optional = false
python-versions = "*"
[package.extras]
all = ["cython", "scikit-build", "cmake", "ninja", "pytest (>=4.6.11)", "pytest-cov (>=2.10.1)", "coverage[toml] (>=5.3)", "ubelt (>=1.0.1)", "IPython (>=0.13,<7.17.0)", "IPython (>=0.13)"]
build = ["cython", "scikit-build", "cmake", "ninja"]
ipython = ["IPython (>=0.13,<7.17.0)", "IPython (>=0.13)"]
tests = ["pytest (>=4.6.11)", "pytest-cov (>=2.10.1)", "coverage[toml] (>=5.3)", "ubelt (>=1.0.1)", "IPython (>=0.13,<7.17.0)", "IPython (>=0.13)"]
[[package]]
name = "mako"
version = "1.2.0"
@ -614,7 +628,7 @@ python-versions = "*"
[metadata]
lock-version = "1.1"
python-versions = "^3.9"
content-hash = "32b91fc8cb421cc92689db4fc1a4647044714d6e2a72194fe7caf2e25c821b55"
content-hash = "d914be2982394dfeb0dc14962dfabc4474f1daaafcbc93c57fcaad6172fd8597"
[metadata.files]
alembic = [
@ -725,6 +739,7 @@ jedi = [
{file = "jedi-0.18.1-py2.py3-none-any.whl", hash = "sha256:637c9635fcf47945ceb91cd7f320234a7be540ded6f3e99a50cb6febdfd1ba8d"},
{file = "jedi-0.18.1.tar.gz", hash = "sha256:74137626a64a99c8eb6ae5832d99b3bdd7d29a3850fe2aa80a4126b2a7d949ab"},
]
line-profiler = []
mako = [
{file = "Mako-1.2.0-py3-none-any.whl", hash = "sha256:23aab11fdbbb0f1051b93793a58323ff937e98e34aece1c4219675122e57e4ba"},
{file = "Mako-1.2.0.tar.gz", hash = "sha256:9a7c7e922b87db3686210cf49d5d767033a41d4010b284e747682c92bddd8b39"},

View File

@ -26,6 +26,7 @@ PyQt5-stubs = "^5.15.2"
mypy = "^0.931"
pytest = "^7.0.1"
pytest-qt = "^4.0.2"
line-profiler = "^3.5.1"
[build-system]
requires = ["poetry-core>=1.0.0"]