homeaudio #53

Merged
ben merged 1 commits from b/infra:b into main 2023-04-30 22:37:09 +00:00
14 changed files with 188 additions and 51 deletions

View File

@ -8,6 +8,8 @@ airconnect_group:
name: airconnect name: airconnect
gid: 1337 gid: 1337
airconnect_max_volume: "100"
airconnect_upnp: [] airconnect_upnp: []
airconnect_containers: airconnect_containers:
# UPnP/Sonos # UPnP/Sonos

View File

@ -2,10 +2,13 @@
- name: restart airconnect containers - name: restart airconnect containers
docker_container: docker_container:
name: airconnect-{{ item }} name: airconnect-{{ item.prog }}
state: "{{ item.state }}" state: "{{ item.state }}"
restart: item.state == 'started' restart: "{% if item.state|default('started') == 'started' %}true{% else %}false{% endif %}"
loop_control:
label: "{{ item.prog }}"
with_items: "{{ airconnect_containers }}" with_items: "{{ airconnect_containers }}"
when: when:
- airconnect_containers is not defined or not airconnect_containers.changed - airconnect_containers is not defined or not airconnect_containers_task.changed
- item.state == 'started' - item.state|default("started") == "started"
- airconnect_restart_handler|default(true)

View File

@ -50,7 +50,7 @@
- airconnect - airconnect
- airconnect-container - airconnect-container
- docker-containers - docker-containers
register: airconnect_containers register: airconnect_containers_task
loop_control: loop_control:
label: airconnect-{{ item.prog }} label: airconnect-{{ item.prog }}
with_items: "{{ airconnect_containers }}" with_items: "{{ airconnect_containers }}"

View File

@ -8,14 +8,14 @@
<mp3>http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=00;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=0d500000000000000000000000000000</mp3> <mp3>http-get:*:audio/mpeg:DLNA.ORG_PN=MP3;DLNA.ORG_OP=00;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=0d500000000000000000000000000000</mp3>
</protocolInfo> </protocolInfo>
<enabled>1</enabled> <enabled>1</enabled>
<max_volume>100</max_volume> <max_volume>{{ airconnect_max_volume }}</max_volume>
<http_length>-1</http_length> <http_length>-1</http_length>
<upnp_max>1</upnp_max> <upnp_max>1</upnp_max>
<codec>mp3:320</codec> <codec>mp3:320</codec>
<metadata>1</metadata> <metadata>1</metadata>
<flush>1</flush> <flush>1</flush>
<artwork></artwork> <artwork></artwork>
<latency>0:1000</latency> <latency>0:500</latency>
<drift>0</drift> <drift>0</drift>
</common> </common>
<main_log>info</main_log> <main_log>info</main_log>
@ -28,9 +28,11 @@
<ports>0:0</ports> <ports>0:0</ports>
{% for item in airconnect_upnp -%} {% for item in airconnect_upnp -%}
<device> <device>
<udn>uuid:{{ item.local_uid }}</udn> <udn>uuid:{{ item.local_uuid }}</udn>
<name>{{ item.name }}</name> <name>{{ item.name }}</name>
<mac>{{ item.mac }}</mac> {% if 'mac' in item -%}
<mac>{{ item.mac | upper }}</mac>
{% endif -%}
<enabled>{% if item.enabled|default(true) %}1{% else %}0{% endif %}</enabled> <enabled>{% if item.enabled|default(true) %}1{% else %}0{% endif %}</enabled>
</device> </device>
{% endfor %} {% endfor %}

Binary file not shown.

View File

@ -0,0 +1,21 @@
---
- name: install audio and metadata related packages
apt:
name:
- avahi-utils
- id3v2
- ffmpeg
state: present
tags:
- homeaudio-packages
- name: install yt-dlp
pip:
name: yt-dlp
state: latest
tags:
- packages
- pip-packages
- yt-dlp
- homeaudio-packages

View File

@ -0,0 +1,7 @@
---
- import_tasks: homeaudio.yml
tags: homeaudio
- import_tasks: mopidy.yml
tags: mopidy

View File

