2015-04-06, 01:40
i found this bug while i was working on the dsplayer version
in SaveFileStateJob.cpp there is this code
i suppose that this it's to avoid to save new entry into the database for each played video
so only when currentvideosettings != defaultvideosettings kodi saves the entry into videodatabase
the first problem it's on this part because in defaultvideosettings it's set as default m_SubtitleCached = false
and when we play a video m_SubtitleCached always become m_SubtitleCached = true
so if we don't change default settings with "set as default for all videos" to set even in defaultsettings m_SubtitleCached = true, for each played video kodi will store a new entry
the second problem it's when we change the defaultsettings with "set as default for all videos"
after that if we change only one parameter on a video and then we stop the video, kodi will store the entry into the database
because currentvideosettings != defaultsettings... but then restore this parameter to the original state it's impossible
because when it's called SaveFileState it will see currentvideosettings == defaultsettings and it don't updates the previous entry for that video
i solved this by adding a new value AtStartVideoSettings that captures currentvideosettings at playstart so than in SaveFileState it's
in SaveFileStateJob.cpp there is this code
Code:
if (m_videoSettings != CMediaSettings::Get().GetDefaultVideoSettings())
{
videodatabase.SetVideoSettings(progressTrackingFile, m_videoSettings);
}
i suppose that this it's to avoid to save new entry into the database for each played video
so only when currentvideosettings != defaultvideosettings kodi saves the entry into videodatabase
the first problem it's on this part because in defaultvideosettings it's set as default m_SubtitleCached = false
and when we play a video m_SubtitleCached always become m_SubtitleCached = true
so if we don't change default settings with "set as default for all videos" to set even in defaultsettings m_SubtitleCached = true, for each played video kodi will store a new entry
the second problem it's when we change the defaultsettings with "set as default for all videos"
after that if we change only one parameter on a video and then we stop the video, kodi will store the entry into the database
because currentvideosettings != defaultsettings... but then restore this parameter to the original state it's impossible
because when it's called SaveFileState it will see currentvideosettings == defaultsettings and it don't updates the previous entry for that video
i solved this by adding a new value AtStartVideoSettings that captures currentvideosettings at playstart so than in SaveFileState it's
Code:
if (m_videoSettings != CMediaSettings::Get().GetAtStartVideoSettings())
{
videodatabase.SetVideoSettings(progressTrackingFile, m_videoSettings);
}