mirror of
https://codeberg.org/langfingaz/bbb-status
synced 2024-11-22 20:29:32 +01:00
python-2.9; plot only last month; label at every second day
This commit is contained in:
parent
94b10f0300
commit
61b1dcdb4d
@ -5,7 +5,7 @@
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.7 (venv37)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.9 (venv-39)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PackageRequirementsSettings">
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (venv37)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (venv-39)" project-jdk-type="Python SDK" />
|
||||
</project>
|
24
.idea/runConfigurations/main___plot.xml
Normal file
24
.idea/runConfigurations/main___plot.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="main - plot" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="bbb-status" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="$USER_HOME$/venv-39/bin/python" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src/langfingaz" />
|
||||
<option name="IS_MODULE_SDK" value="false" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/langfingaz/main.py" />
|
||||
<option name="PARAMETERS" value="plot" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
@ -1,4 +1,4 @@
|
||||
FROM python:3.8-alpine
|
||||
FROM python:3.9-alpine
|
||||
|
||||
WORKDIR /usr/src/
|
||||
|
||||
|
@ -29,3 +29,7 @@ Generate a new plot based on saved meeting data:
|
||||
```shell
|
||||
sudo docker-compose run bbb-status plot
|
||||
```
|
||||
|
||||
## example plot
|
||||
|
||||
![plot of one month BBB usage](plot-last-month.png)
|
||||
|
BIN
plot-last-month.png
Normal file
BIN
plot-last-month.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 206 KiB |
@ -20,7 +20,7 @@ def main():
|
||||
'\tplot: saves a plot of the saved BBB meeting data\n'
|
||||
|
||||
if len(argv) != 2:
|
||||
raise ValueError("Expected one commandline argument!")
|
||||
raise ValueError("Expected one commandline argument!\n" + usageStr)
|
||||
|
||||
if argv[1] == "log":
|
||||
logMeetingData.v1()
|
||||
|
@ -1,3 +1,4 @@
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
import logging
|
||||
@ -25,15 +26,31 @@ def plotMeetings(dataDir: Path = fileUtil.getProjectBaseDir().joinpath("data")):
|
||||
dataStr, t = loadData.loadData(file)
|
||||
meetings: List[Meeting] = parseMeetings.parseMeetingsData(dataStr)
|
||||
bbbStati.append(parseMeetings.BbbStatus(meetings, t))
|
||||
if (len(bbbStati) < 1):
|
||||
print("No bbbStatus objects could be read from data directory: " + str(dataDir))
|
||||
return
|
||||
|
||||
# sort by date (x-axis)
|
||||
bbbStati = sorted(bbbStati, key=BbbStatus.getKey)
|
||||
|
||||
# filter: take only bbbStatus objects of the last month (4 weeks)
|
||||
#
|
||||
# start: datetime = bbbStati[0].pointOfTime
|
||||
# end: datetime = bbbStati[-1].pointOfTime
|
||||
# delta: timedelta = end-start
|
||||
end: datetime = bbbStati[-1].pointOfTime
|
||||
monthBeforeEnd: datetime = end - timedelta(days=28)
|
||||
bbbStati = [bbbStatus for bbbStatus in bbbStati if bbbStatus.pointOfTime >= monthBeforeEnd]
|
||||
|
||||
image: Path = doPlotMeetings(bbbStati)
|
||||
print("saved image at " + str(image))
|
||||
|
||||
|
||||
def doPlotMeetings(bbbStati: List[BbbStatus]) -> Path:
|
||||
'''
|
||||
:param bbbStati: List of bbbStatus objects sorted by date
|
||||
'''
|
||||
|
||||
time = [] # x-axis: time
|
||||
participants = [] # yAxis (1)
|
||||
videos = [] # yAxis (2)
|
||||
@ -56,8 +73,8 @@ def doPlotMeetings(bbbStati: List[BbbStatus]) -> Path:
|
||||
ax.plot(time, voices, label='voice')
|
||||
|
||||
# format the ticks (on x-axis)
|
||||
days = mdates.DayLocator()
|
||||
hours = mdates.HourLocator(interval=6) # every 6 hours one minor tick
|
||||
days = mdates.DayLocator(interval=2) # every second days
|
||||
hours = mdates.HourLocator(interval=12) # every 12 hours one minor tick
|
||||
dateFmt = mdates.DateFormatter('%Y-%m-%d')
|
||||
|
||||
ax.xaxis.set_major_locator(days)
|
||||
|
Loading…
Reference in New Issue
Block a user