Fix some issues with music:org

This commit is contained in:
Wojciech Kozlowski 2023-02-26 00:21:00 +01:00
parent 3c84bfe673
commit 7ff22fe753
8 changed files with 44 additions and 8 deletions

View File

@ -162,7 +162,7 @@ All steps below are to be executed as the `music` user.
1. Run `beet import /var/lib/yggdrasil/home/music/rip`. This will move the music files to 1. Run `beet import /var/lib/yggdrasil/home/music/rip`. This will move the music files to
`/var/lib/yggdrasil/data/music/flac`. `/var/lib/yggdrasil/data/music/flac`.
2. Run `beet convert <match>`, where `<match>` is used to narrow down to new music only. This will 2. Run `beet convert -a <match>`, where `<match>` is used to narrow down to new music only. This
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.

View File

@ -114,7 +114,8 @@ music_user_backups_snapshots_skip_parent: true
# -------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------
# music:org # music:org
# -------------------------------------------------------------------------------------------------- # --------------------------------------------------------------------------------------------------
music_user_nextcloud_url: "https://cloud.wojciechkozlowski.eu/public.php/webdav" music_user_nextcloud_domain: "cloud.wojciechkozlowski.eu"
music_user_nextcloud_url: "https://{{ music_user_nextcloud_domain }}/public.php/webdav"
music_user_nextcloud_user: "{{ vault_music_user_nextcloud_user }}" music_user_nextcloud_user: "{{ vault_music_user_nextcloud_user }}"
music_user_nextcloud_pswd: "{{ vault_music_user_nextcloud_pswd }}" music_user_nextcloud_pswd: "{{ vault_music_user_nextcloud_pswd }}"

View File

@ -31,6 +31,7 @@
backups_restic_user_data_dataset: "{{ music_user_data_dataset }}" backups_restic_user_data_dataset: "{{ music_user_data_dataset }}"
backups_restic_user_data_directory: "{{ music_user_data_directory }}" backups_restic_user_data_directory: "{{ music_user_data_directory }}"
backups_restic_user_aws_bucket_prefix: "the-nine-worlds---{{ music_user_name }}" backups_restic_user_aws_bucket_prefix: "the-nine-worlds---{{ music_user_name }}"
music_org_nextcloud_ip_address: "{{ services_all_services.lrproxy.address }}"
tags: tags:
- "music:backups" - "music:backups"
- "music:backups:restic" - "music:backups:restic"

View File

@ -76,7 +76,8 @@ class WebDavManager:
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description="upload files to nextcloud") parser = argparse.ArgumentParser(description="upload files to nextcloud")
parser.add_argument("--config", type=str, default="~/.config/nextcloud-upload/config.yml", parser.add_argument("--config", type=str,
default=f"{os.path.expanduser('~')}/.config/nextcloud-upload/config.yml",
help="path to configuration") help="path to configuration")
parser.add_argument("target", type=str, help="file or folder to upload") parser.add_argument("target", type=str, help="file or folder to upload")

View File

@ -11,3 +11,9 @@ argument_specs:
music_user_data_directory: music_user_data_directory:
type: "str" type: "str"
required: true required: true
music_user_nextcloud_domain:
type: "str"
required: true
music_org_nextcloud_ip_address:
type: "str"
required: true

View File

@ -11,6 +11,12 @@
dest: "/usr/local/bin/nextcloud-upload" dest: "/usr/local/bin/nextcloud-upload"
mode: 0755 mode: 0755
- name: "resolve nextcloud-upload via hosts file"
ansible.builtin.lineinfile:
path: "/etc/hosts"
line: "{{ music_org_nextcloud_ip_address }} {{ music_user_nextcloud_domain }}"
insertafter: "EOF"
- block: - block:
- name: "create beets config directory" - name: "create beets config directory"

View File

@ -1,4 +1,4 @@
plugins: convert plugins: convert fetchart
library: {{ music_user_data_directory }}/flac/library.db library: {{ music_user_data_directory }}/flac/library.db
directory: {{ music_user_data_directory }}/flac directory: {{ music_user_data_directory }}/flac
@ -8,3 +8,9 @@ import:
convert: convert:
dest: /var/tmp/{{ music_user_name }}/mp3 dest: /var/tmp/{{ music_user_name }}/mp3
copy_album_art: yes
embed: yes
fetchart:
sources:
- filesystem

View File

@ -5,7 +5,7 @@
- "samba" - "samba"
- "samba-client" - "samba-client"
- name: "samba : configure samba share" - name: "samba : configure \"music-rip\" samba share"
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: "/etc/samba/smb.conf" path: "/etc/samba/smb.conf"
mode: 0644 mode: 0644
@ -20,7 +20,21 @@
guest ok = no guest ok = no
create mask = 0644 create mask = 0644
directory mask = 0755 directory mask = 0755
register: music_rip_samba_config register: music_rip_samba_rip_config
- name: "samba : configure \"music-archive\" samba share"
ansible.builtin.blockinfile:
path: "/etc/samba/smb.conf"
mode: 0644
insertafter: "EOF"
marker: "# {mark} ANSIBLE MANAGED BLOCK MUSIC:ARCHIVE"
block: |
[music-archive]
comment = Music archive
path = {{ music_user_data_directory }}/flac
browseable = yes
read only = yes
register: music_rip_samba_archive_config
- name: "samba : check for \"{{ music_user_name }}\" user" - name: "samba : check for \"{{ music_user_name }}\" user"
ansible.builtin.shell: "pdbedit --user={{ music_user_name }} || /usr/bin/true" ansible.builtin.shell: "pdbedit --user={{ music_user_name }} || /usr/bin/true"
@ -50,5 +64,6 @@
name: "smbd" name: "smbd"
state: "restarted" state: "restarted"
when: when:
music_rip_samba_config.changed and (music_rip_samba_rip_config.changed or
music_rip_samba_archive_config.changed) and
not music_rip_samba_start.changed not music_rip_samba_start.changed