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

Merge pull request #5 from YunoHost-Apps/testing

Testing
This commit is contained in:
yalh76 2022-03-25 19:25:31 +01:00 committed by GitHub
commit 8d0cd73ef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1421 additions and 924 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

View file

@ -1,47 +1,48 @@
##<img src="https://github.com/rembo10/headphones/raw/master/data/images/headphoneslogo.png" height="32" align="top"> headphones_ynh <a href="https://yunohost.org/#/apps_in_progress_en"><img src="http://pix.toile-libre.org/upload/original/1440352021.png" height="32" align="right"></a>
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
[![Latest Version](https://img.shields.io/badge/version-_--_-green.svg?style=flat)](https://github.com/Snipees/headphones_ynh/releases)
[![Status](https://img.shields.io/badge/status-in_progress-yellow.svg?style=flat)](https://github.com/Snipees/headphones_ynh/milestones)
[![Dependencies](https://img.shields.io/badge/dependencies-includes-lightgrey.svg?style=flat)](https://github.com/Snipees/headphones_ynh#dependencies)
[![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat)](https://raw.githubusercontent.com/Snipees/headphones_ynh/master/LICENSE)
[![Yunohost version](https://img.shields.io/badge/yunohost-2.2.0_tested-orange.svg?style=flat)](https://github.com/YunoHost/yunohost)
[![GitHub issues](https://img.shields.io/github/issues/Snipees/headphones_ynh.svg?style=flat)](https://github.com/Snipees/headphones_ynh/issues)
# Headphones for YunoHost
[ **Headphones Integration for Yunohost** ]
This install script uses a Git-fork as sources for a local installation.
Otherwise the script sets a reverse-proxy to a remote instance.
[![Integration level](https://dash.yunohost.org/integration/headphones.svg)](https://dash.yunohost.org/appci/app/headphones) ![](https://ci-apps.yunohost.org/ci/badges/headphones.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/headphones.maintain.svg)
[![Install Headphones with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=headphones)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Headphones quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Headphones is an automated music downloader for NZB and Torrent, written in Python. It supports SABnzbd, NZBget, Transmission, µTorrent, Deluge and Blackhole.
### How to install:
- Use **Install software** option from Yunohost admin panel
- Find textbox tagged as **Install custom App from github**
- Copy and paste: https://github.com/YunoHost-Apps/headphones_ynh
- Choose the method installation: *local* or *remote* (as described above)
- Answer the required questions to the selected method
**Shipped version:** 0.6.0~ynh1
### More information about:
- Headphones : https://github.com/rembo10/headphones
- Yunohost : https://yunohost.org
## Screenshots
#### Special Thanks to the Yunohost Community:
[anaqreon](https://github.com/anaqreon),
[aymhce](https://github.com/aymhce),
[beudbeud](https://github.com/abeudin),
[Chao-Man](https://github.com/Chao-Man),
[chtixof](https://github.com/chtixof),
[CotzaDev](https://github.com/CotzaDev),
[courgette](https://github.com/courgette),
[Jérôme](https://github.com/jeromelebleu),
[JocelynD](https://github.com/JocelynDelalande),
[Ju](https://github.com/julienmalik),
[Le Kload](https://github.com/Kloadut),
[lunarok](https://github.com/lunarok),
[maniackcrudelis](https://github.com/maniackcrudelis),
[Matlink](https://github.com/matlink),
[Moul](https://github.com/M5oul),
[polytan02](https://github.com/polytan02),
[scith](https://github.com/scith),
[tifred](https://github.com/drfred1981),
... :dizzy:
![](./doc/screenshots/screenshot01.png)
## Documentation and resources
* Official app website: https://github.com/rembo10/headphones
* Official user documentation: https://github.com/rembo10/headphones/wiki/Usage-guide
* Upstream app code repository: https://github.com/rembo10/headphones
* YunoHost documentation for this app: https://yunohost.org/app_headphones
* Report a bug: https://github.com/YunoHost-Apps/headphones_ynh/issues
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/headphones_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/headphones_ynh/tree/testing --debug
or
sudo yunohost app upgrade headphones -u https://github.com/YunoHost-Apps/headphones_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

44
README_fr.md Normal file
View file

@ -0,0 +1,44 @@
# Headphones pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/headphones.svg)](https://dash.yunohost.org/appci/app/headphones) ![](https://ci-apps.yunohost.org/ci/badges/headphones.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/headphones.maintain.svg)
[![Installer Headphones avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=headphones)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Headphones rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Headphones is an automated music downloader for NZB and Torrent, written in Python. It supports SABnzbd, NZBget, Transmission, µTorrent, Deluge and Blackhole.
**Version incluse :** 0.6.0~ynh1
## Captures d'écran
![](./doc/screenshots/screenshot01.png)
## Documentations et ressources
* Site officiel de l'app : https://github.com/rembo10/headphones
* Documentation officielle utilisateur : https://github.com/rembo10/headphones/wiki/Usage-guide
* Dépôt de code officiel de l'app : https://github.com/rembo10/headphones
* Documentation YunoHost pour cette app : https://yunohost.org/app_headphones
* Signaler un bug : https://github.com/YunoHost-Apps/headphones_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/headphones_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/headphones_ynh/tree/testing --debug
ou
sudo yunohost app upgrade headphones -u https://github.com/YunoHost-Apps/headphones_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

21
check_process Normal file
View file

@ -0,0 +1,21 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=CommitHash
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none

7
conf/app.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://github.com/rembo10/headphones/archive/refs/tags/v0.6.0-beta.5.tar.gz
SOURCE_SUM=b96c09fc7c384affa8beab0995447d54ed2d5bd4022278068e5ee93b71e07be8
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -1,233 +0,0 @@
[General]
config_version = 5
http_port = PORTTOCHANGE
http_host = 0.0.0.0
http_username = ""
http_password = ""
http_root = PATHTOCHANGE
http_proxy = 0
enable_https = 0
https_cert = ""
https_key = ""
launch_browser = 1
api_enabled = 0
api_key = ""
log_dir = LOGSDIRTOCHANGE
cache_dir = APPDIRTOCHANGE/cache
git_path = ""
git_user = rembo10
git_branch = master
do_not_override_git_branch = 0
check_github = 1
check_github_on_startup = 1
check_github_interval = 360
music_dir = ""
destination_dir = ""
lossless_destination_dir = ""
preferred_quality = 0
preferred_bitrate = ""
preferred_bitrate_high_buffer = ""
preferred_bitrate_low_buffer = ""
preferred_bitrate_allow_lossless = 0
detect_bitrate = 0
lossless_bitrate_from = ""
lossless_bitrate_to = ""
auto_add_artists = 1
correct_metadata = 0
move_files = 0
rename_files = 0
folder_format = $Artist/$Album [$Year]
file_format = $Track $Artist - $Album [$Year] - $Title
file_underscores = 0
cleanup_files = 0
keep_nfo = 0
add_album_art = 0
album_art_format = folder
embed_album_art = 0
embed_lyrics = 0
replace_existing_folders = 0
nzb_downloader = 0
torrent_downloader = 0
download_dir = ""
blackhole_dir = ""
usenet_retention = 1500
include_extras = 0
extras = ""
autowant_upcoming = 1
autowant_all = 0
keep_torrent_files = 0
prefer_torrents = 0
open_magnet_links = False
numberofseeders = 10
torrentblackhole_dir = ""
download_torrent_dir = ""
search_interval = 1440
libraryscan = 1
libraryscan_interval = 300
download_scan_interval = 5
update_db_interval = 24
mb_ignore_age = 365
preferred_words = ""
ignored_words = ""
required_words = ""
lastfm_username = ""
interface = default
folder_permissions = 0755
file_permissions = 0644
music_encoder = 0
encoder = ffmpeg
xldprofile = ""
bitrate = 192
samplingfrequency = 44100
encoder_path = ""
advancedencoder = ""
encoderoutputformat = mp3
encoderquality = 2
encodervbrcbr = cbr
encoderlossless = 1
encoder_multicore = 0
encoder_multicore_count = 0
delete_lossless_files = 1
mirror = musicbrainz.org
customhost = localhost
customport = 5000
customsleep = 1
hpuser = ""
hppass = ""
[Kat]
kat = 0
kat_proxy_url = ""
kat_ratio = ""
[Mininova]
mininova = 0
mininova_ratio = ""
[Piratebay]
piratebay = 0
piratebay_proxy_url = ""
piratebay_ratio = ""
[Waffles]
waffles = 0
waffles_uid = ""
waffles_passkey = ""
waffles_ratio = ""
[Rutracker]
rutracker = 0
rutracker_user = ""
rutracker_password = ""
rutracker_ratio = ""
[What.cd]
whatcd = 0
whatcd_username = ""
whatcd_password = ""
whatcd_ratio = ""
[SABnzbd]
sab_host = ""
sab_username = ""
sab_password = ""
sab_apikey = ""
sab_category = ""
[NZBget]
nzbget_username = nzbget
nzbget_password = ""
nzbget_category = ""
nzbget_host = ""
nzbget_priority = 0
[Headphones]
headphones_indexer = 0
[Transmission]
transmission_host = ""
transmission_username = ""
transmission_password = ""
[uTorrent]
utorrent_host = ""
utorrent_username = ""
utorrent_password = ""
utorrent_label = ""
[Newznab]
newznab = 0
newznab_host = ""
newznab_apikey = ""
newznab_enabled = 1
extra_newznabs = ,
[NZBsorg]
nzbsorg = 0
nzbsorg_uid = ""
nzbsorg_hash = ""
[omgwtfnzbs]
omgwtfnzbs = 0
omgwtfnzbs_uid = ""
omgwtfnzbs_apikey = ""
[Growl]
growl_enabled = 0
growl_host = ""
growl_password = ""
growl_onsnatch = 0
[Prowl]
prowl_enabled = 0
prowl_keys = ""
prowl_onsnatch = 0
prowl_priority = 0
[XBMC]
xbmc_enabled = 0
xbmc_host = ""
xbmc_username = ""
xbmc_password = ""
xbmc_update = 0
xbmc_notify = 0
[LMS]
lms_enabled = 0
lms_host = ""
[Plex]
plex_enabled = 0
plex_server_host = ""
plex_client_host = ""
plex_username = ""
plex_password = ""
plex_update = 0
plex_notify = 0
[NMA]
nma_enabled = 0
nma_apikey = ""
nma_priority = 0
nma_onsnatch = 0
[Pushalot]
pushalot_enabled = 0
pushalot_apikey = ""
pushalot_onsnatch = 0
[Pushover]
pushover_enabled = 0
pushover_keys = ""
pushover_onsnatch = 0
pushover_priority = 0
pushover_apitoken = ""
[PushBullet]
pushbullet_enabled = 0
pushbullet_apikey = ""
pushbullet_deviceid = ""
pushbullet_onsnatch = 0
[Twitter]
twitter_enabled = 0
twitter_onsnatch = 0
twitter_username = ""
twitter_password = ""
twitter_prefix = Headphones
[OSX_Notify]
osx_notify_enabled = 0
osx_notify_onsnatch = 0
osx_notify_app = /Applications/Headphones
[Boxcar]
boxcar_enabled = 0
boxcar_onsnatch = 0
boxcar_token = ""
[Songkick]
songkick_enabled = 1
songkick_apikey = nd1We7dFW2RqxPw8
songkick_location = ""
songkick_filter_enabled = 0
[Synoindex]
synoindex_enabled = 0
[Advanced]
album_completion_pct = 80
cache_sizemb = 32
journal_mode = wal
verify_ssl_cert = 1

View file

@ -1,15 +0,0 @@
# COPY THIS FILE TO /etc/default/headphones
# OPTIONS: HP_HOME, HP_USER, HP_DATA, HP_PIDFILE, PYTHON_BIN, HP_OPTS, SSD_OPTS, HP_PORT
## EXAMPLE if want to run as different user
## add HP_USER=username to /etc/default/headphones
## otherwise default headphones is used
HP_USER=USERTOCHANGE #$RUN_AS, username to run headphones under, the default is headphones
HP_HOME=APPDIRTOCHANGE #$APP_PATH, the location of Headphones.py, the default is /opt/headphones
HP_DATA=DATADIRTOCHANGE #$DATA_DIR, the location of headphones.db, cache, logs, the default is /opt/headphones
HP_PIDFILE=PIDFILETOCHANGE #$PID_FILE, the location of headphones.pid, the default is /var/run/headphones/headphones.pid
PYTHON_BIN=PYTBINTOCHANGE #$DAEMON, the location of the python binary, the default is /usr/bin/python
HP_OPTS=" --config=OPTSTOCHANGE" #$EXTRA_DAEMON_OPTS, extra cli option for headphones, i.e. " --config=/home/headphones/config.ini"
#SSD_OPTS=SSDTOCHANGE #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users"
HP_PORT=PORTTOCHANGE #$PORT_OPTS, hardcoded port for the webserver, overrides value in config.ini

360
conf/headphones.ini Normal file
View file

@ -0,0 +1,360 @@
[General]
add_album_art = 0
advancedencoder =
album_art_format = folder
album_art_min_width =
album_art_max_width =
api_enabled = 0
api_key =
autowant_all = 0
autowant_manually_added = 1
autowant_upcoming = 1
auto_add_artists = 1
bitrate = 192
blackhole = 0
blackhole_dir =
cache_dir = __DATADIR__/cache
check_github = 0
check_github_interval = 360
check_github_on_startup = 0
cleanup_files = 0
config_version = 6
correct_metadata = 0
cue_split = 1
cue_split_flac_path =
cue_split_shntool_path =
customauth = 0
customhost = localhost
custompass =
customport = 5000
customsleep = 1
customuser =
delete_lossless_files = 1
destination_dir =
detect_bitrate = 0
do_not_process_unmatched = 0
download_dir =
download_scan_interval = 5
download_torrent_dir =
do_not_override_git_branch = 0
embed_album_art = 0
embed_lyrics = 0
enable_https = 0
encoder = ffmpeg
encoderfolder =
encoderlossless = 1
encoderoutputformat = mp3
encoderquality = 2
encodervbrcbr = cbr
encoder_multicore = 0
encoder_multicore_count = 0
encoder_path =
extras =
file_format = $Track $Artist - $Album [$Year] - $Title
file_permissions = 0644
file_permissions_enabled = True
file_underscores = 0
folder_format = $Artist/$Album [$Year]
folder_permissions_enabled = True
folder_permissions = 0755
freeze_db = 0
git_branch = master
git_path =
git_user = rembo10
headphones_indexer = 0
hppass =
hpuser =
https_cert =
https_key =
http_host = localhost
http_password =
http_port = __PORT__
http_proxy = 0
http_root = __PATH_URL__
http_username =
ignore_clean_releases = 0
ignored_words =
include_extras = 0
interface = default
keep_nfo = 0
keep_torrent_files = 0
keep_torrent_files_dir =
lastfm_username =
launch_browser = 1
libraryscan = 1
libraryscan_interval = 24
log_dir = /var/log/__APP__
lossless_bitrate_from = 0
lossless_bitrate_to = 0
lossless_destination_dir =
mb_ignore_age = 365
mb_ignore_age_missing = 0
mirror = musicbrainz.org
move_files = 0
music_dir =
music_encoder = 0
numberofseeders = 10
nzb_downloader = 0
official_releases_only = 0
open_magnet_links = 0
magnet_links = 0
preferred_bitrate =
preferred_bitrate_allow_lossless = 0
preferred_bitrate_high_buffer = 0
preferred_bitrate_low_buffer = 0
preferred_quality = 0
preferred_words =
prefer_torrents = 0
rename_files = 0
rename_single_disc_ignore = 0
rename_unprocessed = 1
rename_frozen = 1
replace_existing_folders = 0
keep_original_folder = 0
required_words =
samplingfrequency = 44100
search_interval = 1440
soft_chroot =
torrentblackhole_dir =
torrent_downloader = 0
torrent_removal_interval = 720
update_db_interval = 24
usenet_retention = 1500
wait_until_release_date = 0
xldprofile =
[Advanced]
album_completion_pct = 80
cache_sizemb = 32
ignored_folders = []
ignored_files = []
journal_mode = wal
verify_ssl_cert = 1
[Orpheus.network]
orpheus = 0
orpheus_password =
orpheus_ratio =
orpheus_username =
orpheus_url = https://orpheus.network
[Boxcar]
boxcar_enabled = 0
boxcar_onsnatch = 0
boxcar_token =
[Deluge]
deluge_host =
deluge_cert =
deluge_password =
deluge_label =
deluge_done_directory =
deluge_paused = 0
[Email]
email_enabled = 0
email_from =
email_to =
email_smtp_server = localhost
email_smtp_user =
email_smtp_password =
email_smtp_port = 25
email_ssl = 0
email_tls = 0
email_onsnatch = 0
[Newznab]
extra_newznabs = []
newznab = 0
newznab_apikey =
newznab_enabled = 1
newznab_host =
[Torznab]
extra_torznabs = []
torznab = 0
torznab_apikey =
torznab_enabled = 1
torznab_host =
torznab_ratio =
[Growl]
growl_enabled = 0
growl_host =
growl_onsnatch = 0
growl_password =
[Beets]
idtag = 0
[Join]
join_apikey =
join_deviceid =
join_enabled = 0
join_onsnatch = 0
[LMS]
lms_enabled = 0
lms_host =
[MPC]
mpc_enabled = 0
[NMA]
nma_apikey =
nma_enabled = 0
nma_onsnatch = 0
nma_priority = 0
[NZBget]
nzbget_category =
nzbget_host =
nzbget_password =
nzbget_priority = 0
nzbget_username = nzbget
[NZBsorg]
nzbsorg = 0
nzbsorg_hash =
nzbsorg_uid =
[omgwtfnzbs]
omgwtfnzbs = 0
omgwtfnzbs_apikey =
omgwtfnzbs_uid =
[OSX_Notify]
osx_notify_app = /Applications/Headphones
osx_notify_enabled = 0
osx_notify_onsnatch = 0
[Piratebay]
piratebay = 0
piratebay_proxy_url =
piratebay_ratio =
[Old Piratebay]
oldpiratebay = 0
oldpiratebay_url =
oldpiratebay_ratio =
[Plex]
plex_client_host =
plex_enabled = 0
plex_notify = 0
plex_password =
plex_server_host =
plex_update = 0
plex_username =
plex_token =
[Prowl]
prowl_enabled = 0
prowl_keys =
prowl_onsnatch = 0
prowl_priority = 0
[Pushalot]
pushalot_apikey =
pushalot_enabled = 0
pushalot_onsnatch = 0
[PushBullet]
pushbullet_apikey =
pushbullet_deviceid =
pushbullet_enabled = 0
pushbullet_onsnatch = 0
[Pushover]
pushover_apitoken =
pushover_enabled = 0
pushover_keys =
pushover_onsnatch = 0
pushover_priority = 0
[QBitTorrent]
qbittorrent_host =
qbittorrent_label =
qbittorrent_password =
qbittorrent_username =
[Rutracker]
rutracker = 0
rutracker_password =
rutracker_ratio =
rutracker_user =
rutracker_cookie =
[SABnzbd]
sab_apikey =
sab_category =
sab_host =
sab_password =
sab_username =
[Slack]
slack_enabled = 0
slack_url =
slack_channel =
slack_emoji =
slack_onsnatch = 0
[Songkick]
songkick_apikey = nd1We7dFW2RqxPw8
songkick_enabled = 1
songkick_filter_enabled = 0
songkick_location =
[Subsonic]
subsonic_enabled = 0
subsonic_host =
subsonic_password =
subsonic_username =
[Synoindex]
synoindex_enabled = 0
[Telegram]
telegram_token =
telegram_userid =
telegram_enabled = 0
telegram_onsnatch = 0
[Transmission]
transmission_host =
transmission_password =
transmission_username =
[Twitter]
twitter_enabled = 0
twitter_onsnatch = 0
twitter_password =
twitter_prefix = Headphones
twitter_username =
[uTorrent]
utorrent_host =
utorrent_label =
utorrent_password =
utorrent_username =
[Waffles]
waffles = 0
waffles_passkey =
waffles_ratio =
waffles_uid =
[Redacted]
redacted = 0
redacted_username =
redacted_password =
redacted_ratio =
redacted_use_fltoken = 0
[XBMC]
xbmc_enabled = 0
xbmc_host =
xbmc_notify = 0
xbmc_password =
xbmc_update = 0
xbmc_username =

View file

@ -1,209 +0,0 @@
#!/bin/sh
#
## Don't edit this file
## Edit user configuation in /etc/default/headphones to change
##
## Make sure init script is executable
## sudo chmod +x /path/to/init.ubuntu
##
## Install the init script
## sudo ln -s /path/to/init.ubuntu /etc/init.d/headphones
##
## Create the headphones daemon user:
## sudo adduser --system --no-create-home headphones
##
## Make sure /opt/headphones is owned by the headphones user
## sudo chown headphones:nogroup -R /opt/headphones
##
## Touch the default file to stop the warning message when starting
## sudo touch /etc/default/headphones
##
## To start Headphones automatically
## sudo update-rc.d headphones defaults
##
## To start/stop/restart Headphones
## sudo service headphones start
## sudo service headphones stop
## sudo service headphones restart
##
## HP_USER= #$RUN_AS, username to run headphones under, the default is headphones
## HP_HOME= #$APP_PATH, the location of Headphones.py, the default is /opt/headphones
## HP_DATA= #$DATA_DIR, the location of headphones.db, cache, logs, the default is /opt/headphones
## HP_PIDFILE= #$PID_FILE, the location of headphones.pid, the default is /var/run/headphones/headphones.pid
## PYTHON_BIN= #$DAEMON, the location of the python binary, the default is /usr/bin/python
## HP_OPTS= #$EXTRA_DAEMON_OPTS, extra cli option for headphones, i.e. " --config=/home/headphones/config.ini"
## SSD_OPTS= #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users"
## HP_PORT= #$PORT_OPTS, hardcoded port for the webserver, overrides value in config.ini
##
## EXAMPLE if want to run as different user
## add HP_USER=username to /etc/default/headphones
## otherwise default headphones is used
#
### BEGIN INIT INFO
# Provides: headphones
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Should-Start: $NetworkManager
# Should-Stop: $NetworkManager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of Headphones
# Description: starts instance of Headphones using start-stop-daemon
### END INIT INFO
# Script name
NAME=headphones
# App name
DESC=Headphones
SETTINGS_LOADED=FALSE
. /lib/lsb/init-functions
# Source Headphones configuration
if [ -f /etc/default/headphones ]; then
SETTINGS=/etc/default/headphones
else
log_warning_msg "/etc/default/headphones not found using default settings.";
fi
check_retval() {
if [ $? -eq 0 ]; then
log_end_msg 0
return 0
else
log_end_msg 1
exit 1
fi
}
load_settings() {
if [ $SETTINGS_LOADED != "TRUE" ]; then
. $SETTINGS
## The defaults
# Run as username
RUN_AS=${HP_USER-headphones}
# Path to app HP_HOME=path_to_app_Headphones.py
APP_PATH=${HP_HOME-/opt/headphones}
# Data directory where headphones.db, cache and logs are stored
DATA_DIR=${HP_DATA-/opt/headphones}
# Path to store PID file
PID_FILE=${HP_PIDFILE-/var/run/headphones/headphones.pid}
# Path to python bin
DAEMON=${PYTHON_BIN-/usr/bin/python}
# Extra daemon option like: HP_OPTS=" --config=/home/headphones/config.ini"
EXTRA_DAEMON_OPTS=${HP_OPTS-}
# Extra start-stop-daemon option like START_OPTS=" --group=users"
EXTRA_SSD_OPTS=${SSD_OPTS-}
# Hardcoded port to run on, overrides config.ini settings
[ -n "$HP_PORT" ] && {
PORT_OPTS=" --port=${HP_PORT} "
}
DAEMON_OPTS=" Headphones.py --quiet --daemon --nolaunch --pidfile=${PID_FILE} --datadir=${DATA_DIR} ${PORT_OPTS}${EXTRA_DAEMON_OPTS}"
SETTINGS_LOADED=TRUE
fi
[ -x $DAEMON ] || {
log_warning_msg "$DESC: Can't execute daemon, aborting. See $DAEMON";
return 1;}
return 0
}
load_settings || exit 0
is_running () {
# returns 1 when running, else 0.
if [ -e $PID_FILE ]; then
PID=`cat $PID_FILE`
RET=$?
[ $RET -gt 1 ] && exit 1 || return $RET
else
return 1
fi
}
handle_pid () {
PID_PATH=`dirname $PID_FILE`
[ -d $PID_PATH ] || mkdir -p $PID_PATH && chown -R $RUN_AS $PID_PATH > /dev/null || {
log_warning_msg "$DESC: Could not create $PID_FILE, See $SETTINGS, aborting.";
return 1;}
if [ -e $PID_FILE ]; then
PID=`cat $PID_FILE`
if ! kill -0 $PID > /dev/null 2>&1; then
log_warning_msg "Removing stale $PID_FILE"
rm $PID_FILE
fi
fi
}
handle_datadir () {
[ -d $DATA_DIR ] || mkdir -p $DATA_DIR && chown -R $RUN_AS $DATA_DIR > /dev/null || {
log_warning_msg "$DESC: Could not create $DATA_DIR, See $SETTINGS, aborting.";
return 1;}
}
handle_updates () {
chown -R $RUN_AS $APP_PATH > /dev/null || {
log_warning_msg "$DESC: $APP_PATH not writable by $RUN_AS for web-updates";
return 0; }
}
start_headphones () {
handle_pid
handle_datadir
handle_updates
if ! is_running; then
log_daemon_msg "Starting $DESC"
start-stop-daemon -o -d $APP_PATH -c $RUN_AS --start $EXTRA_SSD_OPTS --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
check_retval
else
log_success_msg "$DESC: already running (pid $PID)"
fi
}
stop_headphones () {
if is_running; then
log_daemon_msg "Stopping $DESC"
start-stop-daemon -o --stop --pidfile $PID_FILE --retry 15
check_retval
else
log_success_msg "$DESC: not running"
fi
}
case "$1" in
start)
start_headphones
;;
stop)
stop_headphones
;;
restart|force-reload)
stop_headphones
start_headphones
;;
status)
status_of_proc -p "$PID_FILE" "$DAEMON" "$DESC"
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

View file

@ -1,15 +1,9 @@
location PATHTOCHANGE {
proxy_http_version 1.1;
proxy_pass_header Server;
proxy_pass HOSTTOCHANGE;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
proxy_pass http://localhost:__PORT__;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Script-Name __PATH__/;
}

12
conf/systemd.service Normal file
View file

@ -0,0 +1,12 @@
[Unit]
Description=Headphones
[Service]
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/venv/bin/python3 __FINALPATH__/Headphones.py --config /etc/__APP__/__APP__.ini --datadir __DATADIR__ --nolaunch
[Install]
WantedBy=multi-user.target

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
Headphones is an automated music downloader for NZB and Torrent, written in Python. It supports SABnzbd, NZBget, Transmission, µTorrent, Deluge and Blackhole.

0
doc/DISCLAIMER.md Normal file
View file

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

View file

@ -1,100 +1,46 @@
{
"name": "Headphones",
"id": "headphones",
"packaging_format": 1,
"description": {
"en": "Automatic music downloader",
"fr": "Téléchargement automatisé de musique"
"en": "Automated music downloader for NZB and Torrent"
},
"license": "GPL-3",
"version": "0.6.0~ynh1",
"url": "https://github.com/rembo10/headphones",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://github.com/rembo10/headphones",
"userdoc": "https://github.com/rembo10/headphones/wiki/Usage-guide",
"code": "https://github.com/rembo10/headphones"
},
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Snipees",
"email": "snipees@wareziens.net",
"url": "https://github.com/Snipees"
"name": "John doe",
"email": "john.doe@example.com"
},
"multi_instance": "false",
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"ask": {
"en": "Choose a domain for Headphones",
"fr": "Choisissez un domaine pour Headphones"
},
"example": "mydomain.org"
"type": "domain"
},
{
"name": "path",
"ask": {
"en": "Choose a path for Headphones",
"fr": "Choisissez un chemin pour Headphones"
},
"type": "path",
"example": "/headphones",
"default": "/headphones"
},
{
"name": "public",
"ask": {
"en": "Is it a public application ?",
"fr": "Est-ce une application publique ?"
},
"choices": ["Yes", "No"],
"default": "No"
},
{
"name": "method",
"ask": {
"en": "Choose installation method",
"fr": "Choisissez le type d'installation"
},
"choices": ["LOCAL", "REMOTE"],
"default": "LOCAL"
},
{
"name": "port",
"ask": {
"en": "LOCAL: Choose the listening port of the app",
"fr": "LOCAL: Choisissez le port d'écoute de l'application"
},
"example": "8181",
"default": "8181"
},
{
"name": "fork",
"ask": {
"en": "LOCAL: Source URL of GIT to use",
"fr": "LOCAL: URL du GIT source à utiliser"
},
"example": "https://github.com/Snipees/headphones",
"default": "https://github.com/rembo10/headphones"
},
{
"name": "options",
"ask": {
"en": "LOCAL: Choose a downloader to configure",
"fr": "LOCAL: Choisissez un client de téléchargement"
},
"choices": ["None", "Transmission"],
"default": "None"
},
{
"name": "host",
"ask": {
"en": "REMOTE: Specify URL for the host",
"fr": "REMOTE: Indiquez l'URL de l'hôte"
},
"example": "http://192.168.1.100:8888/myapp",
"default": "http://"
}
],
"remove": [
{
"name": "data",
"ask": {
"en": "Would you like to keep data files ?",
"fr": "Souhaitez-vous conserver les données ?"
},
"choices": ["Yes", "No"],
"default": "Yes"
"name": "is_public",
"type": "boolean",
"default": false
}
]
}

20
scripts/_common.sh Normal file
View file

@ -0,0 +1,20 @@
#!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="python3 python3-venv"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -1,37 +1,81 @@
#!/bin/bash
# Common variable declaration
app_id=headphones
app_user=headphones
app_install_dir="/opt/yunohost/${app_id}"
app_data_dir="/home/yunohost.app/${app_id}"
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Retrieve arguments
app_method="$(sudo yunohost app setting ${app_id} method)"
app_domain="$(sudo yunohost app setting ${app_id} domain)"
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
# The parameter $1 is the backup directory location
# which will be compressed afterward
app_backup_dir="$1/apps/${app_id}"
sudo mkdir -p $app_backup_dir
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Backup files if localhost installation
if [[ $app_method == "LOCAL"* ]]; then
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
# Backup sources
sudo cp -a $app_install_dir/. $app_backup_dir/sources
app=$YNH_APP_INSTANCE_NAME
# Backup data
sudo cp -a $app_data_dir/. $app_backup_dir/data
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
# Backup daemon config
sudo cp -a /etc/default/$app_id $app_backup_dir/conf/$app_id.default
sudo cp -a /etc/init.d/$app_id $app_backup_dir/conf/$app_id.init
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
fi
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
# Copy Nginx and YunoHost parameters to make the script "standalone"
sudo cp -a /etc/yunohost/apps/$app_id/. $app_backup_dir/yunohost
sudo cp -a /etc/nginx/conf.d/$app_domain.d/$app_id.conf $app_backup_dir/nginx.conf
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/$app/"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

143
scripts/change_url Normal file
View file

@ -0,0 +1,143 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" --line_match="Headphones is shutting down"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
path_url=$new_path
domain=$new_domain
ynh_add_config --template="../conf/headphones.ini" --destination="/etc/$app/$app.ini"
chmod 600 "/etc/$app/$app.ini"
chown $app:$app "/etc/$app/$app.ini"
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting Headphones web server"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -1,155 +1,192 @@
#!/bin/bash
#debug commands
#exec > >(tee /tmp/debug-install.log)
#exec 2>&1
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Retrieve arguments
app_domain=$1
app_path=$2
app_public=$3
app_method=$4
app_port=$5
app_fork=$6
app_opts=$7
app_host=$8
source _common.sh
source /usr/share/yunohost/helpers
# Basic variable declaration
BASEDIR="$(dirname "$(pwd)")"
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Common variable declaration
app_id=headphones
app_user=headphones
app_local_host="127.0.0.1"
app_python_bin="/usr/bin/python"
## Destinations definitions
app_install_dir="/opt/yunohost/${app_id}"
app_data_dir="/home/yunohost.app/${app_id}"
app_logs_dir="/var/log/${app_id}"
app_config_file="${app_data_dir}/config.ini"
app_pid_file="/var/run/${app_id}/${app_id}.pid"
## Sources definitions
app_src_conf="$BASEDIR/conf/${app_id}.conf"
app_src_dfts="$BASEDIR/conf/${app_id}.defaults"
app_src_init="$BASEDIR/conf/${app_id}.init"
app_src_nginx_conf="$BASEDIR/conf/nginx.conf"
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
# Check domain/path availability
sudo yunohost app checkurl $app_domain$app_path -a $app_id
if [[ ! $? -eq 0 ]]; then
exit 1
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod +x "$final_path/Headphones.py"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL PYTHON DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing Python dependencies..."
python3 -m venv $final_path/venv
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..."
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
mkdir -p "/etc/$app"
ynh_add_config --template="../conf/headphones.ini" --destination="/etc/$app/$app.ini"
chmod 600 "/etc/$app/$app.ini"
chown $app:$app "/etc/$app/$app.ini"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..."
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting Headphones web server"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
# Make install if localhost installation
if [[ $app_method == "LOCAL"* ]]; then
ynh_systemd_action --service_name=nginx --action=reload
# Check port availability
sudo yunohost app checkport $app_port
if [[ ! $? -eq 0 ]]; then
exit 1
fi
#=================================================
# END OF SCRIPT
#=================================================
# Make directories
sudo mkdir -p $app_logs_dir
sudo mkdir -p $app_data_dir
sudo mkdir -p $app_install_dir
# Install latest version of app using the fork
sudo apt-get install -y git-core
sudo git clone $app_fork $app_install_dir
# Install dependencies (using virtualenv)
if [[ $(python --version 2>&1) != Python\ 2* ]]; then
app_python_bin=$app_install_dir/bin/python
sudo apt-get install -y python-pip python-virtualenv python-dev uwsgi uwsgi-plugin-python
sudo virtualenv $app_install_dir
sudo bash -c "source $app_install_dir/bin/activate && pip install cheetah"
fi
# Create app user
id -u $app_user &>/dev/null || sudo useradd --home-dir $app_data_dir --shell /bin/false $app_user
# Configure daemon
sudo sed -i "s@USERTOCHANGE@$app_user@g" $app_src_dfts
sudo sed -i "s@APPDIRTOCHANGE@$app_install_dir@g" $app_src_dfts
sudo sed -i "s@DATADIRTOCHANGE@$app_data_dir@g" $app_src_dfts
sudo sed -i "s@PIDFILETOCHANGE@$app_pid_file@g" $app_src_dfts
sudo sed -i "s@PYTBINTOCHANGE@$app_python_bin@g" $app_src_dfts
sudo sed -i "s@OPTSTOCHANGE@$app_config_file@g" $app_src_dfts
sudo sed -i "s@PORTTOCHANGE@$app_port@g" $app_src_dfts
sudo cp -a $app_src_dfts /etc/default/$app_id
sudo cp -a $app_src_init /etc/init.d/$app_id
# Configure app
sudo sed -i "s@PATHTOCHANGE@$app_path@g" $app_src_conf
sudo sed -i "s@PORTTOCHANGE@$app_port@g" $app_src_conf
sudo sed -i "s@APPDIRTOCHANGE@$app_install_dir@g" $app_src_conf
sudo sed -i "s@LOGSDIRTOCHANGE@$app_logs_dir@g" $app_src_conf
sudo cp -a $app_src_conf $app_config_file
# Configure specifics options
case "$app_opts" in
*"Transmission"*)
ref_file=$(sudo sed -n -e '/^CONFIG_DIR/ s/.*\= *//p' $(find /etc/default -name '*transmission*') | sed 's/["* ]//g')/settings.json
ref_field=(download-dir rpc-bind-address rpc-port rpc-url rpc-username rpc-password)
for i in ${ref_field[*]}; do ref_value+=$(sudo sed -n -e "/$i/ s/.*\: *//p" $ref_file | sed 's/["*,]//g'); done
ref_value=($ref_value)
sudo sed -i "s@download_torrent_dir =.*@download_torrent_dir = ${ref_value[0]}@g" $app_src_conf
sudo sed -i "s@transmission_host =.*@transmission_host = http://${ref_value[1]}:${ref_value[2]}${ref_value[3]}@g" $app_src_conf
sudo sed -i "s@transmission_username =.*@transmission_username = ${ref_value[4]}@g" $app_src_conf
sudo sed -i "s@transmission_password =.*@transmission_password = ${ref_value[5]}@g" $app_src_conf
sudo sed -i "s@torrent_downloader =.*@torrent_downloader = 1@g" $app_src_conf
sudo sed -i "s@keep_torrent_files =.*@keep_torrent_files = 1@g" $app_src_conf
sudo sed -i "s@prefer_torrents =.*@prefer_torrents = 1@g" $app_src_conf
sudo cp -a $app_src_conf $app_config_file
;;
esac
# Set rights
sudo chown -R $app_user $app_install_dir
sudo chown -R $app_user $app_data_dir
sudo chown -R $app_user $app_logs_dir
sudo chmod +x /etc/init.d/$app_id
sudo chmod +x -R $app_install_dir
sudo chmod +x -R $app_data_dir
sudo chmod +x -R $app_logs_dir
# Add service to YunoHost's monitoring
sudo yunohost service add $app_id --log $app_logs_dir --status "ps aux | grep $app_id | grep -v grep"
# Start daemon at boot
sudo update-rc.d $app_id defaults
# Start service
sudo service $app_id start
# Set proxy host variable
app_host="http://${app_local_host}:${app_port}${app_path%/}"
fi
# Remove trailing "/" for next commands
app_path=${app_path%/}
# Configure Nginx
sudo sed -i "s@PATHTOCHANGE@$app_path@g" $app_src_nginx_conf
sudo sed -i "s@HOSTTOCHANGE@$app_host@g" $app_src_nginx_conf
sudo cp $app_src_nginx_conf /etc/nginx/conf.d/$app_domain.d/$app_id.conf
# If app is public, add url to SSOWat conf as skipped_uris
if [[ $app_public == "Yes" ]]; then
# unprotected_uris allows SSO credentials to be passed anyway.
sudo yunohost app setting $app_id unprotected_uris -v "/"
fi
# Save app settings
sudo yunohost app setting $app_id public -v "$app_public"
sudo yunohost app setting $app_id method -v "$app_method"
sudo yunohost app setting $app_id host -v "$app_host"
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf
ynh_script_progression --message="Installation of $app completed"

View file

@ -1,56 +1,114 @@
#!/bin/bash
# Common variable declaration
app_id=headphones
app_user=headphones
app_install_dir="/opt/yunohost/${app_id}"
app_data_dir="/home/yunohost.app/${app_id}"
app_logs_dir="/var/log/${app_id}"
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Retrieve arguments
app_method="$(sudo yunohost app setting ${app_id} method)"
app_domain="$(sudo yunohost app setting ${app_id} domain)"
keep_data=$1
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
# Remove files if localhost installation
if [[ $app_method == "LOCAL"* ]]; then
app=$YNH_APP_INSTANCE_NAME
# Kill app and remove from boot
sudo service $app_id stop
sudo killall $app_id
sudo update-rc.d $app_id remove
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
# Delete app user
sudo deluser $app_user
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
# Remove sources
sudo rm -rf $app_install_dir
# Remove logs
if [[ $app_logs_dir != "$app_data_dir"* ]]; then
sudo rm -rf $app_logs_dir
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..."
yunohost service remove $app
fi
# Remove data
if [[ $keep_data == "No" ]]; then
sudo rm -rf $app_data_dir
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
ynh_secure_remove --file="$datadir"
fi
# Remove daemon config
sudo rm -f /etc/init.d/$app_id
sudo rm -f /etc/default/$app_id
sudo rm -rf /var/run/$app_id
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..."
fi
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove Nginx parameters
sudo rm -f /etc/nginx/conf.d/$app_domain.d/$app_id.conf
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
# Remove Yunohost service
sudo yunohost service remove $app_id
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# Reload Nginx and update Yunohost
sudo service nginx reload
sudo yunohost app ssowatconf
# Remove a directory securely
ynh_secure_remove --file="/etc/$app"
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed"

View file

@ -1,56 +1,149 @@
#!/bin/bash
# Common variable declaration
app_id=headphones
app_user=headphones
app_install_dir="/opt/yunohost/${app_id}"
app_data_dir="/home/yunohost.app/${app_id}"
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Retrieve arguments
app_method="$(sudo yunohost app setting ${app_id} method)"
app_domain="$(sudo yunohost app setting ${app_id} domain)"
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
# The parameter $1 is the uncompressed restore directory location
app_backup_dir="$1/apps/${app_id}"
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Restore files if localhost installation
if [[ $app_method == "LOCAL"* ]]; then
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
# Kill app
sudo service $app_id stop
sudo killall $app_id
app=$YNH_APP_INSTANCE_NAME
# Restore sources
sudo cp -a $app_backup_dir/sources/. $app_install_dir
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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
# Restore data
sudo cp -a $app_backup_dir/data/. $app_data_dir
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
# Restore daemon config
sudo cp -a $app_backup_dir/conf/$app_id.default /etc/default/$app_id
sudo cp -a $app_backup_dir/conf/$app_id.init /etc/init.d/$app_id
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
# Set rights
sudo chown -R $app_user $app_install_dir
sudo chown -R $app_user $app_data_dir
sudo chmod +x /etc/init.d/$app_id
sudo chmod +x -R $app_install_dir
sudo chmod +x -R $app_data_dir
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
# Start daemon at boot
sudo update-rc.d $app_id defaults
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# Reload daemon
sudo service $app_id restart
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
fi
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
# Restore Nginx and YunoHost parameters
sudo cp -a $app_backup_dir/yunohost/. /etc/yunohost/apps/$app_id
sudo cp -a $app_backup_dir/nginx.conf /etc/nginx/conf.d/$app_domain.d/$app_id.conf
ynh_restore_file --origin_path="$final_path"
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod +x "$final_path/Headphones.py"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..."
ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/$app/"
chmod 600 "/etc/$app/$app.ini"
chown $app:$app "/etc/$app/$app.ini"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
mkdir -p "/var/log/$app"
chown -R $app:$app "/var/log/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting Headphones web server"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app"

View file

@ -1,70 +1,172 @@
#!/bin/bash
# Basic variable declaration
BASEDIR="$(dirname "$(pwd)")"
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Common variable declaration
app_id=headphones
app_user=headphones
app_install_dir="/opt/yunohost/${app_id}"
app_data_dir="/home/yunohost.app/${app_id}"
app_logs_dir="/var/log/${app_id}"
## Sources definitions
app_src_init="$BASEDIR/conf/${app_id}.init"
app_src_nginx_conf="$BASEDIR/conf/nginx.conf"
source _common.sh
source /usr/share/yunohost/helpers
# Retrieve arguments
app_public="$(sudo yunohost app setting ${app_id} public)"
app_method="$(sudo yunohost app setting ${app_id} method)"
app_domain="$(sudo yunohost app setting ${app_id} domain)"
app_path="$(sudo yunohost app setting ${app_id} path)"
app_host="$(sudo yunohost app setting ${app_id} host)"
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
# Make upgrade if localhost installation
if [[ $app_method == "LOCAL"* ]]; then
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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
# Kill app
sudo service $app_id stop
sudo killall $app_id
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
# Upgrade to the latest version of app using the fork
cd $app_install_dir && sudo git pull
cd -
upgrade_type=$(ynh_check_app_version_changed)
# Upgrade dependencies
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Update init file
sudo cp -a $app_src_init /etc/init.d/$app_id
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Set rights
sudo chown -R $app_user $app_install_dir
sudo chmod +x /etc/init.d/$app_id
sudo chmod +x -R $app_install_dir
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
# Start service
sudo service $app_id start
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" --line_match="Headphones is shutting down"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Remove trailing "/" for next commands
app_path=${app_path%/}
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
# Configure Nginx
sudo sed -i "s@PATHTOCHANGE@$app_path@g" $app_src_nginx_conf
sudo sed -i "s@HOSTTOCHANGE@$app_host@g" $app_src_nginx_conf
sudo cp $app_src_nginx_conf /etc/nginx/conf.d/$app_domain.d/$app_id.conf
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# If app is public, add url to SSOWat conf as skipped_uris
if [[ $app_public = "Yes" ]];
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# See install script
sudo yunohost app setting $app_id unprotected_uris -v "/"
# Remove old settings
sudo yunohost app setting $app_id skipped_uris -d
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
fi
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path"
chmod +x "$final_path/Headphones.py"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
#=================================================
# INSTALL PYTHON DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing Python dependencies..."
ynh_secure_remove --file="$final_path/venv"
python3 -m venv $final_path/venv
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
mkdir -p "/etc/$app"
ynh_add_config --template="../conf/headphones.ini" --destination="/etc/$app/$app.ini"
chmod 600 "/etc/$app/$app.ini"
chown $app:$app "/etc/$app/$app.ini"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting Headphones web server"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed"