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

Remove unused code.

parent 53f7d280
No related branches found
No related tags found
No related merge requests found
...@@ -53,21 +53,12 @@ class AuraCalendarService(threading.Thread): ...@@ -53,21 +53,12 @@ class AuraCalendarService(threading.Thread):
#FIXME Review attributes not needed. #FIXME Review attributes not needed.
""" """
# messenger = None
# until = ""
# playlistdir = ""
# xmlplaylist = range(0)
queue = None queue = None
config = None config = None
# debug = False
_stop_event = None
logger = None logger = None
fetched_schedule_data = None fetched_schedule_data = None
# FIXME is it needed?
#url = dict()
# data = dict()
calendar_fetcher = None calendar_fetcher = None
_stop_event = None
def __init__(self, config): def __init__(self, config):
...@@ -78,69 +69,20 @@ class AuraCalendarService(threading.Thread): ...@@ -78,69 +69,20 @@ class AuraCalendarService(threading.Thread):
config (AuraConfig): The configuration config (AuraConfig): The configuration
""" """
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.config = config self.config = config
# self.messenger = RedisMessenger(config)
self.logger = logging.getLogger("AuraEngine") self.logger = logging.getLogger("AuraEngine")
# self.messenger.set_channel("aura")
# self.messenger.set_section("calendar")
# self.datefrom = str(datefrom)
# self.dateto = dateto
self.queue = queue.Queue() self.queue = queue.Queue()
self._stop_event = threading.Event() self._stop_event = threading.Event()
# FIXME is it needed?
# self.__set_url__("api_calendar_url")
# self.__set_url__("api_playlist_url")
self.calendar_fetcher = CalendarFetcher(config) self.calendar_fetcher = CalendarFetcher(config)
# ------------------------------------------------------------------------------------------ #
# def set_date_from(self, date):
# self.datefrom = str(date).replace(" ", "T")
# ------------------------------------------------------------------------------------------ #
# def set_date_to(self, date):
# self.dateto = str(date).replace(" ", "T")
# ------------------------------------------------------------------------------------------ #
# def set_until_time(self, timestring):
# self.until = timestring
# ------------------------------------------------------------------------------------------ #
# def set_playlist_store(self, path):
# self.playlistdir = path
# ------------------------------------------------------------------------------------------ #
# def get_duration(self, start, end):
# return self.__calc_duration__(start, end)
# ------------------------------------------------------------------------------------------ #
def get_queue(self): def get_queue(self):
return self.queue return self.queue
# ------------------------------------------------------------------------------------------ #
# FIXME is get_uri() needed?
# def get_uri(self):
# if not self.playlistdir:
# return False
# if not self.datefrom:
# return False
# if not self.__calc_date_to__():
# return
# hostname = self.get("servername")
# port = self.get("serviceport")
# date_from = self.datefrom[0:16] + ":00"
# date_to = self.dateto[0:16] + ":00"
# uri = "http://" + hostname + ":" + port + "/playlist/" + date_from + "/" + date_to
# return uri
# ------------------------------------------------------------------------------------------ #
def run(self): def run(self):
""" """
Fetch calendar data and store it in the database Fetch calendar data and store it in the database
...@@ -193,12 +135,6 @@ class AuraCalendarService(threading.Thread): ...@@ -193,12 +135,6 @@ class AuraCalendarService(threading.Thread):
# terminate the thread # terminate the thread
return return
# ------------------------------------------------------------------------------------------ #
# def drop_the_future(self, time_in_the_future):
# ScheduleEntry.drop_the_future(time_in_the_future)
# Schedule.drop_the_future(time_in_the_future)
# ------------------------------------------------------------------------------------------ #
def store_schedule(self, schedule): def store_schedule(self, schedule):
...@@ -216,9 +152,6 @@ class AuraCalendarService(threading.Thread): ...@@ -216,9 +152,6 @@ class AuraCalendarService(threading.Thread):
schedule_db = Schedule() schedule_db = Schedule()
havetoadd = True havetoadd = True
# calc duration
# duration = self.__calc_duration__(schedule["start"], schedule["end"])
# schedule["duration"] = timedelta(seconds=duration).__str__()
schedule_db.show_id = schedule["show_id"] schedule_db.show_id = schedule["show_id"]
schedule_db.schedule_id = schedule["schedule_id"] schedule_db.schedule_id = schedule["schedule_id"]
...@@ -335,91 +268,6 @@ class AuraCalendarService(threading.Thread): ...@@ -335,91 +268,6 @@ class AuraCalendarService(threading.Thread):
metadata_db.store(havetoadd, commit=True) metadata_db.store(havetoadd, commit=True)
# ------------------------------------------------------------------------------------------ #
# FIXME Needed?
# def store_playlist_entry(self, schedule_db, playlist, entry, lastentry, entrynum, fallbackplaylist_type=0):
# schedule_entry_db = Playlist.select_one().select_one_playlist_entry_for_show(schedule_db.schedule_id, fallbackplaylist_type, entrynum)
# havetoadd = False
# if not schedule_entry_db:
# self.logger.debug("no scheduleentry with id " + str(playlist["id"]) + " and pos " + str(entrynum) + " in database => creating a new one")
# # FIXME Needed? No active class declaration
# #schedule_entry_db = ScheduleEntry()
# havetoadd = True
# schedule_entry_db.playlist_id = playlist["id"]
# schedule_entry_db.entry_num = entrynum
# schedule_entry_db.schedule_id = schedule_db.schedule_id
# schedule_entry_db.uri = entry["uri"]
# schedule_entry_db.fallback_type = fallbackplaylist_type
# schedule_entry_db.entry_start = schedule_db.schedule_start + timedelta(seconds=self.get_length(lastentry))
# schedule_entry_db.calc_unix_times()
# if havetoadd:
# schedule_entry_db.define_clean_source()
# self.logger.debug("Storing entries... playlist_id: " + str(playlist["id"]) + " schedule_id: " + str(schedule_db.schedule_id) + " num: " + str(entrynum))
# schedule_entry_db.store(add=havetoadd, commit=True)
# return schedule_entry_db
# ------------------------------------------------------------------------------------------ #
# def __calc_date_to__(self):
# if self.dateto:
# return True
# if not self.until:
# return False
# if not self.datefrom:
# return False
# date_start = datetime.strptime(self.datefrom.replace("T"," "), "%Y-%m-%d %H:%M:%S")
# time_start = date_start.strftime("%H:%M")
# day_offset = 1 if (time_start > self.until) else 0
# end_date = date_start + timedelta(day_offset)
# self.dateto = end_date.strftime("%F") + "T" + self.until
# return True
# ------------------------------------------------------------------------------------------ #
# @staticmethod
# def __calc_duration__(start, end):
# """
# Berechnet Zeit in Sekunden aus Differenz zwischen Start und Enddatum
# @type start: datetime
# @param start: Startzeit
# @type end: datetime
# @param end: Endzeit
# @rtype: int
# @return: Zeit in Sekunden
# """
# sec1 = int(datetime.strptime(start[0:16].replace(" ","T"),"%Y-%m-%dT%H:%M").strftime("%s"))
# sec2 = int(datetime.strptime(end[0:16].replace(" ","T"),"%Y-%m-%dT%H:%M").strftime("%s"))
# return (sec2 - sec1)
# ------------------------------------------------------------------------------------------ #
# def get_length(self, entry):
# if entry is None or entry.type == ScheduleEntryType.STREAM or entry.type == ScheduleEntryType.LIVE_0 or entry.type == ScheduleEntryType.LIVE_1 or entry.type == ScheduleEntryType.LIVE_2 or entry.type == ScheduleEntryType.LIVE_3 or entry.type == ScheduleEntryType.LIVE_4:
# return 0
# audio_file = FLAC(entry.cleansource)
# return audio_file.info.length
# ------------------------------------------------------------------------------------------ #
# FIXME is it needed?
# def __set_url__(self, type):
# #url = self.config.get(type+"url")
# pos = url.find("?")
# if pos > 0:
# self.url[type] = url[0:pos]
# self.data[type] = url[pos:]
# else:
# self.url[type] = url
# ------------------------------------------------------------------------------------------ #
def stop(self): def stop(self):
self._stop_event.set() self._stop_event.set()
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