-
Notifications
You must be signed in to change notification settings - Fork 93
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
HTSP v26 support #257
HTSP v26 support #257
Conversation
The setting should not be nessecary. Yes, on first call of getAddonCapabilites we are not connected (most probably), but addon capabilites are re-read directly after the addon state changes to CONNECTED. => https://github.com/xbmc/xbmc/blob/master/xbmc/pvr/addons/PVRClients.cpp#L1536 If this does not work, it's broken. |
Are you sure it does not work? GetTimerTypes should be called not only once, but on demand, for instance everytime timer settings dialog is opened, and there is no caching of the types in Kodi PVR core. So, it should work. However, if there is a call to GetTimerTypes that comes to "early", this could be a bug in Kodi PVR core which has no serious consequences, though. I will look inti this. |
@ksooo Good to know that GetTimerTypes gets called every time, that pointed me to problem and solution ;-) Is rereading the addon settings after connecting a new thing? I always remembered that this was a limitation, I'll see if I can get it working without the setting then :-) |
So, both "problems" solved? Rereading add-on capabilities (not settings, that's different!) is there since day 1 of async connect, means since very early Krypton alphas. |
Just looked it up in the code: both addon capabilities and timer types are reread if connection state changes to CONNECTED. So, timer types are not always fetched from the backend, like I said earlier, but only on (re)connect, exactly like addon capabilities. |
Oops, closed by accident. @ksooo Both issues resolved, this async stuff is really an improvement ;-) |
@Glenn-1990 the "delete channels without services" can be dropped now that you did tvheadend/tvheadend@e73a8b4 right? |
@Jalle19 indeed ;-) |
@piotrasd may i kindly ask you not to hijack a random PR for completely unrelated feature requests. Thank you. |
@@ -495,6 +495,7 @@ bool CHTSPConnection::SendHello ( void ) | |||
bool CHTSPConnection::SendAuth | |||
( const std::string &user, const std::string &pass ) | |||
{ | |||
uint32_t access, u32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
access
should be bool
// <= htsp v25, msg present = no access, msg missing = access | ||
// >= htsp v26, msg should be present in any case | ||
if (m_htspVersion <= 25) // | ||
access = msg ? 0 : 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would return early end skip the else
clause, but it's up to you
access = msg ? 0 : 1; | ||
else | ||
{ | ||
if (msg == NULL || (!htsmsg_get_u32(msg, "noaccess", &u32) && u32)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullptr
|
||
/* Log received permissions */ | ||
if (!htsmsg_get_u32(msg, "admin", &u32)) | ||
Logger::Log(LogLevel::LEVEL_INFO, "admin permissions: %i", u32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you log these lines with two spaces extra indentation, like we do for demuxer streams? I find it makes the log more readable.
if (!htsmsg_get_u32(msg, "streaming", &u32)) | ||
Logger::Log(LogLevel::LEVEL_INFO, "streaming permissions: %i", u32); | ||
if (!htsmsg_get_u32(msg, "dvr", &u32)) | ||
Logger::Log(LogLevel::LEVEL_INFO, "dvr permissions: %i", u32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DVR in uppercase, same below for "dvr connection limit"
if (!htsmsg_get_u32(msg, "limitdvr", &u32)) | ||
Logger::Log(LogLevel::LEVEL_INFO, "dvr connection limit: %i", u32); | ||
if (!htsmsg_get_u32(msg, "limitstreaming", &u32)) | ||
Logger::Log(LogLevel::LEVEL_INFO, "sreaming connection limit: %i", u32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo (should be streaming)
if (m_conn.GetProtocol() < 26) | ||
return PVR_ERROR_NOT_IMPLEMENTED; | ||
|
||
/* Seems a bit odd */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kodi calls this function to request the play position, although the play position was already transferred to Kodi as a member of PVR_RECORDING.
@@ -1367,7 +1408,7 @@ bool CTvheadend::Connected ( void ) | |||
m_asyncState.SetState(ASYNC_CHN); | |||
|
|||
msg = htsmsg_create_map(); | |||
if (Settings::GetInstance().GetAsyncEpg()) | |||
if (Settings::GetInstance().GetAsyncEpg() || m_conn.GetProtocol() >= 26) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop this commit now
@@ -598,6 +602,43 @@ PVR_ERROR CTvheadend::RenameRecording ( const PVR_RECORDING &rec ) | |||
return SendDvrUpdate(m); | |||
} | |||
|
|||
PVR_ERROR CTvheadend::SetPlayCount ( const PVR_RECORDING &rec, int playcount ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use playCount
in another place, I suggest to use it here too for consistency
return SendDvrUpdate(m); | ||
} | ||
|
||
PVR_ERROR CTvheadend::SetPlayPosition ( const PVR_RECORDING &rec, int playposition ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use playPosition
when calling this method, I suggest you name this the same for consistency
Lets finalize this PR first before opening one for Krypton, to prevent unneeded resync. |
I still had no time to take a closer look at your changes. |
Have you seen and addressed my comments? |
At least CTvheadend::GetPlayPosition needs still to be fixed. Will take a closer look at the rest and comment back as soon as i find some time. |
@ksooo Yes I addressed you comments about add-on capabilities and timertypes. |
What about getplayposition? |
@ksooo GetPlayPosition() is working (when on htsp v26 or up) but I'm still not sure if this is how it should be. If you could take a look :-) |
GetPlayPosition() should not return what came in with rec.iLastPlayedPosition, but obtain and return latest position stored in backend. |
Well as we are working async, rec.iLastPlayedPosition will always hold the correct value. We push an Kodi update every time the position on the backend changes. But ofc we could also use our local playposition (from m_recordings)? |
How often is this in worst case? can this cause performance problems? Not sure we actually should do this, especially as we're getting asked (GetPlayPosition) when kodi needs an update!
I think we should go for this. "Feels" better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the minor comment this looks good to me
@@ -665,14 +706,20 @@ PVR_ERROR CTvheadend::GetTimerTypes ( PVR_TIMER_TYPE types[], int *size ) | |||
|
|||
/* PVR_Timer.iPreventDuplicateEpisodes values and presentation.*/ | |||
static std::vector< std::pair<int, std::string> > deDupValues; | |||
if (deDupValues.size() == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay to remove this check? Won't this mean we may accidentally push_back
duplicates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work as we do a version check a few lines below, and htspversion = 0 the first time.
It's working for the other methods, so I guess Kodi will reject duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's better to be safe than sorry, we cannot rely on Kodi doing the "right thing". Is there a way to change this to non-static so this thing wouldn't be an issue?
I still want to do a review before we merge this. Will do as soon as I find the time. No need to rush, imo. |
@ksooo sure |
What's the use of "iLastPlayedPosition" as we have "GetPlayPosition()" ? The API is unclear about it. If we don't need "iLastPlayedPosition", the code can be simplified. |
I have not invented this API, but I guess GetPlayPosition() is there to have a lightweight method to be able to directly and quickly (and frequently?) pull the play position data for a particular recording. We only have bulk query methods otherwise and refreshing data for all recordings (GetRecordings) might be too heavyweight. iLastPlayedPosition seems to be there for setting/updating the last played position using Add|UpdateRecording which is not a bulk operation and thus fits performance-wise. |
@Glenn-1990 @ksooo would it perhaps be a good idea to separate the "Fixed" commits to a separate PR while we grind this one? |
+1 for doing separate PR for fixes and features. Makes the review easier. |
@@ -217,6 +217,8 @@ PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities) | |||
pCapabilities->bHandlesInputStream = true; | |||
pCapabilities->bHandlesDemuxing = true; | |||
pCapabilities->bSupportsRecordingEdl = true; | |||
pCapabilities->bSupportsRecordingPlayCount = tvh->GetProtocol() >= 26 ? true : false; | |||
pCapabilities->bSupportsLastPlayedPosition = tvh->GetProtocol() >= 26 ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two lines look a little bit overcomplicated. Why not just
pCapabilities->bSupportsRecordingPlayCount = (tvh->GetProtocol() >= 26); pCapabilities->bSupportsLastPlayedPosition = (tvh->GetProtocol() >= 26);
@Glenn-1990 good job, thanks. Could you please add changelog and version bump. We are ready to then, imo. |
+1 from me too if you add the change log entry etc. |
Changelog added |
@ksooo good to go? |
Yep, good to go. Does anything speak against a Krypton backport @Glenn-1990? |
@ksooo Krypton is still unreleased so everything should be backported to it IMO. |
Yep, but we need to hurry then, because we want to release Krypton really very soon, @Glenn-1990 ;-) |
@ksooo A backport would be nice, maybe someone else can do a runtime test first? Especially the play count and play position stuff. |
That's problematic, due to lack of time on my end. If we are not sure that it actually works, no backport now, please. However, ofc a Krypton PR is welcome. I will test asap. |
Under some circumstances the playposition seems to be wrong as Kodi uses "-1" for fully watched. Only affects htsp v26 and up. I'll come up with a PR, already addressed in the Krypton PR. |
Htsp v26 support.
@ksooo @Jalle19
Edit: removed WIP