Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version gate to strHdrType field #854

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions jellyfin_kodi/objects/kodi/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

##################################################################################################

from ...helper import values, LazyLogger
from ...helper import values, LazyLogger, kodi_version

from . import artwork
from . import queries as QU
Expand Down Expand Up @@ -241,7 +241,10 @@

track['FileId'] = file_id
track['Runtime'] = runtime
self.add_stream_video(*values(track, QU.add_stream_video_obj))
if kodi_version() < 20:
self.add_stream_video(*values(track, QU.add_stream_video_obj_19))

Check warning on line 245 in jellyfin_kodi/objects/kodi/kodi.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/objects/kodi/kodi.py#L245

Added line #L245 was not covered by tests
else:
self.add_stream_video(*values(track, QU.add_stream_video_obj))

Check warning on line 247 in jellyfin_kodi/objects/kodi/kodi.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/objects/kodi/kodi.py#L247

Added line #L247 was not covered by tests

for track in streams['audio']:

Expand All @@ -252,7 +255,10 @@
self.add_stream_sub(*values({'language': track, 'FileId': file_id}, QU.add_stream_sub_obj))

def add_stream_video(self, *args):
self.cursor.execute(QU.add_stream_video, args)
if kodi_version() < 20:
self.cursor.execute(QU.add_stream_video_19, args)

Check warning on line 259 in jellyfin_kodi/objects/kodi/kodi.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/objects/kodi/kodi.py#L259

Added line #L259 was not covered by tests
else:
self.cursor.execute(QU.add_stream_video, args)

Check warning on line 261 in jellyfin_kodi/objects/kodi/kodi.py

View check run for this annotation

Codecov / codecov/patch

jellyfin_kodi/objects/kodi/kodi.py#L261

Added line #L261 was not covered by tests

def add_stream_audio(self, *args):
self.cursor.execute(QU.add_stream_audio, args)
Expand Down
7 changes: 7 additions & 0 deletions jellyfin_kodi/objects/kodi/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_stream_video_obj = ["{FileId}", 0, "{codec}", "{aspect}", "{width}", "{height}", "{Runtime}", "{3d}", "{hdrtype}"]
# strHdrType is new to Kodi 20
add_stream_video_19 = """
INSERT INTO streamdetails(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth,
iVideoHeight, iVideoDuration, strStereoMode)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
"""
add_stream_video_obj_19 = ["{FileId}", 0, "{codec}", "{aspect}", "{width}", "{height}", "{Runtime}", "{3d}"]
add_stream_audio = """
INSERT INTO streamdetails(idFile, iStreamType, strAudioCodec, iAudioChannels, strAudioLanguage)
VALUES (?, ?, ?, ?, ?)
Expand Down