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
[PVR] Echo up important Status info to Timer Rules #8732
Conversation
case PVR_TIMER_STATE_NEW: | ||
case PVR_TIMER_STATE_SCHEDULED: | ||
case PVR_TIMER_STATE_CONFLICT_OK: | ||
parentTimer->m_iActiveChildTimers ++; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@metaron-uk First of all nice work. I'm not sure about the "completed" status, in my eyes a completed timer is no timer anymore, it's a recording. You seems to depend on PVR_TIMER_STATE_COMPLETED for the completed state, but do clients use that state for repeating schedules? At least tvh will only use PVR_TIMER_STATE_SCHEDULED or PVR_TIMER_STATE_DISABLED for repeating schedules as "completed" is a bit misleading here. EDIT: @ksooo Maybe the api should define which timer states are for parents and which are for childs? |
#empty strings from id 19242 to 19243 | ||
#: xbmc/pvr/timers/PVRTimerInfoTag.cpp | ||
msgctxt "#19242" | ||
msgid "%d will record" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
My idea with using the 'Completed' status is to allow the client to indicate (if it has the information) that a rule has actually carried out a recording successfully (see https://github.com/metaron-uk/xbmc/blob/sorting/xbmc/addons/include/xbmc_pvr_types.h#L180). Mythv includes 'will next record' and 'last recorded' timestamps for each rule updated by the scheduler. When the scheduler finds a match for the rule, it updates the 'will next record' timestamp with the first match. When a recording starts, the 'last recorded' timestamp is updated. By setting rules with a 'last recorded' timestamp but no 'will next record' timestamp to 'COMPLETED', rules for which a recording was performed, state 'Completed', rules which are about to do something say 'x will record' and those which haven't done anything yet say 'Enabled'. This way you can easily spot rules which have already done something and aren't planning to do anything else within available guide data and remove/edit them if you want. If your backend cleans up after itself and deletes 'Completed' rules automatically, you'll never see this status, but if not, it helps separate 'finished' rules from 'not yet started' ones. |
Sorry, but imo using "Completed" for timer rules does not fit. As you explain it it is more "Currently nothing scheduled". "Completed" for me means that there will be never ever new timers scheduled by this rule which could only be the case if you set an end day and time for the rule. |
What about a 'Record one' rule? pvr.mythtv has these, so assuming 'one' has been recorded successfully, the rule is 'completed' without needing an end date. The definition in the API "/*!< @brief the recording completed successfully */" seems fairly clear and seems to be compatible with displaying 'Completed' in this scenario. I agree the logic I've described for setting 'Completed' status for a rule is less than perfect (especially for 'record all' rules), but IMO how best to decide if a rule is 'complete' is something for the client/backend. The other states seem to be:
New covers 'hasn't resulted in any intended recordings yet' and Scheduled covers 'is currently resulting in intended recordings'. There isn't a 'has caused recordings before, might do so again, but isn't currently planning to do so' status. The choice would appear to be 'New' , 'Completed', or changing the API to add 'Resting'. With the logic in this PR, if the client sets 'NEW' or 'SCHEDULED without any child timers the display will show 'Enabled'. If it sets 'COMPLETED' the display shows 'Completed' unless it has children currently recording. I agree allowing in-prog child recordings to over-ride 'COMPLETED' status might be considered superfluous, but it does make the code in pvr.mythv for 'Completed' easier 😉. I can take this bit out if you like. I'd be happy to raise a separate PR to add |
Rebased and squashed (the 'spare' strings were used by another merged PR). I agree my criteria for setting 'Completed' rule status was flawed (I'm pondering more valid alternatives), but I still think 'Completed' is valid for either a rule (i.e. for completed manual / once rules) or an individual timer to report. I believe if the client reports it, displaying it would be helpful and informative. I hope my '%d will record' explanation was good enough to justify not re-naming it '%d upcoming(s)' @ksooo / @xhaggi / @Glenn-1990 / others - have I convinced you, or do you have use cases which won't work with these names which I can ponder? Any opinions on adding a new 'RESTING' timer state (in a separate PR)? |
Agree to "record one" rule.
I do not see the need for this new state. "RESTING" can easily be calculated by Kodi from existing information: state == SCHEDULED && rule_has_no_children. No need for another PVR API timer state. What you want to achieve imo is just about user interface, not PVR API. UI representation of the kodi-calculated "state" could be something like "resting", but again, no need to extend API for this. |
In mythtv all 'upcoming' timers have a parent rule on the backend, even manual or 'this showing' ones. Currently pvr.mythtv client doesn't transfer oneshot 'manual' rules to kodi core for consideration unless it has an associated 'upcoming', but they could potentially still accumulate on the backend as 'completed manual rules' (I'm not 100% sure about this as I don't seem to have any languishing on my backend, maybe it deletes them). The mythtv client could be extended to transfer these rules to kodi core for housekeeping purposes. Can't get too excited about this though.
OK by me, one less API change PR :-) Let me know if anything else occurs to you. |
@@ -9553,7 +9553,15 @@ msgctxt "#19254" | |||
msgid "Guide update failed for channel" | |||
msgstr "" | |||
|
|||
#empty strings from id 19255 to 19256 | |||
#: xbmc/pvr/timers/PVRTimerInfoTag.cpp |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
45d70db
to
4c461ab
Compare
Comments incorporated. Let me know if I've missed anything. |
OK now? |
- Number of Scheduled Child Timers (including New/Conflict_OK) - Presence of Child Timers currently recording - Presence of Conflict_NOK or Error Child Timers Also adds 'Completed' status as distinct from 'Enabled'
Fingers crossed! Many thanks for the help and and the constructive criticism @ksooo. |
You're welcome and thanks for this nice improvement. |
jenkins build this please |
WIN-32 jenkins error is unrelated. |
Runtime-tested. Works like expected. |
[PVR] Echo up important Status info to Timer Rules
Also adds 'Completed' status as distinct from 'Enabled'
No sure how this will play with all existing pvr clients, but I can't see it breaking anything.
Small tweaks may need to be made to the reported status of 'Timer Rules' in each client to get it to work fully as intended. I'm hoping the logic is sound so it should just 'work'.
If a client already echos up 'Conflict / Error / Recording' status the behaviour should be unchanged.
Only a status of 'NEW' or 'SCHEDULED' and in the case of recording in prog, 'COMPLETED' will be replaced with the new information based on child timer states.
(I made some changes to pvr.mythtv to get 'COMPLETED' to work as shown which I will PR if this is accepted)
I'm a little uncomfortable about putting the child timer status reset in CPVRTimerInfoTag::UpdateEntry and the updates in CPVRTimers::UpdateEntries. Happy to move it all to CPVRTimers::UpdateEntries if there are strong opinions.
pings: @ksooo, @ryangribble, @janbar, @Jalle19