mirror of
https://github.com/YunoHost-Apps/airsonic_ynh.git
synced 2024-09-03 18:06:14 +02:00
Merge pull request #12 from YunoHost-Apps/testing
Add multimedia folders
This commit is contained in:
commit
7e618fb446
11 changed files with 162 additions and 14 deletions
|
@ -15,7 +15,7 @@ If you have constrained bandwidth, you may set an upper limit for the bit rate o
|
||||||
|
|
||||||
In addition to being a streaming media server, Airsonic works very well as a local jukebox. The intuitive web interface, as well as search and index facilities, are optimized for efficient browsing through large media libraries. Airsonic also comes with an integrated Podcast receiver, with many of the same features as you find in iTunes.
|
In addition to being a streaming media server, Airsonic works very well as a local jukebox. The intuitive web interface, as well as search and index facilities, are optimized for efficient browsing through large media libraries. Airsonic also comes with an integrated Podcast receiver, with many of the same features as you find in iTunes.
|
||||||
|
|
||||||
**Shipped version:** 10.4.0
|
**Shipped version:** 10.4.1
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
|
|
|
@ -7,3 +7,6 @@ LdapSearchFilter=(uid={0})
|
||||||
#LdapManagerPassword=
|
#LdapManagerPassword=
|
||||||
# Automatically create users comming from Yunohost in Airsonic
|
# Automatically create users comming from Yunohost in Airsonic
|
||||||
LdapAutoShadowing=true
|
LdapAutoShadowing=true
|
||||||
|
GettingStartedEnabled=false
|
||||||
|
PodcastFolder=/home/yunohost.multimedia/share/Podcasts
|
||||||
|
PlaylistFolder=/home/yunohost.multimedia/share/Playlists
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.4.0/airsonic.war
|
SOURCE_URL=https://github.com/airsonic/airsonic/releases/download/v10.4.1/airsonic.war
|
||||||
SOURCE_SUM=0842a1fc4380cbe75e40dcb94e40332222b816514bd8ad250501d472210894d4
|
SOURCE_SUM=1d3ee9811ecbabbf9e2cfb63bd936bc238fe75dbcd223a87f3fab18b7a2a75a3
|
||||||
SOURCE_SUM_PRG=sha256sum
|
SOURCE_SUM_PRG=sha256sum
|
||||||
SOURCE_FORMAT=false
|
SOURCE_FORMAT=false
|
||||||
SOURCE_IN_SUBDIR=false
|
SOURCE_IN_SUBDIR=false
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Airsonic is an open source, web-based media server.",
|
"en": "Airsonic is an open source, web-based media server.",
|
||||||
"fr": "Airsonic est un server multimedia open-source."
|
"fr": "Airsonic est un server multimedia open-source."
|
||||||
},
|
},
|
||||||
"version": "10.4.0~ynh1",
|
"version": "10.4.1~ynh1",
|
||||||
"url": "http://airsonic.github.io",
|
"url": "http://airsonic.github.io",
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -18,3 +18,45 @@ pkg_dependencies="openjdk-8-jre ffmpeg"
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# FUTURE OFFICIAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Install or update the main directory yunohost.multimedia
|
||||||
|
#
|
||||||
|
# usage: ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_build_main_dir () {
|
||||||
|
local ynh_media_release="v1.2"
|
||||||
|
local checksum="806a827ba1902d6911095602a9221181"
|
||||||
|
|
||||||
|
# Download yunohost.multimedia scripts
|
||||||
|
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz
|
||||||
|
|
||||||
|
# Check the control sum
|
||||||
|
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|
||||||
|
|| ynh_die "Corrupt source"
|
||||||
|
|
||||||
|
# Check if the package acl is installed. Or install it.
|
||||||
|
ynh_package_is_installed 'acl' \
|
||||||
|
|| ynh_package_install acl
|
||||||
|
|
||||||
|
# Extract
|
||||||
|
mkdir yunohost.multimedia-master
|
||||||
|
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
|
||||||
|
./yunohost.multimedia-master/script/ynh_media_build.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add a directory in yunohost.multimedia
|
||||||
|
# This "directory" will be a symbolic link to a existing directory.
|
||||||
|
#
|
||||||
|
# usage: ynh_multimedia_addfolder "Source directory" "Destination directory"
|
||||||
|
#
|
||||||
|
# | arg: -s, --source_dir= - Source directory - The real directory which contains your medias.
|
||||||
|
# | arg: -d, --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
|
||||||
|
ynh_multimedia_addfolder () {
|
||||||
|
# Declare an array to define the options of this helper.
|
||||||
|
declare -Ar args_array=( [s]=source_dir= [d]=dest_dir= )
|
||||||
|
local source_dir
|
||||||
|
local dest_dir
|
||||||
|
# Manage arguments with getopts
|
||||||
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
|
./yunohost.multimedia-master/script/ynh_media_addfolder.sh --source="$source_dir" --dest="$dest_dir"
|
||||||
|
}
|
|
@ -14,8 +14,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
### Remove this function if there's nothing to clean before calling the remove script.
|
ynh_clean_check_starting
|
||||||
true
|
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
@ -38,7 +37,7 @@ service_config=$(ynh_app_setting_get --app=$app --key=service_config)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
|
@ -71,12 +70,18 @@ ynh_script_progression --message="Backing up systemd configuration..." --weight=
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
ynh_backup --src_path="$service_config"
|
ynh_backup --src_path="$service_config"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP DATA
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/home/yunohost.airsonic" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=12
|
ynh_script_progression --message="Starting a systemd service..." --weight=12
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -54,7 +54,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
|
|
|
@ -98,6 +98,28 @@ ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# CREATE DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
mkdir -p /home/yunohost.airsonic/{Podcasts,Playlists}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SECURING FILES AND DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
chown -R $app:www-data /home/yunohost.airsonic/
|
||||||
|
chmod -R 764 /home/yunohost.airsonic
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding multimedia directories..." --weight=3
|
||||||
|
|
||||||
|
ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Podcasts" --dest_dir="share/Podcasts"
|
||||||
|
ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Playlists" --dest_dir="share/Playlists"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENABLE "TRANSCODE"
|
# ENABLE "TRANSCODE"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -231,6 +253,19 @@ then
|
||||||
ynh_app_setting_delete --app=$app --key=skipped_uris
|
ynh_app_setting_delete --app=$app --key=skipped_uris
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# USE MULTIMEDIA
|
||||||
|
#=================================================
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
|
# Use multimedia folder
|
||||||
|
ynh_replace_string --match_string="INSERT INTO MUSIC_FOLDER VALUES(0,'/var/music','Music'" --replace_string="INSERT INTO MUSIC_FOLDER VALUES(0,'/home/yunohost.multimedia/share/Music','YunoHost Music'" --target_file="$final_path/db/airsonic.script"
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restarting a systemd service..." --weight=12
|
||||||
|
|
||||||
|
# Start a systemd service
|
||||||
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -90,9 +90,6 @@ fi
|
||||||
# REMOVE FILES
|
# REMOVE FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove the log files
|
|
||||||
ynh_secure_remove --file="/var/log/$app/"
|
|
||||||
|
|
||||||
ynh_secure_remove --file="$service_config"
|
ynh_secure_remove --file="$service_config"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -130,6 +130,30 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE DATA
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
|
||||||
|
ynh_restore_file --origin_path="/home/yunohost.airsonic" --not_mandatory
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
mkdir -p /home/yunohost.airsonic/{Podcasts,Playlists}
|
||||||
|
chown -R $app:www-data /home/yunohost.airsonic/
|
||||||
|
chmod -R 764 /home/yunohost.airsonic
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding multimedia directories..." --weight=3
|
||||||
|
|
||||||
|
ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Podcasts" --dest_dir="share/Podcasts"
|
||||||
|
ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Playlists" --dest_dir="share/Playlists"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -79,8 +79,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -118,6 +117,36 @@ ynh_system_user_create --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
|
#=================================================
|
||||||
|
# CREATE DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
mkdir -p /home/yunohost.airsonic/{Podcasts,Playlists}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SECURING FILES AND DIRECTORIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
chown -R $app:www-data /home/yunohost.airsonic/
|
||||||
|
chmod -R 764 /home/yunohost.airsonic
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding multimedia directories..." --weight=3
|
||||||
|
|
||||||
|
ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Podcasts" --dest_dir="share/Podcasts"
|
||||||
|
ynh_multimedia_addfolder --source_dir="/home/yunohost.airsonic/Playlists" --dest_dir="share/Playlists"
|
||||||
|
|
||||||
|
if ! grep -q "PodcastFolder" $final_path/airsonic.properties; then
|
||||||
|
echo "PodcastFolder=/home/yunohost.multimedia/share/Podcasts" >> $final_path/airsonic.properties
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "PlaylistFolder" $final_path/airsonic.properties; then
|
||||||
|
echo "PlaylistFolder=/home/yunohost.multimedia/share/Playlists" >> $final_path/airsonic.properties
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENABLE "TRANSCODE"
|
# ENABLE "TRANSCODE"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -202,6 +231,19 @@ ynh_script_progression --message="Starting a systemd service..." --weight=12
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
||||||
|
|
||||||
|
# Use multimedia folder if needed
|
||||||
|
if ! grep -q "/home/yunohost.multimedia/share/Music" $final_path/db/airsonic.script; then
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop"
|
||||||
|
|
||||||
|
# Use multimedia folder
|
||||||
|
ynh_replace_string --match_string="INSERT INTO MUSIC_FOLDER VALUES(0,'/var/music','Music'" --replace_string="INSERT INTO MUSIC_FOLDER VALUES(0,'/home/yunohost.multimedia/share/Music','YunoHost Music'" --target_file="$final_path/db/airsonic.script"
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restarting a systemd service..." --weight=12
|
||||||
|
|
||||||
|
# Start a systemd service
|
||||||
|
ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/airsonic.log" --line_match="Started Application in"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue