From cf414239e22832701ad931b606f16bf1421281cf Mon Sep 17 00:00:00 2001 From: Kyle Robbertze Date: Mon, 18 May 2020 16:49:19 +0200 Subject: [PATCH 1/7] Correctly encode icecast admin credentials for listener stats Fixes: #1045 --- python_apps/pypo/pypo/listenerstat.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python_apps/pypo/pypo/listenerstat.py b/python_apps/pypo/pypo/listenerstat.py index e94c7f795..2d6371827 100644 --- a/python_apps/pypo/pypo/listenerstat.py +++ b/python_apps/pypo/pypo/listenerstat.py @@ -35,9 +35,10 @@ class ListenerStat(Thread): def get_stream_server_xml(self, ip, url, is_shoutcast=False): - encoded = base64.b64encode("%(admin_user)s:%(admin_pass)s" % ip) + auth_string = "%(admin_user)s:%(admin_pass)s" % ip + encoded = base64.b64encode(auth_string.encode('utf-8')) - header = {"Authorization":"Basic %s" % encoded} + header = {"Authorization":"Basic %s" % encoded.decode('ascii')} if is_shoutcast: #user agent is required for shoutcast auth, otherwise it returns 404. From a723ac040be4d9a8bfda958ba83d1013163619f6 Mon Sep 17 00:00:00 2001 From: Kyle Robbertze Date: Tue, 19 May 2020 22:07:50 +0200 Subject: [PATCH 2/7] Add sponsor button --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..638a63571 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +open_collective: libretime From 9467415b27ee1a95d144291a70c7a3d6d25b231e Mon Sep 17 00:00:00 2001 From: Kyle Robbertze Date: Tue, 19 May 2020 23:10:56 +0200 Subject: [PATCH 3/7] fix mkdocs references --- .travis.yml | 43 ++++++++++++++--------------------------- Vagrantfile | 6 ------ docs/scripts/_jekyll.sh | 10 +++++----- docs/scripts/install.sh | 8 -------- docs/scripts/serve.sh | 10 ---------- docs/vagrant.md | 2 +- 6 files changed, 21 insertions(+), 58 deletions(-) delete mode 100644 docs/scripts/install.sh delete mode 100644 docs/scripts/serve.sh diff --git a/.travis.yml b/.travis.yml index 48bf0b452..c3eb5766f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,7 +77,6 @@ install: if [[ "$PYTHON" == true ]]; then pyenv local 3.7 pip3 install -U pip wheel - # pip3 install --user mkdocs pip3 install --user rgain3 pushd python_apps/airtime_analyzer python3 setup.py install --dry-run --no-init-script @@ -93,30 +92,18 @@ before_script: script: - ./travis/php.sh - ./travis/python.sh -#deploy: -#- provider: pages -# skip_cleanup: true -# local_dir: build/docs -# github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard -# target_branch: master -# repo: LibreTime/LibreTime.github.io -# project_name: LibreTime -# fqdn: libretime.org -# name: R. LibreTime DocBot -# on: -# branch: master -# condition: $PYTHON = true -#- provider: script -# skip_cleanup: true -# script: ./travis/release.sh -# on: -# tags: true -# condition: $PYTHON = true -#- provider: releases -# skip_cleanup: true -# api_key: $GITHUB_TOKEN -# file_glob: true -# file: build/libretime-*.tar.gz -# on: -# tags: true -# condition: $PYTHON = true +deploy: +- provider: script + skip_cleanup: true + script: ./travis/release.sh + on: + tags: true + condition: $PYTHON = true +- provider: releases + skip_cleanup: true + api_key: $GITHUB_TOKEN + file_glob: true + file: build/libretime-*.tar.gz + on: + tags: true + condition: $PYTHON = true diff --git a/Vagrantfile b/Vagrantfile index 2f03306dd..19650274e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,8 +10,6 @@ Vagrant.configure("2") do |config| # liquidsoap input harbors for instreaming (ie. /master) config.vm.network "forwarded_port", guest: 8001, host:8001 config.vm.network "forwarded_port", guest: 8002, host:8002 - # mkdocs documentation - # config.vm.network "forwarded_port", guest: 8888, host:8888 # make sure we are using nfs (doesn't work out of the box with debian) nfsPath = "." @@ -69,10 +67,6 @@ Vagrant.configure("2") do |config| # Provision LibreTime config.vm.provision "install", type: "shell", inline: "cd /vagrant; ./install %s --web-port=8080" % installer_args - - # Provision docs - # config.vm.provision "install-mkdocs", type: "shell", path: "docs/scripts/install.sh" - # config.vm.provision "start-mkdocs", type: "shell", path: "docs/scripts/serve.sh" end end diff --git a/docs/scripts/_jekyll.sh b/docs/scripts/_jekyll.sh index d5a5dc860..75b0ddf00 100644 --- a/docs/scripts/_jekyll.sh +++ b/docs/scripts/_jekyll.sh @@ -1,12 +1,12 @@ # Installing Jekyll +# This script does not work and exists as a skeleton for +# someone to use to get Jekyll building outside of GitHub echo "Installing Ruby" sudo apt-get install ruby-full build-essential zlib1g-dev -echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc -echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc -echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc -source ~/.bashrc +export GEM_HOME=".gems" +export PATH=".gems/bin:$PATH" echo "Installing Jekyll" cd docs @@ -15,4 +15,4 @@ gem install jekyll bundler # Running Jekyll bundle exec jekyll serve --watch --port 8888 -echo "Visit http://localhost:8888 to see the LibreTime website." \ No newline at end of file +echo "Visit http://localhost:8888 to see the LibreTime website." diff --git a/docs/scripts/install.sh b/docs/scripts/install.sh deleted file mode 100644 index bcb98d6ef..000000000 --- a/docs/scripts/install.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh - -echo "Updating Apt." -apt-get update > /dev/null -echo "Ensuring Pip is installed." -DEBIAN_FRONTEND=noninteractive apt-get install -y -qq python3-pip > /dev/null -echo "Ensuring Mkdocs is installed." -pip3 install mkdocs \ No newline at end of file diff --git a/docs/scripts/serve.sh b/docs/scripts/serve.sh deleted file mode 100644 index 2596ef316..000000000 --- a/docs/scripts/serve.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -cd /vagrant -echo "Stopping any running Mkdocs servers." -pkill mkdocs -echo "Building Mkdocs documentation." -mkdocs build --clean -q > /dev/null -echo "Launching Mkdocs server." -mkdocs serve > /dev/null 2>&1 & -echo "Visit http://localhost:8888 to see the LibreTime documentation." diff --git a/docs/vagrant.md b/docs/vagrant.md index c674ac48b..513987529 100644 --- a/docs/vagrant.md +++ b/docs/vagrant.md @@ -113,4 +113,4 @@ If anything fails during the initial provisioning step you can try running `vagr to re-run the installer. If you only want to re-run parts of the installer, use `--provision-with $step`. The -supported steps are `prepare`, `install`, `install-mkdocs` and `start-mkdocs`. +supported steps are `prepare` and `install`. From ecd831ac04c5447dcb5905270af58e98cd061ed4 Mon Sep 17 00:00:00 2001 From: Kyle Robbertze Date: Tue, 19 May 2020 23:15:41 +0200 Subject: [PATCH 4/7] Set theme jekyll-theme-minimal From 5023d08156212d5d2bb958cef35956a20ecfe56a Mon Sep 17 00:00:00 2001 From: Kyle Robbertze Date: Tue, 19 May 2020 23:24:11 +0200 Subject: [PATCH 5/7] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 000000000..26a9d98ec --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +libretime.org \ No newline at end of file From afd3d7842b3f298a630dca793b6f4b7772f29307 Mon Sep 17 00:00:00 2001 From: Kyle Robbertze Date: Wed, 13 May 2020 17:10:14 +0200 Subject: [PATCH 6/7] Rewrite Travis script to be modular Fixes: #1039 --- .travis.yml | 169 ++++++++++++---------------- python_apps/airtime-celery/setup.py | 5 +- travis/install.sh | 25 ++++ travis/php.sh | 9 -- travis/python.sh | 16 --- travis/test.sh | 19 ++++ 6 files changed, 121 insertions(+), 122 deletions(-) create mode 100755 travis/install.sh delete mode 100755 travis/php.sh delete mode 100755 travis/python.sh create mode 100755 travis/test.sh diff --git a/.travis.yml b/.travis.yml index c3eb5766f..d05bf1451 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,109 +1,86 @@ dist: xenial -version: ~> 1.0 -language: php -php: -# the latest and greatest, has some issues that are excluded below in matrix.allow_failures -- 7.3 -- 7.2 -- 7.1 -# the 7.0 build demonstrates that everything is basically ok for 7.0, users might want to wait for 7.1 to run it -- 7.0 -# folks who prefer running on 5.x should be using 5.6 in most cases, 5.4 is no in the matrix since noone should use it -- 5.6 + services: -- postgresql -- rabbitmq + - postgresql + env: global: - - ENVIRONMENT=testing - - LIBRETIME_LOG_DIR=/tmp/log/libretime - jobs: - - PYTHON=false - - PYTHON=true -jobs: - allow_failures: - # there are currently some testing issues with DateTime precision on 7.1 - - env: PYTHON=false - php: 7.1 - # there are some issues with phpunit as well as some deep in zf1 on 7.2 - - env: PYTHON=false - php: 7.2 - # there are some issues with phpunit as well as some deep in zf1 on 7.3 - - env: PYTHON=false - php: 7.3 - exclude: - # we need to explicitly exclude python for every version of php other than 7.3 to make way to just run python tests in one seperate instance - - env: PYTHON=true - php: 7.2 - - env: PYTHON=true - php: 7.1 - - env: PYTHON=true - php: 7.0 - - env: PYTHON=true - php: 5.6 - - env: PYTHON=true - php: 5.4 + - ENVIRONMENT=testing + - LIBRETIME_LOG_DIR=/tmp/log/libretime + addons: apt: packages: - - silan - - libgirepository1.0-dev - - gir1.2-gstreamer-1.0 - - gstreamer1.0-plugins-base - - gstreamer1.0-plugins-good - - gstreamer1.0-plugins-bad - - gstreamer1.0-plugins-ugly - - libcairo2-dev - - liquidsoap - - liquidsoap-plugin-mad - - liquidsoap-plugin-taglib - - liquidsoap-plugin-flac - - liquidsoap-plugin-ogg - - liquidsoap-plugin-lame - - liquidsoap-plugin-faad - - liquidsoap-plugin-vorbis - - liquidsoap-plugin-opus - - python3 - - python3-nose - - python3-gst-1.0 - - python3-magic - - dos2unix -install: -- > - if [[ "$PYTHON" == false ]]; then - composer install - fi -- > - if [[ "$PYTHON" == true ]]; then - pyenv local 3.7 - pip3 install -U pip wheel - pip3 install --user rgain3 - pushd python_apps/airtime_analyzer - python3 setup.py install --dry-run --no-init-script - popd - fi + - gstreamer1.0-plugins-base + - gstreamer1.0-plugins-good + - gstreamer1.0-plugins-bad + - gstreamer1.0-plugins-ugly + - libgirepository1.0-dev + - liquidsoap + - liquidsoap-plugin-faad + - liquidsoap-plugin-lame + - liquidsoap-plugin-mad + - liquidsoap-plugin-vorbis + - python3-gst-1.0 + - silan + +jobs: + include: + - language: php + php: 7.3 + stage: test + - language: php + php: 7.2 + stage: test + - language: php + php: 7.1 + stage: test + - language: php + php: 7.0 + stage: test + - language: php + php: 5.6 + stage: test + - language: python + python: 3.8 + stage: test + - language: python + python: 3.7 + stage: test + - language: python + python: 3.5 + stage: test + - stage: deploy + addons: + apt: + packages: + dos2unix + script: + ./travis/release.sh + deploy: + - provider: releases + token: $GITHUB_TOKEN + file: build/libretime-*.tar.gz + edge: true + on: + tags: true + allow_failures: + # https://github.com/LibreTime/libretime/issues/779 + - language: php + php: 7.3 + - language: php + php: 7.2 + - language: php + php: 7.1 + # https://github.com/LibreTime/libretime/issues/1041 + - language: python + python: 3.5 + +install: ./travis/install.sh before_script: -# prepare the database as per docs/testing.md - psql -c 'CREATE DATABASE libretime;' -U postgres - psql -c "CREATE USER libretime WITH PASSWORD 'libretime';" -U postgres - psql -c 'GRANT CONNECT ON DATABASE libretime TO libretime;' -U postgres - psql -c 'ALTER USER libretime CREATEDB;' -U postgres - mkdir -p /tmp/log/libretime -script: -- ./travis/php.sh -- ./travis/python.sh -deploy: -- provider: script - skip_cleanup: true - script: ./travis/release.sh - on: - tags: true - condition: $PYTHON = true -- provider: releases - skip_cleanup: true - api_key: $GITHUB_TOKEN - file_glob: true - file: build/libretime-*.tar.gz - on: - tags: true - condition: $PYTHON = true +script: ./travis/test.sh diff --git a/python_apps/airtime-celery/setup.py b/python_apps/airtime-celery/setup.py index 79d382da7..052626d0e 100644 --- a/python_apps/airtime-celery/setup.py +++ b/python_apps/airtime-celery/setup.py @@ -1,3 +1,4 @@ +from pathlib import Path from setuptools import setup from subprocess import call import os @@ -28,7 +29,9 @@ else: def postinst(): - if not no_init: + initd = Path("/etc/init.d/airtime-celery") + conf = Path("/etc/default/airtime-celery") + if not no_init and initd.is_file() and conf.is_file(): # Make /etc/init.d file executable and set proper # permissions for the defaults config file os.chmod("/etc/init.d/airtime-celery", 0o755) diff --git a/travis/install.sh b/travis/install.sh new file mode 100755 index 000000000..47e36a6ce --- /dev/null +++ b/travis/install.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -xe + +if [[ -n "$TRAVIS_PHP_VERSION" ]]; then + composer install +fi +if [[ -n "$TRAVIS_PYTHON_VERSION" ]]; then + pyenv local $TRAVIS_PYTHON_VERSION + pushd python_apps/airtime_analyzer + pip3 install -e . + popd + + pushd python_apps/airtime-celery + pip3 install -e . + popd + + pushd python_apps/api_clients + pip3 install -e . + popd + + pushd python_apps/pypo + pip3 install -e . + popd +fi diff --git a/travis/php.sh b/travis/php.sh deleted file mode 100755 index 9c8c91b13..000000000 --- a/travis/php.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -xe - -[[ "$PYTHON" == true ]] && exit 0 - -pushd airtime_mvc/tests -../../vendor/bin/phpunit -popd diff --git a/travis/python.sh b/travis/python.sh deleted file mode 100755 index 524b44ce9..000000000 --- a/travis/python.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -set -xe - -[[ "$PYTHON" == false ]] && exit 0 - -pyenv local 3.7 -pushd python_apps/airtime_analyzer -pip3 install -e . -nosetests -popd - -pushd python_apps/api_clients -pip3 install -e . -nosetests -popd diff --git a/travis/test.sh b/travis/test.sh new file mode 100755 index 000000000..81aad4a26 --- /dev/null +++ b/travis/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -xe + +if [[ -n "$TRAVIS_PHP_VERSION" ]]; then + pushd airtime_mvc/tests + ../../vendor/bin/phpunit + popd +fi +if [[ -n "$TRAVIS_PYTHON_VERSION" ]]; then + pyenv local $TRAVIS_PYTHON_VERSION + pushd python_apps/airtime_analyzer + nosetests + popd + + pushd python_apps/api_clients + nosetests + popd +fi From 7058def9a86a5851349e07d452ae1d269334ed79 Mon Sep 17 00:00:00 2001 From: Jakub Skory Date: Sat, 27 Jun 2020 14:36:08 +0200 Subject: [PATCH 7/7] Renamed template conf for liquidsoap and playout --- ...iquidsoap.conf.template => libretime-liquidsoap.conf.template} | 0 ...time-playout.conf.template => libretime-playout.conf.template} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename python_apps/pypo/install/upstart/{airtime-liquidsoap.conf.template => libretime-liquidsoap.conf.template} (100%) rename python_apps/pypo/install/upstart/{airtime-playout.conf.template => libretime-playout.conf.template} (100%) diff --git a/python_apps/pypo/install/upstart/airtime-liquidsoap.conf.template b/python_apps/pypo/install/upstart/libretime-liquidsoap.conf.template similarity index 100% rename from python_apps/pypo/install/upstart/airtime-liquidsoap.conf.template rename to python_apps/pypo/install/upstart/libretime-liquidsoap.conf.template diff --git a/python_apps/pypo/install/upstart/airtime-playout.conf.template b/python_apps/pypo/install/upstart/libretime-playout.conf.template similarity index 100% rename from python_apps/pypo/install/upstart/airtime-playout.conf.template rename to python_apps/pypo/install/upstart/libretime-playout.conf.template