Skip to content
Snippets Groups Projects
Commit b6c599f4 authored by David Trattnig's avatar David Trattnig
Browse files

Removed unused code and added comments.

parent cd9f90f0
No related branches found
No related tags found
No related merge requests found
...@@ -251,6 +251,7 @@ class Playlist(DB.Model, AuraDatabaseModel): ...@@ -251,6 +251,7 @@ class Playlist(DB.Model, AuraDatabaseModel):
@staticmethod @staticmethod
def select_playlist(playlist_id): def select_playlist(playlist_id):
# TODO Returns multiple playlists - Hence, order playlists also by "latest version". Maybe cleanup others before?
return DB.session.query(Playlist).filter(Playlist.playlist_id == playlist_id).order_by(Playlist.schedule_start).all() return DB.session.query(Playlist).filter(Playlist.playlist_id == playlist_id).order_by(Playlist.schedule_start).all()
@hybrid_property @hybrid_property
...@@ -288,7 +289,7 @@ class PlaylistEntry(DB.Model, AuraDatabaseModel): ...@@ -288,7 +289,7 @@ class PlaylistEntry(DB.Model, AuraDatabaseModel):
@hybrid_property @hybrid_property
def volume(self): def volume(self):
return 100 return 100
@hybrid_property @hybrid_property
def type(self): def type(self):
if self.uri.startswith("http"): if self.uri.startswith("http"):
......
...@@ -169,7 +169,7 @@ class LiquidSoapCommunicator(ExceptionLogger): ...@@ -169,7 +169,7 @@ class LiquidSoapCommunicator(ExceptionLogger):
self.enable_transaction() self.enable_transaction()
self.__send_lqc_command__(self.client, "http", cmd) self.__send_lqc_command__(self.client, "http", cmd)
self.disable_transaction() self.disable_transaction()
except LQConnectionError as e: except LQConnectionError:
# we already caught and handled this error in __send_lqc_command__, but we do not want to execute this function further # we already caught and handled this error in __send_lqc_command__, but we do not want to execute this function further
pass pass
...@@ -290,8 +290,9 @@ class LiquidSoapCommunicator(ExceptionLogger): ...@@ -290,8 +290,9 @@ class LiquidSoapCommunicator(ExceptionLogger):
# grab the actual active entry # grab the actual active entry
(show, old_entry) = self.scheduler.get_active_entry() (show, old_entry) = self.scheduler.get_active_entry()
# determine its type # determine its type
# FIXME Move to <get_active_entry> # TODO Move to <get_active_entry>
old_type = ScheduleEntryType.FILESYSTEM # FIXME No need to switch if current type = new type
old_type = ScheduleEntryType.FILESYSTEM # Set default if no previous track is available
if old_entry: if old_entry:
old_type = old_entry.type old_type = old_entry.type
...@@ -312,7 +313,7 @@ class LiquidSoapCommunicator(ExceptionLogger): ...@@ -312,7 +313,7 @@ class LiquidSoapCommunicator(ExceptionLogger):
# insert playlist entry # insert playlist entry
self.logger.critical("Trackservice entry not written here anymore") self.logger.critical("Trackservice entry not written here anymore")
# self.insert_track_service_entry(new_entry) # self.insert_track_service_entry(new_entry)
except LQConnectionError as e: except LQConnectionError:
# we already caught and handled this error in __send_lqc_command__, but we do not want to execute this function further and pass the exception # we already caught and handled this error in __send_lqc_command__, but we do not want to execute this function further and pass the exception
pass pass
......
...@@ -49,7 +49,8 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger): ...@@ -49,7 +49,8 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
redisclient = None redisclient = None
# connection_tester = None # connection_tester = None
liquidsoapcommunicator = None liquidsoapcommunicator = None
socket = None
# ------------------------------------------------------------------------------------------ # # ------------------------------------------------------------------------------------------ #
def __init__(self, config): def __init__(self, config):
threading.Thread.__init__(self) threading.Thread.__init__(self)
...@@ -67,7 +68,7 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger): ...@@ -67,7 +68,7 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
self.components = {'controller':'01', 'scheduling':'02', 'playd':'03', 'recorder':'04', 'helpers':'09'} self.components = {'controller':'01', 'scheduling':'02', 'playd':'03', 'recorder':'04', 'helpers':'09'}
self.fromMail = '' self.fromMail = ''
self.adminMails = '' self.adminMails = ''
self.can_send = None
self.redisclient = ClientRedisAdapter(config) self.redisclient = ClientRedisAdapter(config)
# self.connection_tester = ConnectionTester() # self.connection_tester = ConnectionTester()
...@@ -237,6 +238,8 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger): ...@@ -237,6 +238,8 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
Send a message to the client Send a message to the client
:param message: string :param message: string
""" """
# FIXME Review logic
if not self.can_send: if not self.can_send:
self.logger.info("sending a "+str(len(message))+" long message via REDIS.") self.logger.info("sending a "+str(len(message))+" long message via REDIS.")
self.socket.send(message.encode("utf-8")) self.socket.send(message.encode("utf-8"))
......
...@@ -264,9 +264,10 @@ class RedisMessenger(): ...@@ -264,9 +264,10 @@ class RedisMessenger():
@param state: Der State @param state: Der State
@return result @return result
""" """
# FIXME Make Mailer functional: Invalid constructor
if self.fromMail and self.adminMails: if self.fromMail and self.adminMails:
subject = "Possible comba problem on job " + state['job'] + " - " + level #subject = "Possible comba problem on job " + state['job'] + " - " + level
mailmessage = "Hi Admin,\n comba reports a possible problem\n\n" mailmessage = "Hi Admin,\n comba reports a possible problem\n\n"
mailmessage = mailmessage + level + "!\n" mailmessage = mailmessage + level + "!\n"
mailmessage = mailmessage + message + "\n\n" mailmessage = mailmessage + message + "\n\n"
...@@ -275,8 +276,9 @@ class RedisMessenger(): ...@@ -275,8 +276,9 @@ class RedisMessenger():
mailmessage = mailmessage + "Job:\t" + state['job'] + "\n" mailmessage = mailmessage + "Job:\t" + state['job'] + "\n"
mailmessage = mailmessage + "Code:\t" + state['code'] + "\n" mailmessage = mailmessage + "Code:\t" + state['code'] + "\n"
mailmessage = mailmessage + "Value:\t" + str(state['value']) + "\n" mailmessage = mailmessage + "Value:\t" + str(state['value']) + "\n"
mailer = AuraMailer(self.adminMails, self.fromMail)
mailer.send_admin_mail(subject, mailmessage) #mailer = AuraMailer(self.adminMails, self.fromMail)
#mailer.send_admin_mail(subject, mailmessage)
else: else:
return False return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment