From 109388a0a24bb95f9c176933ce41427cbf85d846 Mon Sep 17 00:00:00 2001
From: Gottfried Gaisbauer <gogo@servus.at>
Date: Mon, 14 May 2018 18:24:03 +0200
Subject: [PATCH] added comments, removed unused functions

---
 modules/base/config.py                        |  4 +-
 modules/cli_tool/padavan.py                   | 28 ++++++-
 modules/communication/connection_tester.py    |  9 +++
 modules/communication/liquidsoap/client.py    | 36 ---------
 .../communication/liquidsoap/communicator.py  |  6 +-
 .../communication/liquidsoap/initthread.py    |  2 +
 .../communication/liquidsoap/playerclient.py  | 11 ---
 .../liquidsoap/recorderclient.py              | 75 -------------------
 modules/communication/mail/mail.py            | 31 ++++----
 modules/communication/redis/adapter.py        |  3 +
 modules/communication/redis/messenger.py      |  5 +-
 modules/monitoring/diskspace_watcher.py       | 12 +++
 modules/scheduling/calendar.py                | 13 +---
 modules/scheduling/scheduler.py               | 30 +-------
 14 files changed, 77 insertions(+), 188 deletions(-)
 delete mode 100644 modules/communication/liquidsoap/recorderclient.py

diff --git a/modules/base/config.py b/modules/base/config.py
index 34ccf677..c7726bb2 100644
--- a/modules/base/config.py
+++ b/modules/base/config.py
@@ -26,10 +26,8 @@ __license__ = "GNU General Public License (GPL) Version 3"
 __version_info__ = (0, 1, 1)
 __author__ = 'Michael Liebler <michael-liebler@radio-z.net>'
 
-# massively enhanced by Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
-
 """
-Comba Base Class  - lade Config
+Aura Config Reader
 """
 import os
 import sys
diff --git a/modules/cli_tool/padavan.py b/modules/cli_tool/padavan.py
index cc723247..d78ba8c8 100644
--- a/modules/cli_tool/padavan.py
+++ b/modules/cli_tool/padavan.py
@@ -107,6 +107,7 @@ class Padavan:
         #    raise Exception("")
 
     # init liquid => faster exec time, when loading at runtime just what is needed
+    # ------------------------------------------------------------------------------------------ #
     def init_liquidsoap_communication(self):
         # import
         from modules.communication.liquidsoap.communicator import LiquidSoapCommunicator
@@ -116,29 +117,35 @@ class Padavan:
         # enable connection
         self.lsc.enable_transaction()
 
+    # ------------------------------------------------------------------------------------------ #
     def destroy_liquidsoap_communication(self):
         # enable connection
         self.lsc.disable_transaction()
 
+    # ------------------------------------------------------------------------------------------ #
     def init_redis_communication(self, with_server=False):
         self.redisclient = ClientRedisAdapter()
 
         if with_server:
             self.redisserver = ServerRedisAdapter()
 
+    # ------------------------------------------------------------------------------------------ #
     def send_redis(self, channel, message):
         self.init_redis_communication()
         self.redisclient.publish(channel, message)
 
+    # ------------------------------------------------------------------------------------------ #
     def send_and_wait_redis(self, channel, message, reply_channel):
         self.init_redis_communication(True)
         self.redisclient.publish(channel, message)
         return self.redisserver.listen_for_one_message(reply_channel.value)
 
+    # ------------------------------------------------------------------------------------------ #
     def shutdown(self):
         self.send_redis("aura", "shutdown")
         self.stringreply = "Shutdown message sent!"
 
+    # ------------------------------------------------------------------------------------------ #
     def fetch_new_programme(self):
         json_reply = self.send_and_wait_redis("aura", "fetch_new_programme", RedisChannel.FNP_REPLY)
         if json_reply != "":
@@ -147,16 +154,19 @@ class Padavan:
         else:
             print("No programme fetched")
 
+    # ------------------------------------------------------------------------------------------ #
     def get_act_programme(self):
         json_reply = self.send_and_wait_redis("aura", "get_act_programme", RedisChannel.GAP_REPLY)
         actprogramme = simplejson.loads(json_reply)
         self.print_programme(actprogramme)
 
+    # ------------------------------------------------------------------------------------------ #
     def get_connection_status(self):
         json_reply = self.send_and_wait_redis("aura", "get_connection_status", RedisChannel.GCS_REPLY)
         connection_status = simplejson.loads(json_reply)
         self.print_connection_status(connection_status)
 
