diff --git a/python_apps/pypo/pypo-cli.py b/python_apps/pypo/pypo-cli.py index 76f5482a5..8ececc23d 100755 --- a/python_apps/pypo/pypo-cli.py +++ b/python_apps/pypo/pypo-cli.py @@ -115,12 +115,6 @@ if __name__ == '__main__': signal.signal(signal.SIGINT, keyboardInterruptHandler) - #import daemonize - #daemonize.createDaemon() - #open("airtime.pid", "w").write(str(os.getpid()) + "\n") - #daemonize.drop_privileges("pypo", "pypo") - - # initialize g = Global() diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 9c7fc9d84..3100a5dd0 100755 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -83,8 +83,10 @@ class PypoFetch(Thread): def set_export_source(self, export_source): + logger = logging.getLogger('fetch') self.export_source = export_source self.cache_dir = config["cache_dir"] + self.export_source + '/' + logger.info("Creating cache directory at %s", self.cache_dir) def check_matching_timezones(self, server_timezone): logger = logging.getLogger('fetch') @@ -268,7 +270,7 @@ class PypoFetch(Thread): fileExt = os.path.splitext(media['uri'])[1] try: - dst = "%s%s/%s%s" % (self.cache_dir, str(pkey), str(media['id']), str(fileExt)) + dst = "%s%s/%s%s" % (self.cache_dir, pkey, media['id'], fileExt) # download media file self.handle_remote_file(media, dst) @@ -283,11 +285,11 @@ class PypoFetch(Thread): if fsize > 0: pl_entry = \ 'annotate:export_source="%s",media_id="%s",liq_start_next="%s",liq_fade_in="%s",liq_fade_out="%s",liq_cue_in="%s",liq_cue_out="%s",schedule_table_id="%s":%s' \ - % (str(media['export_source']), media['id'], 0, \ - str(float(media['fade_in']) / 1000), \ - str(float(media['fade_out']) / 1000), \ - str(float(media['cue_in'])), \ - str(float(media['cue_out'])), \ + % (media['export_source'], media['id'], 0, \ + float(media['fade_in']) / 1000, \ + float(media['fade_out']) / 1000, \ + float(media['cue_in']), \ + float(media['cue_out']), \ media['row_id'], dst) """ @@ -375,7 +377,7 @@ class PypoFetch(Thread): loops = 1 while True: - logger.info("Loop #"+str(loops)) + logger.info("Loop #%s", loops) try: # Wait for messages from RabbitMQ. Timeout if we # dont get any after POLL_INTERVAL. diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index 3eb9090c8..e867ebcfc 100755 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -163,8 +163,8 @@ class PypoPush(Thread): #Return the time as a floating point number expressed in seconds since the epoch, in UTC. epoch_now = time.time() - logger.debug("Epoch start: " + str(epoch_start)) - logger.debug("Epoch now: " + str(epoch_now)) + logger.debug("Epoch start: %s" % epoch_start) + logger.debug("Epoch now: %s" % epoch_now) sleep_time = epoch_start - epoch_now; @@ -184,8 +184,8 @@ class PypoPush(Thread): liquidsoap_data = self.api_client.get_liquidsoap_data(pkey, schedule) #Sending schedule table row id string. - logger.debug("vars.pypo_data %s\n"%(str(liquidsoap_data["schedule_id"]))) - tn.write(("vars.pypo_data %s\n"%str(liquidsoap_data["schedule_id"])).encode('latin-1')) + logger.debug("vars.pypo_data %s\n"%(liquidsoap_data["schedule_id"])) + tn.write(("vars.pypo_data %s\n"%liquidsoap_data["schedule_id"]).encode('latin-1')) logger.debug('Preparing to push playlist %s' % pkey) for item in playlist: