MetaMender Changelog
====================

v1.3.3 (2026-11-29)
-------------------
Bug Fixes:
  - A manual scan always starts from the beginning. It used to carry on
    from a background scan that was interrupted, skipping every item
    that scan had already done, so local art you had deleted from those
    items was not filled until the weekly check.
  - Episodes of a deleted show count as gone instead of unreachable at
    every scan: the gone check now goes up to three folders above the
    video file while each is missing, never above the item's library
    folder (so an unplugged drive stays unreachable), a share host or a
    filesystem root.
  - The name of a set MetaMender merged because all its movies belong to
    the collection (possibly a set you made) still marks a later set
    under that name as a duplicate, but no longer lets that set become
    the one MetaMender looks after (and renames) when its own set is
    gone and the collection has other sets. Such names are kept apart
    from TMDB's names in the tracker.
  - Details, and Update now on the set, no longer call a duplicate set
    "merged" when none of its movies would move (each was put there by
    you, or its library does not have Movie sets ticked): it shows as
    left alone.
  - A scan after a library update no longer fetches the details of a
    second Kodi entry for an item MetaMender already follows under
    another entry (same file and same TMDB or IMDb id, or for an episode
    the same numbers); it is counted as a duplicate straight away, or as
    excluded in an excluded library, as a full scan counts it. The
    episodes of a multi-episode file and a file scraped under another id
    are still fetched.
  - The IMDb ratings update logs outcome=error, not success, when
    reading the loaded dataset fails at the end.

Improvements:
  - Update now on an item without a TMDB, TheTVDB or IMDb id, for which
    none could be found, says "Nothing to look up" instead of "No
    changes"; on a show or season, when neither it nor any of its
    episodes has one.
  - The service start line in the log carries the add-on's version.

Internal:
  - requirements-dev.txt pins the test and lint tools (with the versions
    Python 3.9 and 3.10 need), and requirements-dev.lock holds them and
    their dependencies with hashes, for pip install --require-hashes.
    Neither is in the add-on zip.

v1.3.2 (2026-11-28)
-------------------
Improvements:
  - When Kodi re-adds an item under a new Kodi id (Refresh, or a video
    file replaced with a new release), the next scan writes back the
    text, ratings and art MetaMender had written that the scraper
    replaced, also for a settled field; art within the usual art rules,
    so a local image file, art from another website and an episode thumb
    that is a web image (such as the scraper's TMDB still) stay. The
    rewrite is recorded like Update now's check, so no field moves along
    its schedule. The scraper's art is taken as first seen, so it is no
    longer locked as changed outside MetaMender. A value from an NFO
    file, a field the user locked and a field MetaMender never wrote
    stay as they are. Art locked this way before 1.3.2 stays locked;
    Details can unlock it. If a site or the item's share cannot be
    reached in the scan that finds the re-add, a field still being
    checked gets its value back when it is next due; a settled field,
    no longer checked, gets it back only through Update now on the item.
  - A second Kodi set of a collection whose set MetaMender manages is
    now merged when every counted movie in it belongs to that
    collection, whatever the set is called, for example the older
    English name a scraper still uses. Its name is then learned as a
    name of the collection. A set holding a movie of another collection,
    or one whose collection is not known, stays shared and nothing
    moves. A movie MetaMender saw in a managed set that the user then
    put in another set counts as the user's move and is never merged
    back. On the first scan after upgrading, a second set whose movies
    all belong to the collection, including a set you made yourself, is
    merged into the set MetaMender looks after.
  - The "N items updated" notification after a scan, background or
    manual, now also counts movies that joined or moved between sets and
    sets created; a background scan also counts seasons and movie sets
    updated, as a manual scan already did.
  - Scan logs are kept up to 30 files, none older than 7 days, instead
    of the last 10, so more scans can go with a bug report.

Bug Fixes:
  - A scan after a library update no longer puts off the daily scan, and
    no longer opens or closes the full scan's cycle: an interrupted full
    scan keeps its resume point instead of being marked complete.
  - A scan after a library update no longer fetches the details of every
    item in an excluded library or folder: the ids-only listing carries
    the file, and such items are counted as excluded before any details
    call. Items in an excluded library are skipped before their tracker
    identity is resolved, so they cost no Kodi lookup, and seasons of an
    excluded show are reported as excluded instead of as a season
    without a show id.
  - When Kodi lists one video file twice, the tracker row no longer
    flips between the two entries every scan. The entry the row records
    keeps it (the lowest listed entry when that id is gone); the other
    is skipped and counted as a duplicate. Update now on the other entry
    says that Kodi lists the file twice and MetaMender updates its other
    entry, instead of "No changes", and Details there shows the fields
    read-only. MetaMender does not remove Kodi's extra entry.
  - Episodes without ids of a show whose TMDB and TheTVDB ids both came
    from Kodi are now matched by episode number. Such a show was never
    marked as checked because no id lookup ran, so its episodes were put
    off for good.
  - An item whose video file or show folder is gone, while the folder it
    was in still lists other entries, or a movie whose whole folder was
    deleted while the folder above it still lists other entries, is
    skipped as gone instead of being counted as unreachable at every
    scan. An item on a share that
    does not answer stays unreachable.

Internal:
  - kodi.lookup_item tells Kodi's -32602 answer for an id that does not
    exist from a failed query; get_item_by_id keeps its contract and its
    WARNING on top of it. A recorded id that is gone is logged at DEBUG
    on the scan's path.
  - Plain and <identity>|<file> tracker rows are resolved by one check
    of the row's recorded Kodi id (_resolve_identity), with Kodi's
    answers cached per scan pass. An item whose recorded id Kodi did not
    answer about is skipped for that scan and counted as transient, so
    the re-add signal is not lost. A re-add is logged at INFO as
    scan.readded; a second entry as scan.duplicate_file and a gone item
    as scan.skip reason=gone (DEBUG); scan.complete reports both counts.
  - service.skip_playback is logged once when a due scan starts waiting
    for playback to stop, and service.playback_wait_end (waited_s) when
    it goes ahead, instead of every second.
  - The IMDb ratings dataset update logs imdb.prepare at INFO when it
    starts and ends, with duration_ms and outcome.

v1.3.1 (2026-11-26)
-------------------
New Features:
  - With Movie sets ticked, a movie in no set now joins its collection's
    set, and a collection with no set gets one, also for a single movie.
    A movie you take out of a set after this version has looked at the
    set stays out, also after a refresh; one you took out before that is
    added back once, and taking it out again keeps it out. No set is
    created while TMDB has not answered for a movie that is in a set. A
    set whose name has a folder in Kodi's movie set information folder
    keeps that name.

Improvements:
  - A library's page says whether it is a movies or a TV shows library
    and offers only the choices for that kind: no taglines, trailers or
    movie sets for TV shows, no episode titles or thumbs for movies, and
    Details and Other art name only what applies. MetaMender tells the
    kind from what Kodi has scanned into the library; a library with
    nothing in it yet, or with both kinds, shows every choice and says
    why. A hidden choice keeps its tick; the library list and the summary
    leave it out.

Bug Fixes:
  - Background, Stop and Back in the Update now progress window now
    respond while a show or season is updated from the Videos window.
    Every change made Kodi reload the list behind the window, and during
    a reload Kodi ignores the remote; on a slow device the reloads ran
    back to back. Update now pauses its changes while you are
    pressing keys, so the next press reaches the window; when you leave
    the remote alone it runs at full speed. After Background, browsing
    the library pauses it the same way.
  - Runtime is no longer written to a movie or episode whose video file
    Kodi has read: Kodi shows the file's own length there, so the write
    was never seen and only reloaded the list. Details says "video file"
    for such a runtime.

Internal:
  - No str.removesuffix() or removeprefix(), which Python 3.8 lacks; the
    official repository's checker assumes Kodi 21 may run 3.8. A test
    keeps them out.

v1.3.0 (2026-11-24)
-------------------
New Features:
  - Posters, per library: with Posters ticked, MetaMender fills empty
    movie, show and season posters and refreshes posters from TMDB or
    fanart.tv while a title is new. It picks a poster in the library's
    language first (from the chosen Art source, then the other site),
    then the fallback language, then a poster without text; the best
    voted TMDB poster or most liked fanart.tv poster wins, and a current
    poster stays unless a better one clearly leads. A poster without
    votes or likes never replaces one in the same language that has them;
    a poster in the library's language replaces one in another language
    or without text even before anyone rated it.
  - Episode thumbs, per library: with Episode thumbs ticked, a thumb Kodi
    grabbed from the video (washed out on HDR files), a broken link or an
    empty thumb gets TMDB's episode still, or TheTVDB's episode image when
    TMDB has none.
  - Local image files (such as those Artwork Dump saved), posters from
    other websites and art from an NFO file are left alone, and so is a
    poster changed outside MetaMender after Posters was ticked: it is
    locked, and Details shows why and can unlock it. A TMDB or fanart.tv
    poster picked before Posters was ticked may be replaced once; Restore
    original puts it back. MetaMender writes no image files.
  - Art source per library: TMDB (the default) or fanart.tv, the site
    asked first for posters, fanart, clear logos and key art.
  - English as a last resort for empty art: when neither site has an
    image in the library's language, the fallback language or without
    text, empty art (an empty slot, a frame grab, a broken link or a
    deleted local file) is filled with an English one. English art never
    replaces art the item already has; art MetaMender filled this way is
    replaced once a better image appears.
  - Fanart, per library: with Fanart ticked, the main background image
    of movies and shows is filled and refreshed from TMDB or fanart.tv
    while a title is new, preferring one without text, then the
    library's language, then the fallback language. Only the main
    fanart is touched, never the extra fanart (fanart1, fanart2...).
  - Other art, per library: with Other art ticked, clear logos (picked
    like posters; TMDB's SVG logos, which Kodi cannot show, are
    skipped), key art (a poster without text) and, from fanart.tv only,
    landscape, banner, disc art (movies), clear art and character art
    (shows) are filled and refreshed. fanart.tv's HD logos and clear art
    come before the SD ones.
  - Deleted local art files are filled: art that points at a local file
    that no longer exists (for example one Artwork Dump saved) is filled
    like empty art, for every ticked art type. Deleting the files is
    enough; background scans check local files weekly, and opening
    MetaMender from Program add-ons or Update now checks at once. A share
    that is offline is never taken for a deleted file. A movie or episode
    whose video file is gone is left alone until Kodi's library is
    cleaned; a movie set's art is judged by its art folder alone.
  - Movie sets, per library: with Movie sets ticked, a set gets TMDB's
    name for its collection in the library's language (then the fallback
    language, then English) and its plot like a movie's, and its poster,
    fanart and other art with those ticks, from TMDB's collection images
    and fanart.tv's collection art. A set follows the library most of its
    movies are in; a tie, or movies that do not mostly share one TMDB
    collection, leave it alone. The name is replaced once; Restore
    original puts it back, and a name changed outside MetaMender is
    locked. A set whose movies all have NFO files keeps its name, plot
    and art.
  - Duplicate sets merged: a set Kodi creates under a renamed set's old
    name (a new or refreshed movie, or an NFO with the old name) has its
    movies moved into the renamed set. A movie you moved yourself is never
    moved again, a set with a name of its own is never merged, and the
    emptied set is left for Kodi's library clean to remove. MetaMender
    otherwise never creates or deletes a set or changes its movies.
  - Details and Update now on a movie set, from the MetaMender context
    menu. Details shows the set's name, plot and art with where they came
    from, Restore original and the lock, the set's TMDB collection, the
    movies MetaMender moved into it, and why a set is left alone. Update
    now refreshes the set (not its movies) after merging its duplicates.
    A movie's Details says when MetaMender moved it between sets.
  - Optional Personal fanart.tv API key setting.
  - Season posters: a TMDB season poster that is the same file as one of
    its show's posters is skipped, and among equally liked fanart.tv
    season posters the one uploaded together with the show's other
    seasons' posters is preferred.
  - Seasons have a Details window, and Update now on a season or show
    refreshes the season posters too.
  - Posters, Episode thumbs, Fanart, Other art and Movie sets are off for
    every library, including libraries set up before this version.
  - Manual and help at the top of the settings: a window with a QR code
    and the address of the online manual, to open on a phone or computer.