+    # ------------------------------------------------------------------------------------------ #
     def print_programme(self, programme):
         for entry in programme:
             self.stringreply += "idx: " + str(entry["programme_index"]) + \
@@ -165,6 +175,7 @@ class Padavan:
                 " - starts @ " + entry["entry_start"] + \
                 " - plays " + str(entry["source"]) + "\n"
 
+    # ------------------------------------------------------------------------------------------ #
     def print_connection_status(self, connection_status):
 
         if connection_status["pv"]:
@@ -197,40 +208,47 @@ class Padavan:
         else:
             self.stringreply += "\nConnection to redis: " + TerminalColors.RED.value + " " + str(connection_status["redis"]) + TerminalColors.ENDC.value
 
-
-
+    # ------------------------------------------------------------------------------------------ #
     def init_player(self):
         self.stringreply = self.send_and_wait_redis("aura", "init_player", RedisChannel.IP_REPLY)
 
+    # ------------------------------------------------------------------------------------------ #
     def recreatedb(self):
         print("YOU WILL GET PROBLEMS DUE TO DATABASE BLOCKING IF aura.py IS RUNNING! NO CHECKS IMPLEMENTED SO FAR!")
         x = AuraDatabaseModel()
         x.recreate_db()
         self.stringreply = "Database recreated!"
 
+    # ------------------------------------------------------------------------------------------ #
     def redis_message(self, channel, message):
         self.send_redis(channel, message)
         self.stringreply = "Message '"+message+"' sent to channel '"+channel+"'"
 
+    # ------------------------------------------------------------------------------------------ #
     def swap_playlist_entries(self, from_index, to_index):
         json_reply = self.send_and_wait_redis("aura", "swap_playlist_entries " + str(from_index) + " " + str(to_index), RedisChannel.MPE_REPLY)
         actprogramme = simplejson.loads(json_reply)
         self.print_programme(actprogramme)
 
+    # ------------------------------------------------------------------------------------------ #
     def delete_playlist_entry(self, index):
         json_reply = self.send_and_wait_redis("aura", "delete_playlist_entry " + str(index), RedisChannel.DPE_REPLY)
         actprogramme = simplejson.loads(json_reply)
         self.print_programme(actprogramme)
 
+    # ------------------------------------------------------------------------------------------ #
     def insert_playlist_entry(self, fromtime, source):
         json_reply = self.send_and_wait_redis("aura", "insert_playlist_entry " + fromtime + " " + source, RedisChannel.IPE_REPLY)
         actprogramme = simplejson.loads(json_reply)
         self.print_programme(actprogramme)
 
+    # ------------------------------------------------------------------------------------------ #
     def print_message_queue(self):
         self.stringreply = self.send_and_wait_redis("aura", "print_message_queue", RedisChannel.PMQ_REPLY)
 
     # LIQUIDSOAP #
+
+    # ------------------------------------------------------------------------------------------ #
     def select_mixer(self, mixername, activate=True):
         # init lqs
         self.init_liquidsoap_communication()
@@ -241,6 +259,7 @@ class Padavan:
         # disable connection
         self.destroy_liquidsoap_communication()
 
+    # ------------------------------------------------------------------------------------------ #
     def set_volume(self, mixernumber, volume):
         # init lqs and enable comm
         self.init_liquidsoap_communication()
@@ -248,6 +267,7 @@ class Padavan:
         # disable connection
         self.destroy_liquidsoap_communication()
 
+    # ------------------------------------------------------------------------------------------ #
     def get_active_mixer(self):
         self.init_liquidsoap_communication()
         am = self.lsc.get_active_mixer()
@@ -261,6 +281,7 @@ class Padavan:
         # disable connection
         self.destroy_liquidsoap_communication()
 
+    # ------------------------------------------------------------------------------------------ #
     def get_mixer_status(self):
         self.init_liquidsoap_communication()
 
@@ -273,6 +294,8 @@ class Padavan:
         self.destroy_liquidsoap_communication()
 
     # REDIS #
+
+    # ------------------------------------------------------------------------------------------ #
     def get_next_file(self, type):
         redis = RedisMessenger()
 
@@ -287,6 +310,7 @@ class Padavan:
 
         self.send_redis("aura", "set_next_file " + type)
 
