mirror of
https://github.com/YunoHost-Apps/mopidy_ynh.git
synced 2024-09-03 19:46:21 +02:00
Ajouter la configuration avec gestion des services music
This commit is contained in:
parent
4f14743141
commit
7226f7637b
4 changed files with 140 additions and 6 deletions
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
[mpd]
|
[mpd]
|
||||||
enabled = true
|
enabled = true
|
||||||
hostname = 127.0.0.1
|
hostname = __IPLOCAL__
|
||||||
port = 6600
|
port = 6600
|
||||||
#password =
|
#password =
|
||||||
max_connections = 20
|
max_connections = 20
|
||||||
|
@ -57,7 +57,7 @@ default_playlist_scheme = m3u
|
||||||
|
|
||||||
[http]
|
[http]
|
||||||
enabled = true
|
enabled = true
|
||||||
hostname = 127.0.0.1
|
hostname = __IPLOCAL__
|
||||||
port = 6680
|
port = 6680
|
||||||
#static_dir =
|
#static_dir =
|
||||||
zeroconf = Mopidy HTTP server on $hostname
|
zeroconf = Mopidy HTTP server on $hostname
|
||||||
|
@ -111,4 +111,18 @@ excluded_file_extensions =
|
||||||
.log
|
.log
|
||||||
.nfo
|
.nfo
|
||||||
.png
|
.png
|
||||||
.txt
|
.txt
|
||||||
|
|
||||||
|
[spotify]
|
||||||
|
username = __USER_SPOTIFY__
|
||||||
|
password = __PWD_SPOTIFY__
|
||||||
|
#bitrate = 320
|
||||||
|
#timeout = 10
|
||||||
|
#cache_dir = $XDG_CACHE_DIR/mopidy/spotify
|
||||||
|
|
||||||
|
[spotify_web]
|
||||||
|
client_id = __ID_SPOTIFY__
|
||||||
|
client_secret = __SECRET_SPOTIFY__
|
||||||
|
|
||||||
|
[soundcloud]
|
||||||
|
auth_token = __SOUNDCLOUD__
|
|
@ -39,6 +39,66 @@
|
||||||
"fr": "Administrateur de Mopidy (doit être un utilisateur YunoHost existant)"
|
"fr": "Administrateur de Mopidy (doit être un utilisateur YunoHost existant)"
|
||||||
},
|
},
|
||||||
"example": "johndoe"
|
"example": "johndoe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "is_spotify",
|
||||||
|
"ask": {
|
||||||
|
"en": "You want to use Spotify ?",
|
||||||
|
"fr": "Voulez vous utiliser Spotify ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "Yes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spotify_user",
|
||||||
|
"type": "user",
|
||||||
|
"ask": {
|
||||||
|
"en": "User Spotify",
|
||||||
|
"fr": "Utilisateur Spotify"
|
||||||
|
},
|
||||||
|
"example": "johndoe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spotify_pass",
|
||||||
|
"type": "password",
|
||||||
|
"ask": {
|
||||||
|
"en": "Password Spotify",
|
||||||
|
"fr": "Mot de passe Spotify"
|
||||||
|
},
|
||||||
|
"example": "myreallystrengthpassword"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spotify_id",
|
||||||
|
"type": "id",
|
||||||
|
"ask": {
|
||||||
|
"en": "client ID Spotify",
|
||||||
|
"fr": "ID client Spotify"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spotify_id_secret",
|
||||||
|
"type": "id",
|
||||||
|
"ask": {
|
||||||
|
"en": "client secret ID Spotify",
|
||||||
|
"fr": "ID client secret Spotify"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "is_soundcloud",
|
||||||
|
"ask": {
|
||||||
|
"en": "You want to use Soundcloud ?",
|
||||||
|
"fr": "Voulez vous utiliser Soundcloud ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "Yes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "soundcloud_id",
|
||||||
|
"type": "id",
|
||||||
|
"ask": {
|
||||||
|
"en": "Soundcloud ID Spotify",
|
||||||
|
"fr": "ID Soundcloud Spotify"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,18 @@ TRAP_ON # Active trap pour arrêter le script si une erreur est détectée.
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
admin_mopidy=$YNH_APP_ARG_ADMIN_MOPIDY
|
admin_mopidy=$YNH_APP_ARG_ADMIN_MOPIDY
|
||||||
|
if [ "$is_spotify" = "Yes" ];
|
||||||
|
then
|
||||||
|
spotify_user=$YNH_APP_ARG_SPOTIFY_USER
|
||||||
|
spotify_pass=$YNH_APP_ARG_SPOTIFY_PASS
|
||||||
|
spotify_id=$YNH_APP_ARG_SPOTIFY_ID
|
||||||
|
spotify_id_secret=$YNH_APP_ARG_SPOTIFY_ID_SECRET
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_soundcloud" = "Yes" ];
|
||||||
|
then
|
||||||
|
soundcloud_id=$YNH_APP_ARG_SOUNDCLOUD_ID
|
||||||
|
fi
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -24,6 +36,19 @@ CHECK_USER "$admin_mopidy"
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app admin $admin_mopidy
|
ynh_app_setting_set $app admin $admin_mopidy
|
||||||
|
|
||||||
|
if [ "$is_spotify" = "Yes" ];
|
||||||
|
then
|
||||||
|
ynh_app_setting_set $app spotify_user $spotify_user
|
||||||
|
ynh_app_setting_set $app spotify_pass $spotify_pass
|
||||||
|
ynh_app_setting_set $app spotify_id $spotify_id
|
||||||
|
ynh_app_setting_set $app spotify_id_secret $spotify_id_secret
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_soundcloud" = "Yes" ];
|
||||||
|
then
|
||||||
|
ynh_app_setting_set $app soundcloud_id $soundcloud_id
|
||||||
|
fi
|
||||||
|
|
||||||
# Add the archive’s GPG key:
|
# Add the archive’s GPG key:
|
||||||
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
|
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
|
||||||
|
|
||||||
|
@ -35,7 +60,32 @@ sudo apt-get update
|
||||||
sudo apt-get install -y mopidy
|
sudo apt-get install -y mopidy
|
||||||
|
|
||||||
# Copy configuration
|
# Copy configuration
|
||||||
sudo cp ../conf/mopidy.conf /root/.config/mopidy/
|
sudo rm -fr /root/.config/mopidy/
|
||||||
|
ip_local=$(echo hostname -I | awk '{ print $1 }')
|
||||||
|
sudo sed -i "s@__IPLOCAL__@$ip_local@g" ../conf/mopidy.conf
|
||||||
|
|
||||||
|
if [ "$is_spotify" = "Yes" ];
|
||||||
|
then
|
||||||
|
sudo sed -i '/[spotify]/r enabled = true' ../conf/mopidy.conf
|
||||||
|
sudo sed -i "s@__USER_SPOTIFY__@$spotify_user@g" ../conf/mopidy.conf
|
||||||
|
sudo sed -i "s@__PWD_SPOTIFY__@$spotify_pass@g" ../conf/mopidy.conf
|
||||||
|
sudo sed -i "s@__ID_SPOTIFY__@$spotify_id@g" ../conf/mopidy.conf
|
||||||
|
sudo sed -i "s@__SECRET_SPOTIFY__@$spotify_id_secret@g" ../conf/mopidy.conf
|
||||||
|
else
|
||||||
|
sudo sed -i "s@__USER_SPOTIFY__@@g" ../conf/mopidy.conf
|
||||||
|
sudo sed -i "s@__PWD_SPOTIFY__@@g" ../conf/mopidy.conf
|
||||||
|
sudo sed -i "s@__ID_SPOTIFY__@@g" ../conf/mopidy.conf
|
||||||
|
sudo sed -i "s@__SECRET_SPOTIFY__@@g" ../conf/mopidy.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_soundcloud" = "Yes" ];
|
||||||
|
then
|
||||||
|
sudo sed -i "s@__SOUNDCLOUD__@$soundcloud_id@g" ../conf/mopidy.conf
|
||||||
|
else
|
||||||
|
sudo sed -i "s@__SOUNDCLOUD__@@g" ../conf/mopidy.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo cp ../conf/mopidy.conf /usr/share/mopidy/conf.d/
|
||||||
|
|
||||||
# Running Mopidy as a service
|
# Running Mopidy as a service
|
||||||
sudo mopidy local scan
|
sudo mopidy local scan
|
||||||
|
@ -48,4 +98,8 @@ cd /tmp/
|
||||||
sudo git clone https://github.com/pimusicbox/mopidy-musicbox-webclient
|
sudo git clone https://github.com/pimusicbox/mopidy-musicbox-webclient
|
||||||
cd mopidy-musicbox-webclient
|
cd mopidy-musicbox-webclient
|
||||||
sudo python setup.py install
|
sudo python setup.py install
|
||||||
sudo rm -fr mopidy-musicbox-webclient
|
sudo rm -fr mopidy-musicbox-webclient
|
||||||
|
|
||||||
|
# Allow port
|
||||||
|
sudo yunohost firewall allow TCP 6600
|
||||||
|
sudo yunohost firewall allow TCP 6680
|
|
@ -8,11 +8,17 @@ source .fonctions # Charge les fonctions génériques habituellement utilisées
|
||||||
# Source app helpers
|
# Source app helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Récupère les infos de l'application.
|
# Get application informations
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
|
# Remove application
|
||||||
sudo apt-get remove --purge -y mopidy
|
sudo apt-get remove --purge -y mopidy
|
||||||
|
sudo pip uninstall mopidy_musicbox_webclient
|
||||||
|
|
||||||
|
# disallow firewall port
|
||||||
|
sudo yunohost firewall disallow 6600
|
||||||
|
sudo yunohost firewall disallow 6680
|
||||||
|
|
||||||
# Régénère la configuration de SSOwat
|
# Régénère la configuration de SSOwat
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
Loading…
Add table
Reference in a new issue