That should work, but it feels clumsy.
The code in smart_update that does the actual copy is:
Code:
if replace_metadata:
# SPECIAL_FIELDS = frozenset(['lpath', 'size', 'comments', 'thumbnail'])
for attr in SC_COPYABLE_FIELDS:
setattr(self, attr, getattr(other, attr, 1.0 if
attr == 'series_index' else None))
self.tags = other.tags
self.cover_data = getattr(other, 'cover_data',
NULL_VALUES['cover_data'])
self.set_all_user_metadata(other.get_all_user_metadata(make_copy=True))
for x in SC_FIELDS_COPY_NOT_NULL:
copy_not_none(self, other, x)
if callable(getattr(other, 'get_identifiers', None)):
self.set_identifiers(other.get_identifiers())
# language is handled below
At the moment, "device_collections" ends up being part of SC_COPYABLE_FIELDS. By putting it in "SC_FIELDS_COPY_NOT_NULL", it gets removed from SC_COPYABLE_FIELDS, bu will still be copied if it has a value.
The current value of SC_FIELDS_COPY_NOT_NULL is:
Code:
SC_FIELDS_COPY_NOT_NULL = frozenset(['lpath', 'size', 'comments', 'thumbnail'])
I think that "device_collections" should be treated the same as "lpath". I can't find anywhere that device_collections is not set by a driver. And the current behaviour means that the device_collections is wiped after matching the books on the device to that in the library.