MediaBrowser / MediaBrowser/plugin.video.emby

Empty MediaStreams during sync erase Kodi-generated streamdetails for STRM/ISO items

Open
#599 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
324
Forks
185
Avg merge
1m
Merged PRs (30d)
1

Description

Description

When an Emby .strm item points to an ISO file, Emby may return a valid MediaSource but no MediaStreams.

Kodi can detect and save the actual stream information after playback. The video information dialog then correctly shows resolution, codec, HDR type, audio codec and channels.

However, after restarting Kodi, Emby Next Gen startup sync removes those Kodi-generated stream details. The media information badges disappear again.

Environment
  • Emby Next Gen: 12.4.23
  • Kodi: 22.0-BETA1
  • Platform: Android
  • Playback source: .strm pointing to an HTTP ISO
Steps to reproduce
  1. Sync an ISO-backed .strm movie whose Emby MediaStreams are empty.
  2. Open its Kodi information dialog. Media badges are missing.
  3. Play the ISO and stop normally.
  4. Return to the information dialog. Kodi now shows the detected video/audio information.
  5. Restart Kodi and wait for Emby Next Gen startup sync.
  6. Open the information dialog again.
Actual behavior

The Kodi-generated streamdetails rows are deleted during sync and are not restored because the incoming Emby MediaStreams list is empty.

Example log during startup sync:

EMBY.core.common: No mediastreams found for movie: 76096 / .../F1:狂飙飞车 (2025).iso.strm

Before and after sync, the movie remained associated with the same Kodi file ID:

idFile: 9988

After playback, Kodi had populated stream details for this file and the UI displayed them. After startup sync, the same idFile had zero rows in streamdetails. Therefore, this is not caused by file-ID remapping.

Expected behavior

When the incoming Emby item has no MediaStreams, existing Kodi streamdetails should be preserved.

An empty or missing MediaStreams list should mean “no authoritative stream information available”, rather than “the media has no streams”.

If Emby supplies non-empty stream information, replacing the existing Kodi data is reasonable.

Probable cause

For an existing movie, the update path calls:

common.delete_ContentItemReferences(...)

That function unconditionally calls:

SQLs["video"].delete_streams(KodiFileId)

Later, set_VideoCommon() calls add_streams(), but no rows are inserted because all KodiStreams arrays are empty.

Suggested behavior

Only delete and replace existing stream details when the incoming media source contains usable video, audio or subtitle stream data.

Conceptually:

has_streams = (
    video_streams
    or audio_streams
    or subtitle_streams
)

if has_streams:
    delete_existing_streamdetails()
    add_incoming_streamdetails()
else:
    preserve_existing_streamdetails()

This would allow Kodi-detected metadata to survive regular, incremental and startup synchronization for media that Emby cannot probe, especially remote STRM/ISO sources.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the existing movie update path through common.delete_ContentItemReferences and set_VideoCommon, then inspect delete_streams and the KodiStreams arrays. The change is done when empty incoming MediaStreams preserve existing streamdetails, while non-empty streams replace them, across regular, incremental, and startup synchronization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.