Merge PR #1037 -- ServerAnnounceObserver.update() updates last_update
This commit is contained in:
@@ -295,6 +295,7 @@ the form ``key = value``. Two items take a different form:, ``worlds`` and
|
|||||||
Path to overviewer output directory. For simplicity, specify this
|
Path to overviewer output directory. For simplicity, specify this
|
||||||
as ``outputdir=outputdir`` and place this line after setting
|
as ``outputdir=outputdir`` and place this line after setting
|
||||||
``outputdir = "<output directory path>"``.
|
``outputdir = "<output directory path>"``.
|
||||||
|
|
||||||
**Required**
|
**Required**
|
||||||
|
|
||||||
* ``minrefresh=<seconds>``
|
* ``minrefresh=<seconds>``
|
||||||
@@ -317,6 +318,7 @@ the form ``key = value``. Two items take a different form:, ``worlds`` and
|
|||||||
The four format strings will be replaced with the number of tiles
|
The four format strings will be replaced with the number of tiles
|
||||||
completed, the total number of tiles, the percentage complete, and the ETA.
|
completed, the total number of tiles, the percentage complete, and the ETA.
|
||||||
|
|
||||||
|
|
||||||
Format strings are explained here: http://docs.python.org/library/stdtypes.html#string-formatting
|
Format strings are explained here: http://docs.python.org/library/stdtypes.html#string-formatting
|
||||||
All format strings must be present in your custom messages.
|
All format strings must be present in your custom messages.
|
||||||
|
|
||||||
@@ -326,6 +328,46 @@ the form ``key = value``. Two items take a different form:, ``worlds`` and
|
|||||||
observer = JSObserver(outputdir, 10)
|
observer = JSObserver(outputdir, 10)
|
||||||
|
|
||||||
|
|
||||||
|
``MultiplexingObserver(Observer[, Observer[, Observer ...]])``
|
||||||
|
This observer will send the progress information to all Observers passed
|
||||||
|
to it.
|
||||||
|
|
||||||
|
* All Observers passed must implement the full Observer interface.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
## An example that updates both a LoggingObserver and a JSObserver
|
||||||
|
# Import the Observers
|
||||||
|
from Observer import MultiplexingObserver, LoggingObserver, JSObserver
|
||||||
|
|
||||||
|
# Construct the LoggingObserver
|
||||||
|
loggingObserver = LoggingObserver()
|
||||||
|
|
||||||
|
# Construct a basic JSObserver
|
||||||
|
jsObserver = JSObserver(outputdir) # This assumes you have set the outputdir previous to this line
|
||||||
|
|
||||||
|
# Set the observer to a MultiplexingObserver
|
||||||
|
observer = MultiplexingObserver(loggingObserver, jsObserver)
|
||||||
|
|
||||||
|
``ServerAnnounceObserver(target, pct_interval)``
|
||||||
|
This Observer will send its progress and status to a Minecraft server
|
||||||
|
via ``target`` with a Minecraft ``say`` command.
|
||||||
|
|
||||||
|
* ``target=<file handle to write to>``
|
||||||
|
Either a FIFO file or stdin. Progress and status messages will be written to this handle.
|
||||||
|
|
||||||
|
**Required**
|
||||||
|
|
||||||
|
* ``pct_interval=<update rate, in percent>``
|
||||||
|
Progress and status messages will not be written more often than this value.
|
||||||
|
E.g., a value of ``1`` will make the ServerAnnounceObserver write to its target
|
||||||
|
once for every 1% of progress.
|
||||||
|
|
||||||
|
**Required**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.. _customwebassets:
|
.. _customwebassets:
|
||||||
|
|
||||||
``customwebassets = "<path to custom web assets>"``
|
``customwebassets = "<path to custom web assets>"``
|
||||||
|
|||||||
@@ -346,6 +346,7 @@ class ServerAnnounceObserver(Observer):
|
|||||||
self._send_output('Rendered %d of %d tiles, %d%% complete' %
|
self._send_output('Rendered %d of %d tiles, %d%% complete' %
|
||||||
(self.get_current_value(), self.get_max_value(),
|
(self.get_current_value(), self.get_max_value(),
|
||||||
self.get_percentage()))
|
self.get_percentage()))
|
||||||
|
self.last_update = current_value
|
||||||
|
|
||||||
def _need_update(self):
|
def _need_update(self):
|
||||||
return self.get_percentage() - \
|
return self.get_percentage() - \
|
||||||
|
|||||||
Reference in New Issue
Block a user