2015-10-29, 04:36
Hello Kodi team and developers,
Story:
I am working on a service plugin that automatically copies the photos from SD flash to my photo media library in specific folder structure of my preference (YYYY-MM/YYYY-MM-DD/IMGXXX.jpg), skips photos that are already copied, creates preview picture of the month folder, etc.
In my family the photographer is my wife, so the target is to have a seamless way to backup her photos from SD card with as minimum movements as possible.
My ultimate goal is this workflow: my wife inserts the SD card from the camera into the card reader, service plugin detects new media and automatically kicks in the backup process displaying progress bar and once all photos are copied - a dialog is displayed asking her if she wants to Safely Remove the media, she clicks OK - a confirmation is displayed that media is disconnected (Kodi does that already). She removes the SD card and inserts her next SD card. Happy wife - happy life
My initial version is doing most already, except it is polling for the target media folder from settings and kicks in when the list of files is changed and cannot safely remove media.
Questions:
1) How do I detect New Media is connected? i.e. when Kodi displays "New Media Connected" and debug log shows:
INFO: UDisks: Added /media/htpc/3930-6466
I need to detect event and get media path.
Ideally I need cross platform detection, while linux way is minimum.
2) How do I initiate Safely Remove media from plugin?
Thank you for your help!
Story:
I am working on a service plugin that automatically copies the photos from SD flash to my photo media library in specific folder structure of my preference (YYYY-MM/YYYY-MM-DD/IMGXXX.jpg), skips photos that are already copied, creates preview picture of the month folder, etc.
In my family the photographer is my wife, so the target is to have a seamless way to backup her photos from SD card with as minimum movements as possible.
My ultimate goal is this workflow: my wife inserts the SD card from the camera into the card reader, service plugin detects new media and automatically kicks in the backup process displaying progress bar and once all photos are copied - a dialog is displayed asking her if she wants to Safely Remove the media, she clicks OK - a confirmation is displayed that media is disconnected (Kodi does that already). She removes the SD card and inserts her next SD card. Happy wife - happy life
My initial version is doing most already, except it is polling for the target media folder from settings and kicks in when the list of files is changed and cannot safely remove media.
Questions:
1) How do I detect New Media is connected? i.e. when Kodi displays "New Media Connected" and debug log shows:
INFO: UDisks: Added /media/htpc/3930-6466
I need to detect event and get media path.
Ideally I need cross platform detection, while linux way is minimum.
2) How do I initiate Safely Remove media from plugin?
Thank you for your help!