diff --git a/src/langfingaz/logMeetingData.py b/src/langfingaz/logMeetingData.py index bca3803..0be165e 100755 --- a/src/langfingaz/logMeetingData.py +++ b/src/langfingaz/logMeetingData.py @@ -6,6 +6,7 @@ from pathlib import Path from langfingaz import parseMeetings, bbbRequest, saveData from langfingaz.util import util as util +import langfingaz.util.fileUtil as fileUtil def sleepFiveMin(verbose=False): @@ -17,7 +18,7 @@ def sleepFiveMin(verbose=False): util.sleep(fiveMinutes) -def v2(folder: Path = saveData.getDefaultFolder()): +def v2(folder: Path = fileUtil.getDataDir()): print("BBB meetingData logger started!") while True: @@ -33,7 +34,7 @@ def v2(folder: Path = saveData.getDefaultFolder()): sleepFiveMin(verbose=True) -def v1(folder: Path = saveData.getDefaultFolder()): +def v1(folder: Path = fileUtil.getDataDir()): while True: saveData.requestAndSaveMeetingData(folder) print('.') diff --git a/src/langfingaz/plotMeetings.py b/src/langfingaz/plotMeetings.py index aeca0d4..2aa00b5 100644 --- a/src/langfingaz/plotMeetings.py +++ b/src/langfingaz/plotMeetings.py @@ -17,7 +17,11 @@ def getDefaultPlotFolder() -> Path: return fileUtil.getProjectBaseDir().joinpath("plot") -def plotMeetings(dataDir: Path = fileUtil.getProjectBaseDir().joinpath("data")): +def plotMeetings(dataDir: Path = fileUtil.getDataDir()): + """ + plot BBB meetings of the last month + """ + bbbStati: List[BbbStatus] = [] for file in dataDir.iterdir(): diff --git a/src/langfingaz/saveData.py b/src/langfingaz/saveData.py index a0c74d8..2dc1741 100644 --- a/src/langfingaz/saveData.py +++ b/src/langfingaz/saveData.py @@ -5,11 +5,7 @@ import langfingaz.util.fileUtil as fileUtil from langfingaz import bbbRequest -def getDefaultFolder() -> Path: - return fileUtil.getProjectBaseDir().joinpath("data") - - -def requestAndSaveMeetingData(folder: Path = getDefaultFolder()) -> Path: +def requestAndSaveMeetingData(folder: Path = fileUtil.getDataDir()) -> Path: """ save a new xml file in the given folder @@ -21,7 +17,7 @@ def requestAndSaveMeetingData(folder: Path = getDefaultFolder()) -> Path: return saveMeetingsData(bbbRequest.requestMeetingData(), folder) -def saveMeetingsData(dataStr: str, folder: Path = getDefaultFolder()) -> Path: +def saveMeetingsData(dataStr: str, folder: Path = fileUtil.getDataDir()) -> Path: """ save a new xml file in the given folder diff --git a/src/langfingaz/util/fileUtil.py b/src/langfingaz/util/fileUtil.py index c4493c3..dbb9d08 100644 --- a/src/langfingaz/util/fileUtil.py +++ b/src/langfingaz/util/fileUtil.py @@ -11,6 +11,13 @@ def getProjectBaseDir() -> Path: return getWorkingDir().parent.parent.parent +def getDataDir() -> Path: + """ + :return: The default data directory + """ + return getProjectBaseDir().joinpath("data") + + def readFirstLine(file: Path) -> str: """ :param file: Path to file