From ca535ea763eab999499bfd9bdcb9e0987dc6efe1 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Thu, 23 Feb 2012 16:08:16 -0500 Subject: [PATCH] Removed OBP refs and code. --- .../upgrades/airtime-1.8.0/pypo.cfg.180 | 27 --- .../upgrades/airtime-1.8.1/pypo.cfg.181 | 27 --- .../upgrades/airtime-1.8.2/pypo.cfg.182 | 27 --- .../upgrades/airtime-1.9.0/api_client.cfg.190 | 21 -- .../upgrades/airtime-1.9.2/api_client.cfg.192 | 21 -- .../upgrades/airtime-1.9.3/api_client.cfg.193 | 20 -- .../upgrades/airtime-1.9.4/api_client.cfg.194 | 20 -- .../upgrades/airtime-2.0.0/api_client.cfg.200 | 20 -- .../upgrades/airtime-2.0.1/api_client.cfg.201 | 20 -- python_apps/api_clients/api_client.cfg | 20 -- python_apps/api_clients/api_client.py | 228 ------------------ python_apps/pypo/util/__init__.py | 4 - python_apps/pypo/util/status.py | 57 ----- 13 files changed, 512 deletions(-) delete mode 100644 python_apps/pypo/util/__init__.py delete mode 100644 python_apps/pypo/util/status.py diff --git a/install_minimal/upgrades/airtime-1.8.0/pypo.cfg.180 b/install_minimal/upgrades/airtime-1.8.0/pypo.cfg.180 index e2ab6fead..bdef4facf 100644 --- a/install_minimal/upgrades/airtime-1.8.0/pypo.cfg.180 +++ b/install_minimal/upgrades/airtime-1.8.0/pypo.cfg.180 @@ -110,30 +110,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med generate_range_url = 'generate_range_dp.php' -############## -# OBP config # -############## -# Value needed to access the API -#api_key = 'AAA' - -#base_url = 'http://localhost/' - -# Path to the base of the API -#api_base = '' - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-1.8.1/pypo.cfg.181 b/install_minimal/upgrades/airtime-1.8.1/pypo.cfg.181 index e2ab6fead..bdef4facf 100644 --- a/install_minimal/upgrades/airtime-1.8.1/pypo.cfg.181 +++ b/install_minimal/upgrades/airtime-1.8.1/pypo.cfg.181 @@ -110,30 +110,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med generate_range_url = 'generate_range_dp.php' -############## -# OBP config # -############## -# Value needed to access the API -#api_key = 'AAA' - -#base_url = 'http://localhost/' - -# Path to the base of the API -#api_base = '' - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-1.8.2/pypo.cfg.182 b/install_minimal/upgrades/airtime-1.8.2/pypo.cfg.182 index e2ab6fead..bdef4facf 100644 --- a/install_minimal/upgrades/airtime-1.8.2/pypo.cfg.182 +++ b/install_minimal/upgrades/airtime-1.8.2/pypo.cfg.182 @@ -110,30 +110,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med generate_range_url = 'generate_range_dp.php' -############## -# OBP config # -############## -# Value needed to access the API -#api_key = 'AAA' - -#base_url = 'http://localhost/' - -# Path to the base of the API -#api_base = '' - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-1.9.0/api_client.cfg.190 b/install_minimal/upgrades/airtime-1.9.0/api_client.cfg.190 index 7c94e34c2..47e695c38 100644 --- a/install_minimal/upgrades/airtime-1.9.0/api_client.cfg.190 +++ b/install_minimal/upgrades/airtime-1.9.0/api_client.cfg.190 @@ -87,24 +87,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med # ??? generate_range_url = 'generate_range_dp.php' - -############## -# OBP config # -############## - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-1.9.2/api_client.cfg.192 b/install_minimal/upgrades/airtime-1.9.2/api_client.cfg.192 index 7c94e34c2..47e695c38 100644 --- a/install_minimal/upgrades/airtime-1.9.2/api_client.cfg.192 +++ b/install_minimal/upgrades/airtime-1.9.2/api_client.cfg.192 @@ -87,24 +87,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med # ??? generate_range_url = 'generate_range_dp.php' - -############## -# OBP config # -############## - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-1.9.3/api_client.cfg.193 b/install_minimal/upgrades/airtime-1.9.3/api_client.cfg.193 index 7c94e34c2..4b3d027b6 100644 --- a/install_minimal/upgrades/airtime-1.9.3/api_client.cfg.193 +++ b/install_minimal/upgrades/airtime-1.9.3/api_client.cfg.193 @@ -88,23 +88,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med generate_range_url = 'generate_range_dp.php' -############## -# OBP config # -############## - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-1.9.4/api_client.cfg.194 b/install_minimal/upgrades/airtime-1.9.4/api_client.cfg.194 index 7c94e34c2..4b3d027b6 100644 --- a/install_minimal/upgrades/airtime-1.9.4/api_client.cfg.194 +++ b/install_minimal/upgrades/airtime-1.9.4/api_client.cfg.194 @@ -88,23 +88,3 @@ update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/med generate_range_url = 'generate_range_dp.php' -############## -# OBP config # -############## - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-2.0.0/api_client.cfg.200 b/install_minimal/upgrades/airtime-2.0.0/api_client.cfg.200 index 2d51bb2d2..f7c63bee8 100644 --- a/install_minimal/upgrades/airtime-2.0.0/api_client.cfg.200 +++ b/install_minimal/upgrades/airtime-2.0.0/api_client.cfg.200 @@ -95,23 +95,3 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/' #URL to update liquidsoap status update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' -############## -# OBP config # -############## - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 b/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 index 2d51bb2d2..f7c63bee8 100644 --- a/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 +++ b/install_minimal/upgrades/airtime-2.0.1/api_client.cfg.201 @@ -95,23 +95,3 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/' #URL to update liquidsoap status update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' -############## -# OBP config # -############## - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/python_apps/api_clients/api_client.cfg b/python_apps/api_clients/api_client.cfg index 07656cabc..1e7e01edc 100644 --- a/python_apps/api_clients/api_client.cfg +++ b/python_apps/api_clients/api_client.cfg @@ -101,23 +101,3 @@ get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/' #URL to update liquidsoap status update_liquidsoap_status = 'update-liquidsoap-status/format/json/api_key/%%api_key%%/msg/%%msg%%/stream_id/%%stream_id%%/boot_time/%%boot_time%%' -############## -# OBP config # -############## - -# URL to get the version number of the server API -#version_url = 'api/pypo/status/json' - -# Schedule export path. -# %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm -# %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm - -# Update whether an item has been played. -#update_item_url = 'api/pypo/update_shedueled_item/$$item_id%%?played=%%played%%' - -# Update whether an item is currently playing. -#update_start_playing_url = 'api/pypo/mod/medialibrary/?playlist_type=%%playlist_type%%&export_source=%%export_source%%&media_id=%%media_id%%&playlist_id=%%playlist_id%%&transmission_id=%%transmission_id%%' - -# ??? -#generate_range_url = 'api/pypo/generate_range_dp/' - diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index c6bd1763f..c40ce4cc0 100755 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -636,231 +636,3 @@ class AirTimeApiClient(ApiClientInterface): logger.error('Exception: %s', e) logger.error("traceback: %s", top) -################################################################################ -# OpenBroadcast API Client -################################################################################ -# Also check out the php counterpart that handles the api requests: -# https://lab.digris.ch/svn/elgg/trunk/unstable/mod/medialibrary/application/controllers/api/pypo.php - -OBP_MIN_VERSION = 2010100101 # required obp version - -class ObpApiClient(): - - def __init__(self, config): - self.config = config - self.api_auth = urllib.urlencode({'api_key': self.config["api_key"]}) - - def is_server_compatible(self, verbose = True): - logger = logging.getLogger() - obp_version = self.get_obp_version() - - if obp_version == 0: - if (verbose): - logger.error('Unable to get OBP version. Is OBP up and running?\n') - return False - elif obp_version < OBP_MIN_VERSION: - if (verbose): - logger.warn('OBP version: ' + str(obp_version)) - logger.warn('OBP min-version: ' + str(OBP_MIN_VERSION)) - logger.warn('pypo not compatible with this version of OBP\n') - return False - else: - if (verbose): - logger.warn('OBP API: ' + str(API_BASE)) - logger.warn('OBP version: ' + str(obp_version)) - logger.warn('OBP min-version: ' + str(OBP_MIN_VERSION)) - logger.warn('pypo is compatible with this version of OBP\n') - return True - - - def get_obp_version(self): - logger = logging.getLogger() - - # lookup OBP version - #url = self.config["base_url"] + self.config["api_base"]+ self.config["version_url"] - url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["version_url"]) - - - try: - logger.debug("Trying to contact %s", url) - response = urllib.urlopen(url, self.api_auth) - response_json = json.loads(response.read()) - obp_version = int(response_json['version']) - logger.debug("OBP Version %s detected", obp_version) - - except Exception, e: - try: - if e[1] == 401: - logger.error('#####################################') - logger.error('# YOUR API KEY SEEMS TO BE INVALID') - logger.error('# ' + self.config["api_auth"]) - logger.error('#####################################') - sys.exit() - - except Exception, e: - pass - - try: - if e[1] == 404: - logger.error('#####################################') - logger.error('# Unable to contact the OBP-API') - logger.error('# ' + url) - logger.error('#####################################') - sys.exit() - - except Exception, e: - pass - - obp_version = 0 - logger.error("Unable to detect OBP Version - %s", e) - - return obp_version - - """ - NOTE: The server currently ignores start and end parameters we send to it. - """ - def get_schedule(self, start=None, end=None): - logger = logging.getLogger() - - """ - calculate start/end time range (format: YYYY-DD-MM-hh-mm-ss,YYYY-DD-MM-hh-mm-ss) - (seconds are ignored, just here for consistency) - """ - if (not start): - tstart = time.gmtime(time.time() - 3600 * int(self.config["cache_for"])) - start = "%04d-%02d-%02d-%02d-%02d" % (tstart[0], tstart[1], tstart[2], tstart[3], tstart[4]) - - if (not end): - tend = time.gmtime(time.time() + 3600 * int(self.config["prepare_ahead"])) - end = "%04d-%02d-%02d-%02d-%02d" % (tend[0], tend[1], tend[2], tend[3], tend[4]) - - range = {} - range['start'] = start - range['end'] = end - - # Construct the URL - #export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"] - export_url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["export_url"]) - - # Insert the start and end times into the URL - export_url = export_url.replace('%%api_key%%', self.config["api_key"]) - export_url = export_url.replace('%%from%%', range['start']) - export_url = export_url.replace('%%to%%', range['end']) - logger.info("export from %s", export_url) - - response = "" - status = 0 - try: - response_json = urllib.urlopen(export_url).read() - logger.debug("%s", response_json) - response = json.loads(response_json) - logger.info("export status %s", response['check']) - status = response['check'] - except Exception, e: - logger.error(e) - - return status, response - - - def get_media(self, src, dest): - try: - logger.info('** urllib auth with: ' + self.api_auth) - urllib.urlretrieve(src, dst, False, self.api_auth) - logger.info("downloaded %s to %s", src, dst) - except Exception, e: - logger.error("%s", e) - - - """ - Tell server that the scheduled *playlist* has started. - """ - def notify_scheduled_item_start_playing(self, pkey, schedule): - #def update_scheduled_item(self, item_id, value): - logger = logging.getLogger() - #url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"] - url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_item_url"]) - url = url.replace("%%item_id%%", str(schedule[pkey]["id"])) - url = url.replace("%%played%%", "1") - - try: - response = urllib.urlopen(url, self.api_auth) - response = json.loads(response.read()) - logger.info("API-Status %s", response['status']) - logger.info("API-Message %s", response['message']) - - except Exception, e: - api_status = False - logger.error("Unable to connect to the OBP API - %s", e) - - return response - - """ - This is a callback from liquidsoap, we use this to notify about the - currently playing *song*. We get passed a JSON string which we handed to - liquidsoap in get_liquidsoap_data(). - """ - def notify_media_item_start_playing(self, data, media_id): -# def update_start_playing(self, playlist_type, export_source, media_id, playlist_id, transmission_id): - logger = logging.getLogger() - playlist_type = data["playlist_type"] - export_source = data["export_source"] - playlist_id = data["playlist_id"] - transmission_id = data["transmission_id"] - - #url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"] - url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["update_start_playing_url"]) - url = url.replace("%%playlist_type%%", str(playlist_type)) - url = url.replace("%%export_source%%", str(export_source)) - url = url.replace("%%media_id%%", str(media_id)) - url = url.replace("%%playlist_id%%", str(playlist_id)) - url = url.replace("%%transmission_id%%", str(transmission_id)) - logger.info(url) - - try: - response = urllib.urlopen(url, self.api_auth) - response = json.loads(response.read()) - logger.info("API-Status %s", response['status']) - logger.info("API-Message %s", response['message']) - logger.info("TXT %s", response['str_dls']) - - except Exception, e: - api_status = False - logger.error("Unable to connect to the OBP API - %s", e) - - return response - - - def generate_range_dp(self): - logger = logging.getLogger() - - #url = self.config["base_url"] + self.config["api_base"] + self.config["generate_range_url"] - url = "http://%s:%s/%s/%s" % (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["generate_range_url"]) - - try: - response = urllib.urlopen(url, self.api_auth) - response = json.loads(response.read()) - logger.debug("Trying to contact %s", url) - logger.info("API-Status %s", response['status']) - logger.info("API-Message %s", response['message']) - - except Exception, e: - api_status = False - logger.error("Unable to handle the OBP API request - %s", e) - - return response - - def get_liquidsoap_data(self, pkey, schedule): - playlist = schedule[pkey] - data = dict() - #data["ptype"] = playlist['subtype'] - try: - data["user_id"] = playlist['user_id'] - data["playlist_id"] = playlist['id'] - data["transmission_id"] = playlist['schedule_id'] - except Exception, e: - data["playlist_id"] = 0 - data["user_id"] = 0 - data["transmission_id"] = 0 - data = json.dumps(data) - return data - diff --git a/python_apps/pypo/util/__init__.py b/python_apps/pypo/util/__init__.py deleted file mode 100644 index afb963b43..000000000 --- a/python_apps/pypo/util/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- - -from json import * -from status import * \ No newline at end of file diff --git a/python_apps/pypo/util/status.py b/python_apps/pypo/util/status.py deleted file mode 100644 index 1ea3f816a..000000000 --- a/python_apps/pypo/util/status.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -import sys -import time -import urllib - -import logging - -import telnetlib -import json - -import os - -ALLOWED_EXTS = ('mp3') - -class Callable: - def __init__(self, anycallable): - self.__call__ = anycallable - -class Status: - def __init__(self, status_url): - self.status_url = status_url - def get_obp_version(self): - logger = logging.getLogger("status.get_obp_version") - # lookup OBP version - try: - response = urllib.urlopen(self.status_url) - response_json = json.loads(response.read()) - obp_version = int(response_json['version']) - logger.debug("OBP Version %s detected", obp_version) - - except Exception, e: - print e - obp_version = 0 - logger.error("Unable to detect OBP Version - %s", e) - - - return obp_version - - - def check_ls(self, ls_host, ls_port): - logger = logging.getLogger("status.get_ls_version") - # lookup OBP version - try: - tn = telnetlib.Telnet(ls_host, ls_port) - tn.write("\n") - tn.write("version\n") - tn.write("exit\n") - print tn.read_all() - logger.info("liquidsoap connection ok") - return 1 - - except Exception, e: - obp_version = 0 - logger.error("Unable to connect to liquidsoap") - return 0 - -