Add music/archive volume

This commit is contained in:
Wojciech Kozlowski 2023-03-01 20:14:12 +01:00
parent a83aeac92a
commit 7530583f40
10 changed files with 77 additions and 3 deletions

View File

@ -171,3 +171,18 @@ All steps below are to be executed as the `music` user.
will convert the flac files into mp3 files for sharing via Nextcloud. will convert the flac files into mp3 files for sharing via Nextcloud.
3. Run `nextcloud-upload /var/tmp/music/mp3/<artist>` for every artist to upload to Nextcloud. 3. Run `nextcloud-upload /var/tmp/music/mp3/<artist>` for every artist to upload to Nextcloud.
4. Remove the `/var/tmp/music/mp3/<artist>` directory. 4. Remove the `/var/tmp/music/mp3/<artist>` directory.
### Archive music
#### From rip
1. Run `beet --config .config/beets/archive.yaml import /var/lib/yggdrasil/home/music/rip`. This
will move the music files to `/var/lib/yggdrasil/data/music/archive`.
#### From collection
1. Run `beet --config .config/beets/archive.yaml import
/var/lib/yggdrasil/data/music/collection/<artist>/<album>`. This will copy the music files to
`/var/lib/yggdrasil/data/music/archive`.
2. Run `beet remove -d -a artist:"<artis>" album:"<album>"`. This will remove the music files from
the collection.

View File

@ -100,10 +100,12 @@ music_user_samba_password: "{{ vault_music_user_samba_password }}"
music_user_home_directory: "{{ system_var_home_directory }}/{{ music_user_name }}" music_user_home_directory: "{{ system_var_home_directory }}/{{ music_user_name }}"
music_user_data_directory: "{{ system_var_data_directory }}/{{ music_user_name }}" music_user_data_directory: "{{ system_var_data_directory }}/{{ music_user_name }}"
music_user_data_collection_directory: "{{ music_user_data_directory }}/collection" music_user_data_collection_directory: "{{ music_user_data_directory }}/collection"
music_user_data_archive_directory: "{{ music_user_data_directory }}/archive"
music_user_home_dataset: "rpool{{ music_user_home_directory }}" music_user_home_dataset: "rpool{{ music_user_home_directory }}"
music_user_data_dataset: "rpool{{ music_user_data_directory }}" music_user_data_dataset: "rpool{{ music_user_data_directory }}"
music_user_data_collection_dataset: "{{ music_user_data_dataset }}/collection" music_user_data_collection_dataset: "{{ music_user_data_dataset }}/collection"
music_user_data_archive_dataset: "{{ music_user_data_dataset }}/archive"
# -------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------
# music:backups # music:backups

View File

@ -14,3 +14,6 @@ argument_specs:
music_user_data_collection_dataset: music_user_data_collection_dataset:
type: "str" type: "str"
required: true required: true
music_user_data_archive_dataset:
type: "str"
required: true

View File

@ -26,6 +26,11 @@
name: "{{ music_user_data_collection_dataset }}" name: "{{ music_user_data_collection_dataset }}"
state: "present" state: "present"
- name: "create music archive dataset"
community.general.zfs:
name: "{{ music_user_data_archive_dataset }}"
state: "present"
- name: "create backup data dataset" - name: "create backup data dataset"
community.general.zfs: community.general.zfs:
name: "{{ system_backups_snapshots_data_dataset }}/{{ music_user_name }}" name: "{{ system_backups_snapshots_data_dataset }}/{{ music_user_name }}"

View File

@ -11,6 +11,9 @@ argument_specs:
music_user_data_collection_directory: music_user_data_collection_directory:
type: "str" type: "str"
required: true required: true
music_user_data_archive_directory:
type: "str"
required: true
music_user_nextcloud_domain: music_user_nextcloud_domain:
type: "str" type: "str"
required: true required: true

View File

@ -35,12 +35,18 @@
group: "{{ music_user_name }}" group: "{{ music_user_name }}"
mode: 0755 mode: 0755
- name: "configure beets" - name: "configure beets for collection"
ansible.builtin.template: ansible.builtin.template:
src: "./beets.yml" src: "./beets-collection.yml"
dest: "{{ music_user_home_directory }}/.config/beets/config.yaml" dest: "{{ music_user_home_directory }}/.config/beets/config.yaml"
mode: 0644 mode: 0644
- name: "configure beets for archive"
ansible.builtin.template:
src: "./beets-archive.yml"
dest: "{{ music_user_home_directory }}/.config/beets/archive.yaml"
mode: 0644
- name: "create nextcloud-upload config directory" - name: "create nextcloud-upload config directory"
ansible.builtin.file: ansible.builtin.file:
path: "{{ music_user_home_directory }}/.config/nextcloud-upload" path: "{{ music_user_home_directory }}/.config/nextcloud-upload"

View File

@ -0,0 +1,17 @@
plugins: fetchart info
library: {{ music_user_data_archive_directory }}/library.db
directory: {{ music_user_data_archive_directory }}
paths:
default: $albumartist/$year $album%aunique{}/$track $title
singleton: Non-Album/$artist/$title
comp: Compilations/$year $album%aunique{}/$track $title
import:
copy: yes
move: no
write: no
autotag: no
fetchart:
sources:
- filesystem

View File

@ -15,6 +15,14 @@
group: "{{ music_user_name }}" group: "{{ music_user_name }}"
mode: 0755 mode: 0755
- name: "directories : create archive directory"
ansible.builtin.file:
path: "{{ music_user_data_archive_directory }}"
state: "directory"
owner: "{{ music_user_name }}"
group: "{{ music_user_name }}"
mode: 0755
- name: "directories : create rip directory" - name: "directories : create rip directory"
ansible.builtin.file: ansible.builtin.file:
path: "{{ music_user_home_directory }}/rip" path: "{{ music_user_home_directory }}/rip"

View File

@ -22,6 +22,20 @@
directory mask = 0755 directory mask = 0755
register: music_rip_samba_rip_config register: music_rip_samba_rip_config
- name: "samba : configure \"music-collection\" samba share"
ansible.builtin.blockinfile:
path: "/etc/samba/smb.conf"
mode: 0644
insertafter: "EOF"
marker: "# {mark} ANSIBLE MANAGED BLOCK MUSIC:COLLECTION"
block: |
[music-collection]
comment = Music archive
path = {{ music_user_data_collection_directory }}
browseable = yes
read only = yes
register: music_rip_samba_collection_config
- name: "samba : configure \"music-archive\" samba share" - name: "samba : configure \"music-archive\" samba share"
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: "/etc/samba/smb.conf" path: "/etc/samba/smb.conf"
@ -31,7 +45,7 @@
block: | block: |
[music-archive] [music-archive]
comment = Music archive comment = Music archive
path = {{ music_user_data_collection_directory }} path = {{ music_user_data_archive_directory }}
browseable = yes browseable = yes
read only = yes read only = yes
register: music_rip_samba_archive_config register: music_rip_samba_archive_config
@ -65,5 +79,6 @@
state: "restarted" state: "restarted"
when: when:
(music_rip_samba_rip_config.changed or (music_rip_samba_rip_config.changed or
music_rip_samba_collection_config.changed or
music_rip_samba_archive_config.changed) and music_rip_samba_archive_config.changed) and
not music_rip_samba_start.changed not music_rip_samba_start.changed