Merge pull request #1373 from jooola/feat/rename_python_packages

Rename python packages/entrypoints
This commit is contained in:
Kyle Robbertze 2021-10-14 14:06:50 +00:00 committed by GitHub
commit 2f3adac09d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 55 additions and 54 deletions

View File

@ -11,8 +11,8 @@ usage() {
if [ "$1" = "--enable" ]; then if [ "$1" = "--enable" ]; then
/etc/init.d/airtime-playout stop /etc/init.d/libretime-playout stop
/etc/init.d/airtime-playout start-liquidsoap /etc/init.d/libretime-playout start-liquidsoap
user=$2 user=$2
@ -30,8 +30,8 @@ elif [ "$1" = "--disable" ]; then
chown -Rv $user:$user /var/tmp/airtime/pypo/ chown -Rv $user:$user /var/tmp/airtime/pypo/
chmod -v a+r /etc/airtime/api_client.cfg chmod -v a+r /etc/airtime/api_client.cfg
/etc/init.d/airtime-playout stop-liquidsoap /etc/init.d/libretime-playout stop-liquidsoap
/etc/init.d/airtime-playout start /etc/init.d/libretime-playout start
else else
usage usage
fi fi

View File

@ -1015,7 +1015,7 @@ if [ ! -d /var/log/airtime ]; then
verbose "\n * Copying logrotate files..." verbose "\n * Copying logrotate files..."
loudCmd "cp ${AIRTIMEROOT}/legacy/build/airtime-php.logrotate /etc/logrotate.d/airtime-php" loudCmd "cp ${AIRTIMEROOT}/legacy/build/airtime-php.logrotate /etc/logrotate.d/airtime-php"
loudCmd "cp ${AIRTIMEROOT}/python_apps/pypo/liquidsoap/airtime-liquidsoap.logrotate /etc/logrotate.d/airtime-liquidsoap" loudCmd "cp ${AIRTIMEROOT}/python_apps/pypo/liquidsoap/logrotate.conf /etc/logrotate.d/libretime-liquidsoap"
fi fi
verbose "\n * Installing API client..." verbose "\n * Installing API client..."

View File

@ -5,15 +5,15 @@ class Application_Model_Systemstatus
public static function GetMonitStatus($p_ip) public static function GetMonitStatus($p_ip)
{ {
$CC_CONFIG = Config::getConfig(); $CC_CONFIG = Config::getConfig();
// $monit_user = $CC_CONFIG['monit_user']; // $monit_user = $CC_CONFIG['monit_user'];
// $monit_password = $CC_CONFIG['monit_password']; // $monit_password = $CC_CONFIG['monit_password'];
$url = "http://{$p_ip}:2812/_status?format=xml"; $url = "http://{$p_ip}:2812/_status?format=xml";
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password"); // curl_setopt($ch, CURLOPT_USERPWD, "$monit_user:$monit_password");
//wait a max of 3 seconds before aborting connection attempt //wait a max of 3 seconds before aborting connection attempt
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
$result = curl_exec($ch); $result = curl_exec($ch);
@ -42,7 +42,8 @@ class Application_Model_Systemstatus
'status' => 0, 'status' => 0,
'memory_perc' => '0%', 'memory_perc' => '0%',
'memory_kb' => '0', 'memory_kb' => '0',
'cpu_perc' => '0%', ]; 'cpu_perc' => '0%',
];
$notMonitored = [ $notMonitored = [
'name' => $p_serviceName, 'name' => $p_serviceName,
@ -153,7 +154,7 @@ class Application_Model_Systemstatus
$docRoot = self::GetMonitStatus($ip); $docRoot = self::GetMonitStatus($ip);
return self::ExtractServiceInformation($docRoot, 'airtime-playout'); return self::ExtractServiceInformation($docRoot, 'libretime-playout');
} }
public static function GetLiquidsoapStatus() public static function GetLiquidsoapStatus()
@ -166,7 +167,7 @@ class Application_Model_Systemstatus
$docRoot = self::GetMonitStatus($ip); $docRoot = self::GetMonitStatus($ip);
return self::ExtractServiceInformation($docRoot, 'airtime-liquidsoap'); return self::ExtractServiceInformation($docRoot, 'libretime-liquidsoap');
} }
public static function GetMediaMonitorStatus() public static function GetMediaMonitorStatus()