@ -0,0 +1,84 @@
---
- name: copy key for mopidy repo
copy:
src: mopidy-archive-keyring.gpg
dest: /usr/local/share/keyrings/mopidy-archive-keyring.gpg
owner: root
group: root
mode: "0644"
tags:
- mopidy
- name: add mopidy repo
apt_repository:
repo: "{{ item }}"
state: present
update_cache: false
filename: /etc/apt/sources.list.d/mopidy
with_items:
- "deb [signed-by=/usr/local/share/keyrings/mopidy-archive-keyring.gpg] https://apt.mopidy.com/ buster main contrib non-free"
- "deb-src [signed-by=/usr/local/share/keyrings/mopidy-archive-keyring.gpg] https://apt.mopidy.com/ buster main contrib non-free"
register: mopidy_repo
tags:
- mopidy
- packages
- name: apt-get update if repo changed
apt:
update_cache: true
when: mopidy_repo.changed
tags:
- mopidy
- packages
- name: install mopidy
apt:
name:
- mopidy
- mopidy-podcast
- mopidy-soundcloud
- mopidy-internetarchive
- mopidy-local
- mopidy-mpd
- mopidy-podcast-itunes
- mopidy-podcast
- mopidy-soundcloud
- mopidy-internetarchive
- mopidy-local
- mopidy-mpd
- mopidy-podcast-itunes
- mopidy-spotify
- mopidy-mpris
- upnp-inspector
# - playerctl
#- upmpdcli
state: present
tags:
- mopidy
- packages
- name: install mopidy pip packages
pip:
name:
- Mopidy-Jellyfin
- Mopidy-RadioNet
- Mopidy-YouTube
- Mopidy-Iris
- Mopidy-Autoplay
state: present
tags:
- mopidy
- packages
- pip-packages
- name: template mopdiy config
template:
src: mopidy.conf.j2
dest: /etc/mopidy/mopdy.conf
owner: mopidy
group: root
mode: "0640"
tags:
- mopidy
- mopidy.conf

View File

@ -0,0 +1,27 @@
# For information about configuration values that can be set in this file see:
#
# https://docs.mopidy.com/en/latest/config/
#
# Run `sudo mopidyctl config` to see the current effective config, based on
# both defaults and this configuration file.
[http]
enabled = true
hostname = 0.0.0.0
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true
default_app = mopidy
[mpd]
enabled = false
hostname = 127.0.0.1
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
listall
listallinfo
default_playlist_scheme = m3u

View File

@ -7,6 +7,8 @@
- name: restart owntone container - name: restart owntone container
docker_container: docker_container:
name: hass name: owntone
state: started state: started
restart: true restart: true
when:
- owntone_restart_handler|default(true)

View File

@ -10,7 +10,7 @@
tags: tags:
- owntone-dirs - owntone-dirs
loop_control: loop_control:
label: "{{ item.name }}" label: "{{ owntone_path }}/{{ item.name }}"
with_items: with_items:
- name: '' - name: ''
- name: config - name: config
@ -36,6 +36,8 @@
- shairport-metadata.fifo - shairport-metadata.fifo
tags: tags:
- input.fifo - input.fifo
# disabled
when: false
- name: install certs - name: install certs
copy: copy:
@ -87,24 +89,6 @@
- cron - cron
- owntone-cron - owntone-cron
- name: install utils for tagging
apt:
name:
- id3v2
- ffmpeg
state: present
tags:
- packages
- name: install yt-dlp
pip:
name: yt-dlp
state: latest
tags:
- packages
- pip-packages
- yt-dlp
- name: fuse allow other - name: fuse allow other
lineinfile: lineinfile:

View File

