I've got a python daemon that controls an audio player. Now I want this daemon to monitor USB disks inserted and add their content to the mpd media library.
One part of this is a udisk client that waits for disks inserted and then immediately mounts them.
I want to mount the disks read-only, so there won't be any data corruption if I unplug the the disk without unmounting or shutting down first.
My final code is this.
As long as you mount read-only or use journaling filesystems like ext4 or NTFS (not sure) you should not have any problem with data integrity when just pulling the plug. Unmounting not required in that case, the mount automatically disappears.
TODO: python complains about outdated
GObject.MainLoop()