+    # ------------------------------------------------------------------------------------------ #
     def set_next_file(self, type, file):
         from modules.communication.redis.messenger import RedisMessenger
         redis = RedisMessenger()
diff --git a/modules/communication/connection_tester.py b/modules/communication/connection_tester.py
index 264304a1..62bef575 100644
--- a/modules/communication/connection_tester.py
+++ b/modules/communication/connection_tester.py
@@ -31,11 +31,14 @@ from libraries.database.broadcasts import ScheduleEntry
 from libraries.base.config import AuraConfig
 
 
+# ------------------------------------------------------------------------------------------ #
 class ConnectionTester(AuraConfig):
 
+    # ------------------------------------------------------------------------------------------ #
     def __init__(self):
         super(ConnectionTester, self).__init__()
 
+    # ------------------------------------------------------------------------------------------ #
     def get_connection_status(self):
         status = dict()
         status["db"] = self.test_db_conn()
@@ -47,6 +50,7 @@ class ConnectionTester(AuraConfig):
 
         return simplejson.dumps(status)
 
+    # ------------------------------------------------------------------------------------------ #
     def test_db_conn(self):
         try:
             ScheduleEntry.select_all()
@@ -55,6 +59,7 @@ class ConnectionTester(AuraConfig):
 
         return True
 
+    # ------------------------------------------------------------------------------------------ #
     def test_lqs_conn(self):
         try:
             lsc = LiquidSoapCommunicator(self.config)
@@ -64,6 +69,7 @@ class ConnectionTester(AuraConfig):
         except Exception as e:
             return False
 
+    # ------------------------------------------------------------------------------------------ #
     def test_lqsr_conn(self):
         try:
             lsc = LiquidSoapCommunicator(self.config)
@@ -73,13 +79,16 @@ class ConnectionTester(AuraConfig):
         except Exception as e:
             return False
 
+    # ------------------------------------------------------------------------------------------ #
     def test_pv_conn(self):
         return self.test_url_connection(self.config.get("calendarurl"))
 
+    # ------------------------------------------------------------------------------------------ #
     def test_tank_conn(self):
         # test load of playlist 1
         return self.test_url_connection(self.config.get("importerurl")+"1")
 
+    # ------------------------------------------------------------------------------------------ #
     def test_redis_conn(self):
         from modules.communication.redis.adapter import ClientRedisAdapter
         try:
diff --git a/modules/communication/liquidsoap/client.py b/modules/communication/liquidsoap/client.py
index b17e5bf4..0fd9bb13 100644
--- a/modules/communication/liquidsoap/client.py
+++ b/modules/communication/liquidsoap/client.py
@@ -221,42 +221,6 @@ class LiquidSoapClient:
             self.logger.debug(msg)
             raise LQConnectionError(msg)
 
