1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mopidy_ynh.git synced 2024-09-03 19:46:21 +02:00

Merge pull request #30 from YunoHost-Apps/nextversion

update and error correction
This commit is contained in:
siwinter 2021-08-26 11:21:45 +02:00 committed by GitHub
commit a2dc458085
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 133 additions and 134 deletions

View file

@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
Mopidy - is an extensible music server. It plays music, podcasts and radio programs from local disk and various streaming services. You edit the playlist from any phone, tablet, or computer. You hear the music through the speakers connected to the server.
**Shipped version:** 3.1.1
**Shipped version:** 3.2.0
## Screenshots
@ -32,6 +32,7 @@ This installation is shipped with various extensions:
* [RadioNet](https://mopidy.com/ext/radionet/) to play radio channels from the [radio.net](https://www.radio.net/).
* [Podcast](https://mopidy.com/ext/podcast/) to browse RSS feeds of podcasts and stream the episodes.
* [Soundcloud](https://pypi.org/project/Mopidy-SoundCloud/) to play music from the [SoundCloud](https://soundcloud.com/) service \([authentication token](https://pypi.org/project/Mopidy-SoundCloud/) needed\).
* [MPD](https://mopidy.com/ext/mpd/) can be activated in order to use apps that control mopidy via this protocol. (This will open port 6600.)
## Documentation

View file

@ -13,7 +13,7 @@ Mopidy - est un serveur de musique extensible. Mopidy lit de la musique, des pod
Vous pouvez modifier la liste de lecture à partir d'un téléphone, d'une tablette ou d'un ordinateur.
Vous entendez la musique via les haut-parleurs connectés au serveur.
**Version incluse :** 3.1.1
**Version incluse :** 3.2.0
## Captures d'écran
@ -35,6 +35,7 @@ Cette installation est livrée avec différentes extensions:
* [RadioNet](https://mopidy.com/ext/radionet/) pour écouter les canaux radio de [radio.net](https://www.radio.net/)
* [Podcast](https://mopidy.com/ext/podcast/) pour parcourir les flux RSS des podcasts et diffuser les épisodes
* [Soundcloud](https://pypi.org/project/Mopidy-SoundCloud/) pour lire de la musique à partir du service [SoundCloud](https://soundcloud.com/) service \([jeton d'authentification](https://pypi.org/project/Mopidy-SoundCloud/) nécessaire\).
* [MPD](https://mopidy.com/ext/mpd/) peut être activé afin d'utiliser des applications qui contrôlent mpidy via ce protocole. (Cela ouvrira le port 6600 )
## Documentation

View file

@ -1,13 +1,9 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/path"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
@ -28,4 +24,3 @@ Notification=none
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&is_public=1

View file

@ -10,7 +10,7 @@ data_dir = __DATA_DIR__
[file]
enabled = true
media_dirs = __MEDIADIR__
media_dirs = __MEDIA_DIR__
#excluded_file_extensions =
# .directory
# .html
@ -86,7 +86,7 @@ enabled = true
[local]
enabled = true
#max_search_results = 100
media_dir = __MEDIADIR__
media_dir = __MEDIA_DIR__
#scan_timeout = 1000
#scan_flush_threshold = 100
#scan_follow_symlinks = false
@ -182,9 +182,7 @@ enabled = false
auth_token = ?
#explore_songs = 25
#[spotify]
#enabled = true
#username = ? #see https://github.com/mopidy/mopidy-spotify
#password = ?
#client_id = ?
#client_secret = ?
[mpd]
enabled = __MPD_STATE__
hostname = 0.0.0.0
port = __MPD_PORT__

View file

@ -37,7 +37,7 @@ location /musicbox_webclient/ {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://localhost:6680;
proxy_pass http://localhost:__PORT__;
proxy_http_version 1.1;
proxy_set_header Host $host;
@ -52,7 +52,7 @@ location /local/ {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://localhost:6680;
proxy_pass http://localhost:__PORT__;
proxy_http_version 1.1;
proxy_set_header Host $host;

View file

@ -11,7 +11,7 @@ After=sound.target
[Service]
User=__APP__
PermissionsStartOnly=true
ExecStart=__START_FILE__ --config __CONF_FILE__
ExecStart=__FINALPATH__/env/bin/__APP__ --config __FINALPATH__/__APP__.conf
[Install]
WantedBy=multi-user.target

View file

@ -3,9 +3,10 @@
"id": "mopidy",
"packaging_format": 1,
"description": {
"en": "plays music, podcasts and radio programs from local disk and various streaming services"
"en": "Play music, podcasts and radio programs from local disk and various streaming services",
"fr": "Écouter de la musique, des podcasts et des programmes radio depuis le disque local et divers services de streaming"
},
"version": "3.1.1~ynh2",
"version": "3.2.0~ynh1",
"url": "https://www.mopidy.com/",
"license": "Apache-2.0",
"maintainer": {
@ -17,7 +18,7 @@
"email": "cyp@rouquin.me"
},
"requirements": {
"yunohost": ">= 4.1.7"
"yunohost": ">= 4.2.0"
},
"multi_instance": false,
"services": [
@ -44,6 +45,15 @@
"fr": "L'application publique peut être utilisée par des visiteurs anonymes "
},
"default": false
},
{
"name": "mpd_ext",
"type": "boolean",
"help": {
"en": "Activate MPD extension (this will open port 6600)",
"fr": "Activer l'extension MPD (cela ouvrira le port 6600)"
},
"default": false
}
]
}

View file

@ -16,47 +16,32 @@ pkg_dependencies="acl build-essential python3-dev python3-pip python3-venv git p
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
myynh_install() {
# ynh_script_progression --message="Install / upgrade mopidy via pip..." --weight=8
python3 -m venv "${final_path}/env"
chown -R "$app" "$final_path"
#run source in a 'sub shell'
#run source in a 'sub shell'
(
set +o nounset
source "${final_path}/env/bin/activate"
set -o nounset
ynh_exec_as $app $final_path/env/bin/pip install --upgrade --no-cache-dir pip
# ynh_script_progression --message="Installing essentials..." --weight=17
# to make Gstreamer visible in Python environment
$final_path/env/bin/python3 -m pip install vext
$final_path/env/bin/python3 -m pip install --no-binary=:all: vext.gi
# install essential packages
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy==3.1.1
# patch -u $final_path/env/lib/python$python_version/site-packages/mopidy/__main__.py -i ../sources/patches/__main__.patch --forward
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy==3.2.0
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-local==3.2.1
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MusicBox-Webclient==3.1.0
# ynh_script_progression --message="Installing Mopidy-YouTube..." --weight=7
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-YouTube==3.2
# ynh_script_progression --message="Installing Mopidy-YTMusic..." --weight=2
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-YTMusic==0.2.2
# ynh_script_progression --message="Installing Mopidy-RadioNet..."
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-YouTube==3.3
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir mopidy-ytmusic==0.3.0
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-RadioNet==0.2.2
# ynh_script_progression --message="Installing Mopidy-Podcast..."
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-Podcast==3.0.0
# ynh_script_progression --message="Installing Mopidy-Podcast-iTunes..." --weight=2
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-Podcast-iTunes==3.0.0
# ynh_script_progression --message="Installing Mopidy-SoundCloud..." --weight=6
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-SoundCloud
# set +o nounset
# source "${final_path}/env/bin/deactivate"
# set -o nounset
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-SoundCloud==3.0.1
ynh_exec_as $app $final_path/env/bin/python3 -m pip install --no-cache-dir Mopidy-MPD==3.1.0
)
}
@ -67,15 +52,3 @@ myynh_install() {
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
# Install or update the main directory yunohost.multimedia
# see https://github.com/YunoHost-Apps/yunohost.multimedia
ynh_multimedia_build_main_dir () {
wget -nv https://github.com/maniackcrudelis/yunohost.multimedia/archive/master.zip 2>&1
unzip master.zip
sudo ./yunohost.multimedia-master/script/ynh_media_build.sh
}

View file

@ -23,6 +23,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
mpd_port=$YNH_APP_ARG_MPD_EXT
app=$YNH_APP_INSTANCE_NAME
@ -62,6 +63,16 @@ ynh_script_progression --message="Finding an available port..."
port=$(ynh_find_port --port=6680)
ynh_app_setting_set --app=$app --key=port --value=$port
if [ $mpd_port -eq 1 ]; then
mpd_port=$(ynh_find_port --port=6600)
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $mpd_port
mpd_state="true"
else
mpd_state="false"
fi
ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
@ -95,10 +106,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
#=================================================
# CREATE YUNOHOST DIRECTORIES
#=================================================
@ -116,20 +123,18 @@ chown -R $app: "$work_dir"
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
start_file="$final_path/env/bin/$app"
ynh_add_systemd_config #--others_var="conf_file start_file" substitute __CONF_FILE__ by $conf_file
ynh_add_systemd_config
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Setup config file..."
cp ../conf/app.conf "$conf_file"
cache_dir=$work_dir/cache
data_dir=$work_dir/data
ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$conf_file"
ynh_replace_string --match_string="__MEDIADIR__" --replace_string=$media_dir --target_file="$conf_file"
ynh_replace_string --match_string="__CACHE_DIR__" --replace_string=$work_dir/cache --target_file="$conf_file"
ynh_replace_string --match_string="__DATA_DIR__" --replace_string=$work_dir/data --target_file="$conf_file"
ynh_add_config --template="../conf/app.conf" --destination="$conf_file"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -142,17 +147,20 @@ ynh_store_file_checksum --file="$conf_file"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# user mopidy needs permission to mkdir on final_path
chown -R root: $final_path
chown $app: $final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --description "Mopidy music server" --log="/var/log/$app/$app.log"
if [ $mpd_port -ne 0 ]; then
yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$mpd_port
else
yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log"
fi
#=================================================
# START SYSTEMD SERVICE
@ -188,10 +196,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#=================================================
ynh_script_progression --message="Provide additional shell command..."
cp -a ../sources/extra_files/mopidyctl "$cmd_file"
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="$cmd_file"
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string=$final_path --target_file="$cmd_file"
ynh_replace_string --match_string="__CONF_FILE__" --replace_string=$conf_file --target_file="$cmd_file"
ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file"
chmod +x "$cmd_file"

View file

@ -17,6 +17,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=4
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -66,6 +67,16 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $mpd_port$"
then
ynh_script_progression --message="Closing port $mpd_port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $mpd_port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================

View file

@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port)
# other variables
media_dir="/home/yunohost.multimedia/share/Music"
@ -72,17 +73,29 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell --
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path" # /opt/yunohost/mopidy
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
#chown -R root: $final_path
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# OPEN PORT
#=================================================
if [ $mpd_port -ne 0 ]; then
ynh_script_progression --message="open MPD-port $mpd_port..." --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $mpd_port
fi
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
@ -104,7 +117,11 @@ systemctl enable $app.service --quiet
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description "Mopidy music server" --log="/var/log/$app/$app.log"
if [ $mpd_port -ne 0 ]; then
yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$mpd_port
else
yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log"
fi
#=================================================
# RESTORE VARIOUS FILES

View file

@ -5,7 +5,6 @@
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -20,6 +19,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
mpd_port=$(ynh_app_setting_get --app=$app --key=mpd_port)
# other variables
media_dir="/home/yunohost.multimedia/share/Music"
@ -44,11 +44,17 @@ upgrade_type=$(ynh_check_app_version_changed)
# some legacy installs and you therefore want to initiaze stuff during upgrade)
#
# If db_name doesn't exist, create it
#if [ -z "$db_name" ]; then
# db_name=$(ynh_sanitize_dbid --db_name=$app)
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#fi
# If mpd_port doesn't exist, create it
if [ -z "$mpd_port" ]; then
mpd_port=0
ynh_app_setting_set --app=$app --key=mpd_port --value=$mpd_port
fi
if [ $mpd_port -eq 0 ]; then
mpd_state="false"
else
mpd_state="true"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -73,6 +79,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell --groups="audio"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -82,6 +96,10 @@ then
myynh_install
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -97,14 +115,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=11
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell --groups="audio"
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -113,46 +123,27 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell --
ynh_script_progression --message="Upgrading systemd configuration..." --weight=3
# Create a dedicated systemd config
start_file="$final_path/env/bin/$app"
ynh_add_systemd_config
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_backup_if_checksum_is_different --file="$conf_file"
cache_dir=$work_dir/cache
data_dir=$work_dir/data
cp ../conf/app.conf "$conf_file"
ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$conf_file"
ynh_replace_string --match_string="__MEDIADIR__" --replace_string=$media_dir --target_file="$conf_file"
ynh_replace_string --match_string="__CACHE_DIR__" --replace_string=$work_dir/cache --target_file="$conf_file"
ynh_replace_string --match_string="__DATA_DIR__" --replace_string=$work_dir/data --target_file="$conf_file"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$conf_file"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# siwi okay
# user mopidy needs permission to mkdir on final_path
chown -R root: $final_path
chown $app: $final_path
ynh_add_config --template="../conf/app.conf" --destination="$conf_file"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description "Mopidy music server" --log="/var/log/$app/$app.log"
if [ $mpd_port -ne 0 ]; then
yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log" --needs_exposed_ports=$mpd_port
else
yunohost service add $app --description="Mopidy music server" --log="/var/log/$app/$app.log"
fi
#=================================================
# START SYSTEMD SERVICE
@ -173,10 +164,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#=================================================
ynh_script_progression --message="Provide additional shell comand..."
cp -a ../sources/extra_files/mopidyctl "$cmd_file"
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="$cmd_file"
ynh_replace_string --match_string="__FINAL_PATH__" --replace_string=$final_path --target_file="$cmd_file"
ynh_replace_string --match_string="__CONF_FILE__" --replace_string=$conf_file --target_file="$cmd_file"
ynh_add_config --template="../sources/extra_files/mopidyctl" --destination="$cmd_file"
chmod +x "$cmd_file"