Quote:
Originally Posted by JimmXinu
But I'm don't think it would cover what I was suggesting, because it only applies to books that are on the device. When searching for books that aren't on the device, there's nothing to tell you what device is attached.
|
What would you do with this information? "ondevice:false" tells you what books are not on the device. The template language can't modify metadata so it can't populate a column.
Quote:
I was thinking of a function that would return something like what `self.gui.device_manager.get_current_device_inform ation().get('info', None)` does for all books when a device is attached.
Is device manager accessible from a template function I wonder?
|
Yes it is, but there are problems. The templates are re-evaluated before the device manager has fully closed the device. The ondevice column is correct but get_current_device_information can return an info structure for a bit after the device disconnects. I saw this because some books still had device information after the disconnect.
I could add a function that returns the connected device name, but it wouldn't be guaranteed to be the empty string for a time after a device disconnects.
And yes, the device manager is visible to custom template functions.
The reason I didn't commit the changes is manual intervention will always be needed to make the information permanent (stored in a custom column). Doing it automatically would require a plugin that gets signaled when a device connects and disconnects. The plugin would update a tags-like custom column with something like "device_name:yes" or "device_name:no".