-    # ------------------------------------------------------------------------------------------ #
-    def simplecommand(self, command):
-        """
-        Parameterloses Kommando ohne Namespace senden
-        @type    command:   string
-        @param   command:   Kommando
-        @rtype:  string
-        @return: Die Antwort des Liquidsoap-Servers
-        """
-
-        if self.connected:
-            message = str(command) + '\n'
-            self.socket.sendall(message.decode("UTF-8"))
-            self.read()
-            # self.client.close()
-            return self.message
-
-    # ------------------------------------------------------------------------------------------ #
-    def get_metadata(self, rid):
-        """
-        Parameterloses Kommando ohne Namespace senden
-        @type    rid:   string/int
-        @param   rid:   Die ID eines Requests
-        @rtype:  dict
-        @return: Die Metadaten als dict
-        """
-        meta = self.command('metadata ' + str(rid), 'request')
-
-        meta = '[root]\n' + meta
-        try:
-            self.metareader.read_string(meta)
-        except configparser.ParsingError as e:
-            self.logger.error("ParsingError. Reason: " + str(e))
-            return False
-        return self.metareader
-
     # ------------------------------------------------------------------------------------------ #
     def help(self):
         """
diff --git a/modules/communication/liquidsoap/communicator.py b/modules/communication/liquidsoap/communicator.py
index 8edf8913..593e1d67 100644
--- a/modules/communication/liquidsoap/communicator.py
+++ b/modules/communication/liquidsoap/communicator.py
@@ -22,16 +22,12 @@
 #  along with engine. If not, see <http://www.gnu.org/licenses/>.
 #
 
-import os
 import time
-import codecs
-import urllib
 import logging
-import tempfile
 import simplejson
 
 from modules.communication.liquidsoap.playerclient import LiquidSoapPlayerClient
-from modules.communication.liquidsoap.recorderclient import LiquidSoapRecorderClient
+# from modules.communication.liquidsoap.recorderclient import LiquidSoapRecorderClient
 from modules.communication.liquidsoap.initthread import LiquidSoapInitThread
 from modules.communication.mail.mail import AuraMailer
 
diff --git a/modules/communication/liquidsoap/initthread.py b/modules/communication/liquidsoap/initthread.py
index 71b0250e..a973e00b 100644
--- a/modules/communication/liquidsoap/initthread.py
+++ b/modules/communication/liquidsoap/initthread.py
@@ -35,10 +35,12 @@ class LiquidSoapInitThread(threading.Thread):
     active_entry = None
     liquidsoapcommunicator = None
 
+    # ------------------------------------------------------------------------------------------ #
     def __init__(self):
         threading.Thread.__init__(self)
         self.logger = logging.getLogger("AuraEngine")
 
+    # ------------------------------------------------------------------------------------------ #
     def run(self):
         try:
             # sleep needed, because the socket is created to slow by liquidsoap
diff --git a/modules/communication/liquidsoap/playerclient.py b/modules/communication/liquidsoap/playerclient.py
index 0a1e01a9..dc6df54f 100644
--- a/modules/communication/liquidsoap/playerclient.py
+++ b/modules/communication/liquidsoap/playerclient.py
@@ -95,23 +95,12 @@ class LiquidSoapPlayerClient(LiquidSoapClient):
 
     # ------------------------------------------------------------------------------------------ #
     def mixerinputs(self):
-        """
-        List all channels on the mixer
-        @type    namespace: string
-        @param   namespace: lqs namespace
-        @rtype:  list
-        @return: answer of our lqs server
-        """
-
-        #        self.logger.info("listchannels modules/controller/liquidsoap.py")
-
         # send command
         self.command("mixer", "inputs")
 
         # convert to list and return it
         return self.message.strip().split(' ')
 
-
     # ------------------------------------------------------------------------------------------ #
     def mixerstatus(self, pos=""):
         """
diff --git a/modules/communication/liquidsoap/recorderclient.py b/modules/communication/liquidsoap/recorderclient.py
deleted file mode 100644
index 862941d3..00000000
--- a/modules/communication/liquidsoap/recorderclient.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-#  engine
-#
-#  Playout Daemon for autoradio project
-#
-#
-#  Copyright (C) 2017-2018 Gottfried Gaisbauer <gottfried.gaisbauer@servus.at>
-#
-#  This file is part of engine.
-#
-#  engine is free software: you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation, either version 3 of the License, or
-#  any later version.
-#
-#  engine is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#  GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with engine. If not, see <http://www.gnu.org/licenses/>.
-#
-
-from modules.communication.liquidsoap.client import LiquidSoapClient
-
-class LiquidSoapRecorderClient(LiquidSoapClient):
-    # ------------------------------------------------------------------------------------------ #
-    def record(self, command, *args):
-        if command == "status":
-            self.command('record', 'status')
-
-        return self.message
-
-    # ------------------------------------------------------------------------------------------ #
-    def recorder_setfilename(self, filename):
-        """
-        Dateinamen für Aufnahme (Vorproduktion) definieren
-        @type    filename: string
-        @param   filename: Dateiname - Angabe ohne Verzeichnis und mit Extension
-        @rtype:  string
-        @return: Die Antwort des Liquidsoap-Servers
-        """
-        self.command('setfilename', 'record', str(filename))
-        return self.message
-
-    # ------------------------------------------------------------------------------------------ #
-    def stop_record(self):
-        """
-        Recorder stoppen
-        @rtype:  string
-        @return: Die Antwort des Liquidsoap-Servers
-        """
-        message = self.command('stop', 'record')
-        return self.message
-
-    # ------------------------------------------------------------------------------------------ #
-    def start_record(self):
-        """
-        Recorder starten
-        @rtype:  string
-        @return: Die Antwort des Liquidsoap-Servers
-        """
-        self.command('start', 'record')
-        return self.message
-
-    # ------------------------------------------------------------------------------------------ #
-    def recorder_data(self):
-        """
-        Daten des recorders erhalten
-        @rtype:  string
-        @return: Die Antwort des Liquidsoap-Servers
-        """
-        self.command('curfile', 'record')
-        return self.message
\ No newline at end of file
diff --git a/modules/communication/mail/mail.py b/modules/communication/mail/mail.py
index 53b4d139..0b03c628 100644
--- a/modules/communication/mail/mail.py
+++ b/modules/communication/mail/mail.py
@@ -31,24 +31,28 @@ from libraries.exceptions.auraexceptions import MailingException
 class AuraMailer():
     config = None
 
