Add udiskie to yavdr-desktop role
this is used to mount external data devices automatically Add yavdr-i18n to the default packages, so translations using the transale filter will work properly
This commit is contained in:
23
roles/yavdr-desktop/templates/udiskie/config.yml.j2
Executable file
23
roles/yavdr-desktop/templates/udiskie/config.yml.j2
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
program_options:
|
||||
tray: false # [bool] Enable the tray icon. "auto"
|
||||
menu: flat # ["flat" | "nested"] Set the
|
||||
automount: true # [bool] Enable automatic mounting.
|
||||
notify: true # [bool] Enable notifications.
|
||||
password_cache: false # [int] Password cache in minutes. Caching is
|
||||
|
||||
file_manager: ""
|
||||
notify_command: "{{ vdr.home }}/bin/udiskie_vdr_mount_helper '{event}' '{device_presentation}' '{mount_path}'"
|
||||
|
||||
device_config:
|
||||
- is_loop: true
|
||||
ignore: true
|
||||
|
||||
- is_external: false
|
||||
ignore: true
|
||||
|
||||
notifications:
|
||||
device_mounted: 5 # mount notification
|
||||
device_unmounted: true # unmount notification
|
||||
device_added: true # device has appeared
|
||||
device_removed: true # device has disappeared
|
||||
45
roles/yavdr-desktop/templates/udiskie/udiskie_vdr_mount_helper.j2
Executable file
45
roles/yavdr-desktop/templates/udiskie/udiskie_vdr_mount_helper.j2
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
#!/bin/bash
|
||||
videodir="{{ vdr.recdir }}"
|
||||
event="$1"
|
||||
device_node="$2"
|
||||
mount_path="$3"
|
||||
|
||||
|
||||
logger -t "mount-notification" "event: $event, device: $device_node, mount_path: $mount_path"
|
||||
case "$event" in
|
||||
'device_mounted')
|
||||
target="${videodir}/$(basename "${mount_path}")"
|
||||
ln -s -T "$mount_path" "$target" ||
|
||||
{ logger -t "vdr recordings found" "mountpoint already exists, aborting"; exit; }
|
||||
# check if we got a vdr recording on the mountpoint
|
||||
if [ -n $(find "$mount_path" -name "*.rec" -print -quit 2>/dev/null) ]
|
||||
then
|
||||
vdr-dbus-send /Skin skin.QueueMessage string:"$mount_path mounted (with recordings)"
|
||||
svdrpsend updr
|
||||
else
|
||||
vdr-dbus-send /Skin skin.QueueMessage string:"$mount_path' mounted"
|
||||
fi
|
||||
;;
|
||||
'device_unmounted')
|
||||
removed_symlinks=($(find "$videodir" -xtype l -delete -print))
|
||||
logger -t "device umounted" "remove unneeded symlinks: $(paste -d " " <<< "${removed_symlinks[@]}")"
|
||||
vdr-dbus-send /Skin skin.QueueMessage string:"$device_node umounted"
|
||||
svdrpsend updr
|
||||
;;
|
||||
'device_removed')
|
||||
removed_symlinks=($(find "$videodir" -xtype l -delete -print))
|
||||
if [ -z "$device_node" ] && exit
|
||||
logger -t "device removed" "remove unneeded symlinks: $(paste -d " " <<< "${removed_symlinks[@]}")"
|
||||
vdr-dbus-send /Skin skin.QueueMessage string:"$device_node removed"
|
||||
svdrpsend updr
|
||||
;;
|
||||
'job_failed')
|
||||
if [ -n "$mount_path" ]
|
||||
then
|
||||
logger -t "umount failed" "could not unmount $mount_path"
|
||||
else
|
||||
logger -t "operation failed" 'could not mount(?) '"$device_node"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
2
roles/yavdr-desktop/templates/udiskie/umount_all.j2
Executable file
2
roles/yavdr-desktop/templates/udiskie/umount_all.j2
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
{{ "Safely remove usb mass storage" | translate }} : echo 'svdrpsend mesg "$(udiskie-umount -a 2>&1 | grep -o "Error unmounting.*")"' | at now
|
||||
Reference in New Issue
Block a user