Replies: 2 comments 4 replies
-
I don't want to abuse the notes attribute more than we do, and we need to keep it parseable by mylar. This will make the source end up with ComicVine as the primary metadata source but any extra metadata provided by the filename or metron will be preserved, note that credits and any other lists are treated as single elements and are not merged just replaced if the later source has one. |
Beta Was this translation helpful? Give feedback.
-
This is what I'm planning: class GenericMetadata:
overlay_overwrite = 0
overlay_overwrite_no_clear = 1
overlay_add_missing = 2
overlay_combine_new = 3
overlay_combine_cur = 4
def overlay(self, new_md: GenericMetadata, mode: int = 0) -> None:
"""Overlay a new metadata object on this one
Modes:
0. Overwrite - When the 'new' object has non-None values, overwrite the current 'self' values with 'new'. This
includes None/empty values in 'new' clearing/resetting the field in 'self'.
1. Overwrite (no clear/reset) - Same as 0 but None/empty values from 'new' do NOT overwrite values in 'self'.
2. Add Missing - Any values that are None or an empty str/list/set, add them from 'new' to 'self'.
3. Combine New - Where possible combine the values of 'self' with the values of 'new'. Any values that collide
the 'new' value is used.
4. Combine Current - Same as 2 but 'self' value is kept with collisions.
"""
def assign(cur: str, new: Any) -> None:
if mode == self.overlay_overwrite:
if new is not None:
if isinstance(new, str) and len(new) == 0:
if isinstance(getattr(self, cur), (list, set)):
getattr(self, cur).clear()
else:
setattr(self, cur, None)
elif isinstance(new, (list, set)) and len(new) == 0:
pass
else:
setattr(self, cur, new)
elif mode == self.overlay_overwrite_no_clear:
pass
elif mode == self.overlay_add_missing:
pass
elif mode == self.overlay_combine_new:
pass
elif mode == self.overlay_combine_cur:
pass Then with the multi-read style support these options would be available (adding to the Any problem with the above (or additional modes)? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
With the ability to use other sources than CV, it seems that users may want to run their files through one or more sources. With that in mind, I don't believe there is anyway to choose what happens with old/new metadata.
My idea is to add an option to
add
,replace
ormerge
metadata already present. Default asadd
. As the others are obvious, when it comes tomerge
, duplicates would be removed and any new information appended. Maybeappend
would be a better nomenclature?When it comes to notes something along the lines of:
Tagged with ComicTagger 1.6.0a5.dev116 on 2023-10-08 22:42:14 using info from Comic Vine [comicvine: Issue ID 989653] and Metron [metron: Issue ID 62672]
In this case the
comicvine
andmetron
being the ID of the talker. I believe there are some programs out there that use this notes issue ID and it is breaking but this seems to be required as a one off.Beta Was this translation helpful? Give feedback.
All reactions