Bug Fixes:
  - MetaMender's windows no longer flash grey while a scan or Update now
    writes to the library: every write made Kodi redraw the list behind
    the window, and for that moment the theme colours were read from
    another dialog.
  - Stop scan takes effect before the next part of the scan asks Kodi for
    its list of items, which on a large library takes seconds, and a stop
    that arrives between two parts ends the scan there.
  - The scan that runs when you open MetaMender from Program add-ons no
    longer ends at once because of a stop left over from an earlier scan,
    and it stops when Stop scan is chosen.

v1.2.1 (2026-11-22)
-------------------
New Features:
  - Stop scan in the MetaMender context submenu, shown while a scan runs:
    the scan stops after the item it is working on, and the next scan
    carries on from there.

Bug Fixes:
  - While a scan runs, browsing the movie or TV show list no longer keeps
    reloading it: Kodi reloads the list after every library change, so a
    background scan now holds its changes while the Videos window is in
    use and writes them once nothing has been pressed for a minute or the
    window is left. Update now still writes straight away.

Internal:
  - New service/stopscan.py and context_stop.py; the request is the
    metamender_stop_scan home window property, cleared by the service at
    the start and end of every cycle. Constants VIDEO_NAV_WINDOW,
    BROWSE_IDLE_SECONDS (60) and STOP_SCAN_PROPERTY.