@ -1,5 +1,7 @@
server { server {
listen 444 ssl;
listen 443 ssl http2; listen 443 ssl http2;
# listen 443 ssl http2;
# listen {{ owntone_port_tcp }}; # listen {{ owntone_port_tcp }};
{% if inventory_hostname in wg_clients -%} {% if inventory_hostname in wg_clients -%}
@ -29,12 +31,15 @@ server {
sub_filter_types '*'; sub_filter_types '*';
sub_filter_once off; sub_filter_once off;
proxy_pass http://127.0.0.1:{{ owntone_port_tcp }}/; proxy_pass http://127.0.0.1:{{ owntone_port_tcp }}$request_uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Host "{{ owntone_url }}";
#proxy_set_header Host "owntone.local:3689";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
} }

View File

@ -2,6 +2,6 @@
# m h dom mon dow # m h dom mon dow
*/60 * * * * {{ owntone_user.username }} touch {{ owntone_path }}/audio/local_music/trigger.init-rescan */60 * * * * {{ owntone_user.username }} touch {{ owntone_path }}/audio/trigger.init-rescan
# #

View File

@ -1,12 +1,3 @@
# A quick guide to configuring OwnTone:
#
# For regular use, the most important setting to configure is "directories",
# which should be the location of your media. Whatever user you have set as
# "uid" must have read access to this location. If the location is a network
# mount, please see the README.
#
# In all likelihood, that's all you need to do!
general { general {
# Username # Username
# Make sure the user has read access to the library directories you set # Make sure the user has read access to the library directories you set
@ -197,7 +188,7 @@ library {
# Watch named pipes in the library for data and autostart playback when # Watch named pipes in the library for data and autostart playback when
# there is data to be read. To exclude specific pipes from watching, # there is data to be read. To exclude specific pipes from watching,
# consider using the above _ignore options. # consider using the above _ignore options.
pipe_autostart = true pipe_autostart = false
# Enable automatic rating updates # Enable automatic rating updates
# If enabled, rating is automatically updated after a song has either been # If enabled, rating is automatically updated after a song has either been
@ -208,7 +199,7 @@ library {
# skipcount and a rolling rating based on the current rating and the action # skipcount and a rolling rating based on the current rating and the action
# (played or skipped). Both results are combined with a mix-factor of 0.75: # (played or skipped). Both results are combined with a mix-factor of 0.75:
# new rating = 0.75 * stable rating + 0.25 * rolling rating) # new rating = 0.75 * stable rating + 0.25 * rolling rating)
#rating_updates = false rating_updates = false
# Allows creating, deleting and modifying m3u playlists in the library directories. # Allows creating, deleting and modifying m3u playlists in the library directories.
# Only supported by the player web interface and some mpd clients # Only supported by the player web interface and some mpd clients
@ -255,7 +246,7 @@ audio {
# e.g. Airplay. This feature relies on accurate ALSA measurements of # e.g. Airplay. This feature relies on accurate ALSA measurements of
# delay, and some devices dont provide that. If that is the case you # delay, and some devices dont provide that. If that is the case you
# are better off disabling the feature. # are better off disabling the feature.
#sync_disable = false sync_disable = false
# Here you can adjust when local audio is started relative to other # Here you can adjust when local audio is started relative to other
# speakers, e.g. Airplay. Negative values correspond to moving local # speakers, e.g. Airplay. Negative values correspond to moving local
@ -290,10 +281,11 @@ audio {
# Pipe output # Pipe output
# Allows OwnTone to output audio data to a named pipe # Allows OwnTone to output audio data to a named pipe
fifo { # fifo {
nickname = "fifo" # nickname = "fifo"
path = "/audio/output.fifo" # # placed outside of library
} # path = "/tmp/output.fifo"
# }
# AirPlay settings common to all devices # AirPlay settings common to all devices
#airplay_shared { #airplay_shared {
@ -369,6 +361,14 @@ airplay "{{ item.name }}" {
# Name used in the speaker list, overrides name from the device # Name used in the speaker list, overrides name from the device
#nickname = "My speaker name" #nickname = "My speaker name"
# } # }
{% for item in owntone_chromecast -%}
chromecast "{{item.name }}" {
exclude = {{ item.exclude|default(false) | lower }}
{%- if 'nickname' in item -%}
nickname = "{{ item.nickname }}"
{% endif +%}
}
{% endfor %}
# Spotify settings (only have effect if Spotify enabled - see README/INSTALL) # Spotify settings (only have effect if Spotify enabled - see README/INSTALL)
spotify { spotify {