View File

@ -136,13 +136,13 @@ function checkAnalyzerService()
} }
/** /**
* Check if airtime-playout is currently running. * Check if libretime-playout is currently running.
* *
* @return bool true if airtime-playout is running * @return bool true if libretime-playout is running
*/ */
function checkPlayoutService() function checkPlayoutService()
{ {
exec('pgrep -f airtime-playout', $out, $status); exec('pgrep -f libretime-playout', $out, $status);
if ($out > 0) { if ($out > 0) {
return posix_kill(rtrim($out[0]), 0); return posix_kill(rtrim($out[0]), 0);
} }
@ -151,13 +151,13 @@ function checkPlayoutService()
} }
/** /**
* Check if airtime-liquidsoap is currently running. * Check if libretime-liquidsoap is currently running.
* *
* @return bool true if airtime-liquidsoap is running * @return bool true if libretime-liquidsoap is running
*/ */
function checkLiquidsoapService() function checkLiquidsoapService()
{ {
exec('pgrep -f airtime-liquidsoap', $out, $status); exec('pgrep -f libretime-liquidsoap', $out, $status);
if ($out > 0) { if ($out > 0) {
return posix_kill(rtrim($out[0]), 0); return posix_kill(rtrim($out[0]), 0);
} }
@ -166,9 +166,9 @@ function checkLiquidsoapService()
} }
/** /**
* Check if airtime-celery is currently running. * Check if libretime-celery is currently running.
* *
* @return bool true if airtime-celery is running * @return bool true if libretime-celery is running
*/ */
function checkCeleryService() function checkCeleryService()
{ {

View File

@ -6,7 +6,7 @@ from setuptools import setup
os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir(os.path.dirname(os.path.realpath(__file__)))
setup( setup(
name="airtime-celery", name="libretime-celery",
version="0.1", version="0.1",
description="LibreTime Celery", description="LibreTime Celery",
author="LibreTime Contributors", author="LibreTime Contributors",

View File

@ -6,7 +6,7 @@ from setuptools import setup
os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir(os.path.dirname(os.path.realpath(__file__)))
setup( setup(
name="api_clients", name="libretime-api-client",
version="2.0.0", version="2.0.0",
description="LibreTime API Client", description="LibreTime API Client",
author="LibreTime Contributors", author="LibreTime Contributors",

View File

@ -2,7 +2,7 @@
Description=Libretime Liquidsoap Service Description=Libretime Liquidsoap Service
[Service] [Service]
ExecStart=/usr/local/bin/airtime-liquidsoap ExecStart=/usr/local/bin/libretime-liquidsoap
User=libretime-playout User=libretime-playout
Group=libretime-playout Group=libretime-playout
Restart=always Restart=always

View File

@ -3,7 +3,7 @@ Description=Libretime Playout Service
After=network-online.target After=network-online.target
[Service] [Service]
ExecStart=/usr/local/bin/airtime-playout ExecStart=/usr/local/bin/libretime-playout
User=libretime-pypo User=libretime-pypo
Group=libretime-pypo Group=libretime-pypo
Restart=always Restart=always

View File

@ -1,5 +1,5 @@
def notify(m) def notify(m)
command = "timeout --signal=KILL 45 pyponotify --media-id=#{m['schedule_table_id']} &" command = "timeout --signal=KILL 45 libretime-playout-notify --media-id=#{m['schedule_table_id']} &"
log(command) log(command)
system(command) system(command)
end end
@ -15,7 +15,7 @@ def notify_stream(m)
#if a string has a single apostrophe in it, let's comment it out by ending the string before right before it #if a string has a single apostrophe in it, let's comment it out by ending the string before right before it
#escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes. #escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes.
json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str) json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str)
command = "timeout --signal=KILL 45 pyponotify --webstream='#{json_str}' --media-id=#{!current_dyn_id} &" command = "timeout --signal=KILL 45 libretime-playout-notify --webstream='#{json_str}' --media-id=#{!current_dyn_id} &"
if !current_dyn_id != "-1" then if !current_dyn_id != "-1" then
log(command) log(command)
@ -97,14 +97,14 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
source = ref s source = ref s
def on_error(msg) def on_error(msg)
connected := "false" connected := "false"
command = "timeout --signal=KILL 45 pyponotify --error='#{msg}' --stream-id=#{stream} --time=#{!time} &" command = "timeout --signal=KILL 45 libretime-playout-notify --error='#{msg}' --stream-id=#{stream} --time=#{!time} &"
system(command) system(command)
log(command) log(command)
5. 5.
end end
def on_connect() def on_connect()
connected := "true" connected := "true"
command = "timeout --signal=KILL 45 pyponotify --connect --stream-id=#{stream} --time=#{!time} &" command = "timeout --signal=KILL 45 libretime-playout-notify --connect --stream-id=#{stream} --time=#{!time} &"
system(command) system(command)
log(command) log(command)
end end

View File

@ -212,7 +212,7 @@ def make_scheduled_play_unavailable()
end end
def update_source_status(sourcename, status) = def update_source_status(sourcename, status) =
command = "timeout --signal=KILL 45 pyponotify --source-name=#{sourcename} --source-status=#{status} &" command = "timeout --signal=KILL 45 libretime-playout-notify --source-name=#{sourcename} --source-status=#{status} &"
system(command) system(command)
log(command) log(command)
end end
@ -438,6 +438,6 @@ if s4_enable == true then
end end
command = "timeout --signal=KILL 45 pyponotify --liquidsoap-started &" command = "timeout --signal=KILL 45 libretime-playout-notify --liquidsoap-started &"
log(command) log(command)
system(command) system(command)

View File

@ -1,5 +1,5 @@
def notify(m) def notify(m)
command = "timeout --signal=KILL 45 pyponotify --media-id=#{m['schedule_table_id']} &" command = "timeout --signal=KILL 45 libretime-playout-notify --media-id=#{m['schedule_table_id']} &"
log(command) log(command)
system(command) system(command)
end end
@ -15,7 +15,7 @@ def notify_stream(m)
#if a string has a single apostrophe in it, let's comment it out by ending the string before right before it #if a string has a single apostrophe in it, let's comment it out by ending the string before right before it
#escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes. #escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes.
json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str) json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str)
command = "timeout --signal=KILL 45 pyponotify --webstream='#{json_str}' --media-id=#{!current_dyn_id} &" command = "timeout --signal=KILL 45 libretime-playout-notify --webstream='#{json_str}' --media-id=#{!current_dyn_id} &"
if !current_dyn_id != "-1" then if !current_dyn_id != "-1" then
log(command) log(command)
@ -97,14 +97,14 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
source = ref s source = ref s
def on_error(msg) def on_error(msg)
connected := "false" connected := "false"
command = "timeout --signal=KILL 45 pyponotify --error='#{msg}' --stream-id=#{stream} --time=#{!time} &" command = "timeout --signal=KILL 45 libretime-playout-notify --error='#{msg}' --stream-id=#{stream} --time=#{!time} &"
system(command) system(command)
log(command) log(command)
5. 5.
end end
def on_connect() def on_connect()
connected := "true" connected := "true"
command = "timeout --signal=KILL 45 pyponotify --connect --stream-id=#{stream} --time=#{!time} &" command = "timeout --signal=KILL 45 libretime-playout-notify --connect --stream-id=#{stream} --time=#{!time} &"
system(command) system(command)
log(command) log(command)
end end

View File

@ -212,7 +212,7 @@ def make_scheduled_play_unavailable()
end end
def update_source_status(sourcename, status) = def update_source_status(sourcename, status) =
command = "timeout --signal=KILL 45 pyponotify --source-name=#{sourcename} --source-status=#{status} &" command = "timeout --signal=KILL 45 libretime-playout-notify --source-name=#{sourcename} --source-status=#{status} &"
system(command) system(command)
log(command) log(command)
end end
@ -452,6 +452,6 @@ if s4_enable == true then
end end
command = "timeout --signal=KILL 45 pyponotify --liquidsoap-started &" command = "timeout --signal=KILL 45 libretime-playout-notify --liquidsoap-started &"
log(command) log(command)
system(command) system(command)

View File

@ -1,5 +1,5 @@
def notify(m) def notify(m)
command = "timeout --signal=KILL 45 pyponotify --media-id=#{m['schedule_table_id']} &" command = "timeout --signal=KILL 45 libretime-playout-notify --media-id=#{m['schedule_table_id']} &"
log(command) log(command)
system(command) system(command)
end end
@ -15,7 +15,7 @@ def notify_stream(m)
#if a string has a single apostrophe in it, let's comment it out by ending the string before right before it #if a string has a single apostrophe in it, let's comment it out by ending the string before right before it
#escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes. #escaping the apostrophe, and then starting a new string right after it. This is why we use 3 apostrophes.
json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str) json_str = string.replace(pattern="'",(fun (s) -> "'\''"), json_str)
command = "timeout --signal=KILL 45 pyponotify --webstream='#{json_str}' --media-id=#{!current_dyn_id} &" command = "timeout --signal=KILL 45 libretime-playout-notify --webstream='#{json_str}' --media-id=#{!current_dyn_id} &"
if !current_dyn_id != "-1" then if !current_dyn_id != "-1" then
log(command) log(command)
@ -88,14 +88,14 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
source = ref s source = ref s
def on_error(msg) def on_error(msg)
connected := "false" connected := "false"
command = "timeout --signal=KILL 45 pyponotify --error='#{msg}' --stream-id=#{stream} --time=#{!time} &" command = "timeout --signal=KILL 45 libretime-playout-notify --error='#{msg}' --stream-id=#{stream} --time=#{!time} &"
system(command) system(command)
log(command) log(command)
5. 5.
end end
def on_connect() def on_connect()
connected := "true" connected := "true"
command = "timeout --signal=KILL 45 pyponotify --connect --stream-id=#{stream} --time=#{!time} &" command = "timeout --signal=KILL 45 libretime-playout-notify --connect --stream-id=#{stream} --time=#{!time} &"
system(command) system(command)
log(command) log(command)
end end

View File

@ -215,7 +215,7 @@ def make_scheduled_play_unavailable()
end end
def update_source_status(sourcename, status) = def update_source_status(sourcename, status) =
command = "timeout --signal=KILL 45 pyponotify --source-name=#{sourcename} --source-status=#{status} &" command = "timeout --signal=KILL 45 libretime-playout-notify --source-name=#{sourcename} --source-status=#{status} &"
system(command) system(command)
log(command) log(command)
end end
@ -455,6 +455,6 @@ if s4_enable == true then
end end
command = "timeout --signal=KILL 45 pyponotify --liquidsoap-started &" command = "timeout --signal=KILL 45 libretime-playout-notify --liquidsoap-started &"
log(command) log(command)
system(command) system(command)

View File

@ -36,7 +36,7 @@ def run():
) )
exec_args = [ exec_args = [
"/usr/bin/liquidsoap", "/usr/bin/liquidsoap",
"airtime-liquidsoap", "libretime-liquidsoap",
script_path, script_path,
"--verbose", "--verbose",
"-f", "-f",

View File

@ -6,6 +6,6 @@
notifempty notifempty
sharedscripts sharedscripts
postrotate postrotate
systemctl kill --signal=SIGUSR1 airtime-liquidsoap >/dev/null 2>&1 || true systemctl kill --signal=SIGUSR1 libretime-liquidsoap >/dev/null 2>&1 || true
endscript endscript
} }