v1.2.0 (2026-11-22)
-------------------
New Features:
  - Libraries are included explicitly: the Libraries step of setup and
    the Libraries entry in the add-on settings list every video source
    Kodi has, and a library is only worked on once it is ticked. Each
    included library has its own settings page: language and fallback
    language, what to fill, rating source, text sources, title to show
    and age rating country. Ticking a library switches nothing on; its
    page starts with every field off.
  - A video source Kodi gains after setup is added as not included and
    raises one notice (once per library) that opens the library list.
  - Keep the original title, per library: with show and movie titles ticked,
    the library's movies and shows get their original title (TMDB's
    original_title and original_name) in its own language and script
    instead of the title in the library's language. Episode titles and
    other text still follow the library's language.
  - Settings from 1.1 are converted automatically on the first start:
    each library keeps the choices it had, one notice says so, and
    nothing in the video library changes. The 1.1 values are copied
    aside at service start; when Kodi had already dropped them, the
    libraries 1.1 scanned are included with their languages but nothing
    switched on, and the notice says the earlier choices could not be
    read. A 1.1 setting for a folder above a library applies to it.
  - Back or Cancel on the library list with unsaved changes asks
    whether to save them.
  - Setup's lists of options (a language, a country, what to do with a
    library), its questions and messages, and the Reset tracker question
    open in MetaMender's own windows instead of Kodi's dialogs, so they
    look the same in every skin.

Bug Fixes:
  - Fixed: the service and the add-on failed to start on Kodi builds
    that run Python 3.9, such as OSMC's Kodi 21 (TypeError: unsupported
    operand type(s) for |). The certification module's Candidate type
    alias used an X | None union, which Python evaluates at import and
    only supports from 3.10.
  - With script.module.imdbratings 1.1.0, IMDb rating lookups no longer
    check for a new IMDb dataset and can no longer start its download in
    the middle of a scan, where Kodi could not stop it at shutdown or
    when playback starts. The dataset is still refreshed once before each
    scan, which Kodi can abort. Module 1.0.0 still works as before.
  - Trailer links only take a TMDB video key that is a YouTube video id;
    any other key is skipped, so it cannot add parameters to the
    YouTube add-on call stored in the library.
  - On Kodi 22, setup offered only "Video add-ons" when Kodi had no
    video sources of its own (a client sharing another machine's
    library database), instead of the folders taken from the library.
    Kodi 22 lists its Video add-ons node as a video source; sources that
    are no folder are now left out.

Internal:
  - Library choices are stored per library and read through the
    library's own settings; the global toggles that used to hold them
    are gone, together with the strings that labelled them.
  - Unused entries were removed from strings.po, and the empty-library
    and summary texts of setup now point at Libraries.
  - The IMDb adapter uses the module's lookup() and StoreError when the
    installed module has them (1.1.0), which also tells a failing store
    apart from "no rating" in one query instead of two; with 1.0.0 it
    keeps get_rating() plus the dataset_date() check. addon.xml still
    accepts 1.0.0 until 1.1.0 is in Kodi's official repository.
  - The Python floor is 3.9: ruff and pyright target it, and
    tests/test_python_floor.py parses every shipped file with the 3.9
    grammar and rejects X | Y type unions outside annotations.

