added an internal setting to control the main refresh interval

This commit is contained in:
Martin Wagner 2020-08-29 10:35:19 +02:00
parent 393d4516b8
commit 6a47781511
2 changed files with 14 additions and 1 deletions

View File

@ -673,6 +673,7 @@ class Client(MPDClient):
self._settings=settings
self.emitter=MpdEventEmitter()
self._last_status={}
self._refresh_interval=self._settings.get_int("refresh-interval")
#connect
self._settings.connect("changed::active-profile", self._on_settings_changed)
@ -806,7 +807,7 @@ class Client(MPDClient):
print("connect failed")
return True
# connect successful
self._main_timeout_id=GLib.timeout_add(100, self._main_loop)
self._main_timeout_id=GLib.timeout_add(self._refresh_interval, self._main_loop)
self.emitter.emit("reconnected")
return False

View File

@ -156,5 +156,17 @@
<summary>List of cover regex</summary>
<description></description>
</key>
<key type="i" name="refresh-interval">
<default>100</default>
<summary>Main refresh interval</summary>
<description>
This setting should only be used if you know what you are doing!
It controls the time in msec. between two status requests to MPD.
To high values (long time) will make mpdevil very slow in terms
of showing the latest status of MPD (e.g. current song).
To low values (short time) can cause gui blocks making mpdevil
unresponsive and cpu intensive.
</description>
</key>
</schema>
</schemalist>