View File

@ -193,7 +193,7 @@ class PypoFetch(Thread):
self.logger.info("Restarting Liquidsoap") self.logger.info("Restarting Liquidsoap")
subprocess.call( subprocess.call(
"kill -9 `pidof airtime-liquidsoap`", shell=True, close_fds=True "kill -9 `pidof libretime-liquidsoap`", shell=True, close_fds=True
) )
# Wait here and poll Liquidsoap until it has started up # Wait here and poll Liquidsoap until it has started up

View File

@ -8,7 +8,7 @@ here = Path(__file__).parent
chdir(here) chdir(here)
setup( setup(
name="airtime-playout", name="libretime-playout",
version="1.0", version="1.0",
description="LibreTime Playout", description="LibreTime Playout",
author="LibreTime Contributors", author="LibreTime Contributors",
@ -25,13 +25,13 @@ setup(
], ],
package_data={"": ["**/*.liq", "*.cfg", "*.types"]}, package_data={"": ["**/*.liq", "*.cfg", "*.types"]},
scripts=[ scripts=[
"bin/airtime-playout", "bin/libretime-playout",
"bin/airtime-liquidsoap", "bin/libretime-liquidsoap",
"bin/pyponotify", "bin/libretime-playout-notify",
], ],
python_requires=">=3.6", python_requires=">=3.6",
install_requires=[ install_requires=[
f"api_clients @ file://localhost/{here.parent}/api_clients#egg=api_clients", f"libretime-api-client @ file://localhost/{here.parent}/api_clients#egg=libretime-api-client",
"amqplib", "amqplib",
"configobj", "configobj",
"defusedxml", "defusedxml",

View File

@ -49,7 +49,7 @@ echo -e "The following files, directories, and services will be removed:\n"
for i in ${FILES[*]}; do for i in ${FILES[*]}; do
echo "$i" echo "$i"
done done
echo "pip3 airtime-playout" echo "pip3 libretime-playout"
echo -e "\nIf your web root is not listed, you will need to manually remove it." echo -e "\nIf your web root is not listed, you will need to manually remove it."
@ -87,6 +87,6 @@ if [[ $IN == "y" || $IN == "Y" ]]; then
dropLibreTimeDatabase dropLibreTimeDatabase
fi fi
pip3 uninstall -y airtime-playout airtime-media-monitor airtime-analyzer pip3 uninstall -y libretime-playout airtime-media-monitor airtime-analyzer
service apache2 restart service apache2 restart
echo "...Done" echo "...Done"

View File

@ -30,9 +30,9 @@ def find_liquidsoap_binary():
the location of this binary. the location of this binary.
""" """
rv = subprocess.call("which airtime-liquidsoap > /dev/null", shell=True) rv = subprocess.call("which libretime-liquidsoap > /dev/null", shell=True)
if rv == 0: if rv == 0:
return "airtime-liquidsoap" return "libretime-liquidsoap"
return None return None

View File

@ -30,7 +30,7 @@ def printUsage():
def find_liquidsoap_binary(): def find_liquidsoap_binary():
""" """
With libretime 3.0 we are no longer depending upon the airtime-liquidsoap binary With libretime 3.0 we are no longer depending upon the libretime-liquidsoap binary
but use a generic install of liquidsoap. This takes care of checking if it is on the but use a generic install of liquidsoap. This takes care of checking if it is on the
path and will lead to an error otherwise. path and will lead to an error otherwise.
""" """