v1.1.0 (2026-11-13)
-------------------
New Features:
  - Setup asks which rating Kodi shows (Rating source): a new step after
    What to fill, shown while ratings are ticked, with Follow your
    scraper preselected and one line on what each choice does.
  - Setup asks where TV show plots and titles come from first (Text
    source order): a new step shown while plots, episode titles or show
    and movie titles are ticked.
  - The certification country step has a Replace other countries'
    ratings tick box (Replace incorrect certifications) above the
    country list, and the summary lists all three choices. All three
    stay in the add-on settings too.

Improvements:
  - The settings call the default rating and text choice "Follow your
    scraper", the same words as setup.

Internal:
  - SetupFlow adds the ratings and text steps from the ticked features;
    settings_to_write always writes rating_source, text_source_order and
    replace_incorrect (a skipped step rewrites the stored value).
  - Setup list rows carry their own marker (ListItem property marker,
    the step's kind unless a row sets its own), so one list mixes a
    checkbox with radio rows; the unread MM.Marker window property and
    the unused setup_model.summary_lines are removed. The step dots go
    up to eight.

v1.0.1 (2026-11-13)
-------------------
Bug Fixes:
  - Fixed: the Update now progress window's refresh thread slept in a
    loop and did not notice Kodi quitting; progress_window.follow now
    waits on xbmc.Monitor().waitForAbort and closes the window when Kodi
    asks add-ons to stop.

Internal:
  - Changes from the official repository's add-on review:
    resources/lib/service/setup.py is now wizard.py (a file named
    setup.py reads as a leftover packaging script), and the TheTVDB
    project key is stored encoded and decoded at import.

v1.0.0 (2026-11-12)
-------------------
New Features:
  - First release. A background service that fills missing and refreshes
    stale video library metadata for movies, TV shows and episodes from
    TMDB, TheTVDB and IMDb's public ratings (script.module.imdbratings),
    written back over JSON-RPC, with per-field progress in a local
    sqlite tracker.
  - Fields: ratings and votes (TMDB and IMDb slots beside the scraper's,
    shown rating per the Rating source setting), plots, episode titles,
    show and movie titles (optional), taglines, directors and writers,
    genre, studio, country, runtime, first aired date and trailers, each
    group switched on or off in setup or the settings.
  - Languages: text in each source folder's own language, with an
    optional fallback language that only fills empty fields; a folder
    without a language only gets its empty fields filled.
  - Maturity model: a field is checked again on a schedule while its
    content is new (7, 30 and 90 days between checks, then at one year)
    and settled after that; a failed check never counts as a check.
  - Age ratings in one country's system for NL, BE, DE, AT, GB, US, FR,
    DK, SE and AU: TMDB's rating for that country, the FSK, BBFC and
    Medieraadet sites, then other countries' ratings converted through
    the preset tables (resources/presets/*.json); a converted rating is
    re-checked monthly for a year.
  - Episodes without ids (the TVmaze scraper) are matched by season and
    episode number only when the air date (within a day, unique in its
    season) or the title agrees; a conflict between TMDB and TheTVDB
    uses neither.
  - NFO files: an item with an NFO file only gets its empty fields
    filled, matching Kodi's own NFO lookup.
  - Setup wizard (TMDB key, library and folder languages, what to fill,
    age rating country); nothing is scanned before it is finished.
  - Context menu MetaMender submenu: Update now for a movie, show,
    season or episode (with a progress window that can be stopped or
    sent to the background), and Details.
  - Details window: per field where the value came from, what it
    replaced, when it was checked and is due, and why it was left
    alone; Restore original, Keep this value and unlock; the ids and
    how each was found.
  - Quiet background operation: nothing while anything plays, a short
    notification after a scan that changed something, and a "MetaMender
    needs you" window for problems that need the user (setup, key,
    failing scans, unreachable folders).
  - Window colour themes: Golden Hour, Ultraviolet, Ember, Nightfall.

Internal:
  - Tested with full service scans of a 431-movie, 438-show,
    6,603-episode library on Kodi 21.3 and Kodi 22 RC1.
  - Installed from the release zip through Kodi's Install from zip file:
    Kodi fetched script.module.imdbratings from the official repository
    itself; the context menu entry appears after a Kodi restart.