+    # ------------------------------------------------------------------------------------------ #
     def __init__(self, config):
         self.config = config
         self.admin_mails = config.get("admin_mail")
 
-
+    # ------------------------------------------------------------------------------------------ #
     def send_admin_mail(self, subject, body):
         admin_mails = self.admin_mails.split()
 
         for mail_to in admin_mails:
             self.__send(mail_to, subject, body)
 
+    # ------------------------------------------------------------------------------------------ #
     def __send(self, mail_to, subject, body):
+        # read config
         mail_server = self.config.get("mail_server")
         mail_port = self.config.get("mail_server_port")
         mail_user = self.config.get("mail_user")
         mail_pass = self.config.get("mail_pass")
         from_mail = self.config.get("from_mail")
 
+        # check settings
         if mail_server == "":
             raise MailingException("Mail Server not set")
         if mail_port == "":
@@ -60,6 +64,7 @@ class AuraMailer():
         if from_mail == "":
             raise MailingException("From Mail not set")
 
+        # stuff the message together and ...
         msg = EmailMessage()
         msg.set_content(body)
         mailsubject_prefix = self.config.get("mailsubject_prefix")
@@ -70,18 +75,12 @@ class AuraMailer():
         msg["From"] = from_mail
         msg["To"] = mail_to
 
-        server = smtplib.SMTP(mail_server, int(mail_port))
-        server.starttls()
-        server.login(mail_user, mail_pass)
-        server.send_message(msg)
-        server.quit()
-
-#        sendmail_location = "/usr/sbin/sendmail"
-#        p = os.popen("%s -t" % sendmail_location, "w")
-#        p.write("From: %s\n" % self.from_mail)
-#        p.write("To: %s\n" % mail_to)
-#        p.write("Subject: " + subject + "\n")
-#        p.write("\n") # blank line separating headers from body
-#        p.write(body)
-#        status = p.close()
-#        return status
+        # ... send the mail
+        try:
+            server = smtplib.SMTP(mail_server, int(mail_port))
+            server.starttls()
+            server.login(mail_user, mail_pass)
+            server.send_message(msg)
+            server.quit()
+        except Exception as e:
+            raise MailingException(str(e))
diff --git a/modules/communication/redis/adapter.py b/modules/communication/redis/adapter.py
index d0f70bb6..de7919df 100644
--- a/modules/communication/redis/adapter.py
+++ b/modules/communication/redis/adapter.py
@@ -38,6 +38,7 @@ from libraries.exceptions.auraexceptions import RedisConnectionException
 from libraries.enum.auraenumerations import RedisChannel, TerminalColors
 
 
+# ------------------------------------------------------------------------------------------ #
 class ServerRedisAdapter(threading.Thread, RedisMessenger):
     debug = False
     # logger = None
@@ -50,6 +51,7 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
     connection_tester = None
     liquidsoapcommunicator = None
 
+    # ------------------------------------------------------------------------------------------ #
     def __init__(self):
         #super(ServerRedisAdapter, self).__init__()
         threading.Thread.__init__(self)
@@ -261,6 +263,7 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
             self.logger.warning("cannot send message via REDIS: "+str(message))
 
 
+# ------------------------------------------------------------------------------------------ #
 class ClientRedisAdapter(RedisMessenger):
 
     def __init__(self):
diff --git a/modules/communication/redis/messenger.py b/modules/communication/redis/messenger.py
index 00f119ac..5e5f71c7 100644
--- a/modules/communication/redis/messenger.py
+++ b/modules/communication/redis/messenger.py
@@ -37,10 +37,12 @@ Send and receive redis messages
 """
 
 
+# ------------------------------------------------------------------------------------------ #
 class RedisMessenger():
     logger = None
     rstore = None
 
+    # ------------------------------------------------------------------------------------------ #
     def __init__(self):
         super(RedisMessenger, self).__init__()
         """
@@ -77,7 +79,7 @@ class RedisMessenger():
         self.section = section
 
 
-# ------------------------------------------------------------------------------------------ #
+    # ------------------------------------------------------------------------------------------ #
     def set_mail_addresses(self, fromMail, adminMails):
         """
         Einen Sektion / Gültigkeitsbereich der Meldung setzen - zb internal
@@ -111,7 +113,6 @@ class RedisMessenger():
         self.rstore.set_section(section)
         self.rstore.store(level, state)
 
-        # TODO: hier kann auch was zu redis gepostet werden
         if level == 'info' or level == 'success':
             self.logger.info(message)
         elif level == 'warning':
diff --git a/modules/monitoring/diskspace_watcher.py b/modules/monitoring/diskspace_watcher.py
index 10b53d84..036e6050 100644
--- a/modules/monitoring/diskspace_watcher.py
+++ b/modules/monitoring/diskspace_watcher.py
@@ -31,6 +31,8 @@ from modules.communication.mail.mail import AuraMailer
 from libraries.exceptions.auraexceptions import MailingException
 from libraries.exceptions.auraexceptions import DiskSpaceException
 
+
+# ------------------------------------------------------------------------------------------ #
 class DiskSpaceWatcher(threading.Thread):
     liquidsoapcommunicator = None
     exit_event = None
@@ -40,6 +42,7 @@ class DiskSpaceWatcher(threading.Thread):
     sent_a_mail = False
     is_critical = False
 
+    # ------------------------------------------------------------------------------------------ #
     def __init__(self, config, logger, liquidsoapcommunicator):
         self.liquidsoapcommunicator = liquidsoapcommunicator
         self.config = config
@@ -49,6 +52,7 @@ class DiskSpaceWatcher(threading.Thread):
 
         self.exit_event = threading.Event()
 
+    # ------------------------------------------------------------------------------------------ #
     def run(self):
         # set seconds to wait
         try:
@@ -70,9 +74,11 @@ class DiskSpaceWatcher(threading.Thread):
             # and wait
             self.exit_event.wait(seconds_to_wait)
 
+    # ------------------------------------------------------------------------------------------ #
     def stop(self):
         self.exit_event.set()
 
+    # ------------------------------------------------------------------------------------------ #
     def check_disk_space(self):
         # check disk space where aure engine is writing to
         self.check_recorder_disk_space()
@@ -90,11 +96,13 @@ class DiskSpaceWatcher(threading.Thread):
         self.is_critical = False
         self.sent_a_mail = False
 
+    # ------------------------------------------------------------------------------------------ #
     def check_recorder_disk_space(self):
         for i in range(5):
             if self.config.get("rec_" + str(i)) == "y":
                 self.check_recorder_num_disk_space(i)
 
+    # ------------------------------------------------------------------------------------------ #
     def check_recorder_num_disk_space(self, num):
         folder = self.config.get("rec_" + str(num) + "_folder")
 
@@ -107,12 +115,14 @@ class DiskSpaceWatcher(threading.Thread):
             # stop recorder when diskspace is critical
             self.liquidsoapcommunicator.recorder_stop(num)
 
+    # ------------------------------------------------------------------------------------------ #
     def check_logging_disk_space(self):
         try:
             self.check_disk_space_of_folder(self.config.get("logdir"))
         except DiskSpaceException as e:
             self.logger.critical(str(e))
 
+    # ------------------------------------------------------------------------------------------ #
     def check_disk_space_of_folder(self, folder):
         warning_value_raw = self.config.get("diskspace_warning_value")
         critical_value_raw = self.config.get("diskspace_critical_value")
@@ -152,6 +162,7 @@ class DiskSpaceWatcher(threading.Thread):
 
             raise DiskSpaceException("Diskspace in " + folder + " reached critical value!")
 
+    # ------------------------------------------------------------------------------------------ #
     def send_mail(self, subj, msg):
         try:
             self.logger.info("Trying to send mail with subject " + subj + " and message " + msg + ".")
@@ -159,6 +170,7 @@ class DiskSpaceWatcher(threading.Thread):
         except MailingException as e:
             self.logger.critical("Cannot send mail with subject " + subj + " and message " + msg + ". Reason: " + str(e))
 
+    # ------------------------------------------------------------------------------------------ #
     def parse_diskspace(self, value):
         if value.endswith("K") or value.endswith("k"):
             return int(value[:-1]) * 1024
diff --git a/modules/scheduling/calendar.py b/modules/scheduling/calendar.py
index 767eac9f..fa37f162 100644
--- a/modules/scheduling/calendar.py
+++ b/modules/scheduling/calendar.py
@@ -155,6 +155,7 @@ class AuraCalendarService(threading.Thread):
         # terminate the thread
         return
 
+    # ------------------------------------------------------------------------------------------ #
     def store_schedule(self, schedule):
         schedule_db = Schedule.query.filter(Schedule.schedule_id == schedule["schedule_id"]).first()
         havetoadd = False
@@ -448,14 +449,6 @@ class AuraCalendarService(threading.Thread):
         audio_file = FLAC(entry.cleansource)
         return audio_file.info.length
 
-
-    # ------------------------------------------------------------------------------------------ #
-    def __get_error_data__(self):
-        """
-        Basisdaten als dict liefern
-        """
-        return {"from": str(self.datefrom), "dateto": str(self.dateto), "path": "self.playlistpath", "url": self.config.get("calendarurl")}
-
     # ------------------------------------------------------------------------------------------ #
     def __set_url__(self, type):
         url = self.config.get(type+"url")
@@ -470,7 +463,3 @@ class AuraCalendarService(threading.Thread):
     # ------------------------------------------------------------------------------------------ #
     def stop(self):
         self._stop_event.set()
-
-    # ------------------------------------------------------------------------------------------ #
-    def get_calendar_data(self):
-        return self.fetched_schedule_data
diff --git a/modules/scheduling/scheduler.py b/modules/scheduling/scheduler.py
index dbd56eee..ecb9b978 100644
--- a/modules/scheduling/scheduler.py
+++ b/modules/scheduling/scheduler.py
@@ -64,6 +64,7 @@ def alchemyencoder(obj):
         return str(obj)
 
 
+# ------------------------------------------------------------------------------------------ #
 class AuraScheduler(ExceptionLogger, threading.Thread):
     """
     Aura Scheduler Class
@@ -110,7 +111,6 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
         self.error_data = simplejson.load(f)
         f.close()
 
-
         # init database ?
         self.init_database()
 
@@ -136,6 +136,7 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
             else:
                 raise
 
+    # ------------------------------------------------------------------------------------------ #
     def run(self):
         # set seconds to wait
         seconds_to_wait = int(self.config.get("fetching_frequency"))
@@ -158,13 +159,13 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
             # and wait
             self.exit_event.wait(seconds_to_wait)
 
+    # ------------------------------------------------------------------------------------------ #
     def stop(self):
         self.exit_event.set()
 
     # ------------------------------------------------------------------------------------------ #
     def get_active_entry(self):
         now_unix = time.mktime(datetime.datetime.now().timetuple())
-        actsource = ""
         lastentry = None
 
         # load programme if necessary
@@ -178,7 +179,6 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
             if lastentry is not None and entry.entry_start_unix > now_unix:
                 # return lastentry if so
                 return entry # actsource = entry.source
-#                break
 
             lastentry = entry
 
@@ -365,7 +365,6 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
 
         return self.get_act_programme_as_string()
 
-
     # ------------------------------------------------------------------------------------------ #
     def fetch_new_programme(self):
         self.logger.info("trying to fetch new programme")
@@ -410,29 +409,8 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
         #import sys
         #sys.exit(0)
 
-    # ------------------------------------------------------------------------------------------ #
-    def start_recording(self, data):
-        """
-        Aufnahme starten
-        """
-        result = self.client.recorder_start()
-
-        if self.__check_result__(result):
-            self.success("start_recording", result, "00")
-        else:
-            self.error("start_recording", result, "01")
-
-    # ------------------------------------------------------------------------------------------ #
-    def stop_recording(self, data):
-        """
-        Aufnahme anhalten
-        """
-        result = self.client.recorder_stop()
-        if self.__check_result__(result):
-            self.success("stop_recording", result, "00")
-        else:
-            self.error("stop_recording", result, "01")
 
+# ------------------------------------------------------------------------------------------ #
 class CallFunctionTimer(threading.Timer):
     logger = None
     entry = None
-- 
GitLab