Jump to content

How to trigger RecordingStatusChanged event


pünktchen

Recommended Posts

pünktchen

Yes, in theory. But i don't want to use a http stream but a file, because that's the only way a user can seek within the inprogress recording.

It isn't funny if one has set a recording pre padding of 5 minutes or more and you always have to watch all the commercials before the show  -_-

  • Like 1
Link to comment
Share on other sites

Spaceboy

ok, from my perspective using the latest plugin is actually a little worse. its certainly not better

 

Previously the stream would always end when the file stops growing, not when it gets to the point where it was when playback started.

 

now, it still continues past the file size it was when playback started but it ends before the end of the recording, the time it ends is more random though so its more difficult to predict. i can't see a link now though

Link to comment
Share on other sites

Spaceboy

If there is nothing, it might be cheaper to have the plugin poll the tv server every 60 seconds and trigger the event if needed, then we can cache for long periods of time and react to change quicker....as opposed to the current 5 minute cache.

I'd like to emphasise that whatever is going on its taking far longer than 5 mins, I'm looking at a program that finished over an hour and ten minutes ago and it's still not direct playable because the length hasn't been detected. This is at the extreme of what I see but 30 mins plus is regular
Link to comment
Share on other sites

pünktchen

@@Luke back to your suggestion... What would be the next step if i poll the backend for timer or recording changes?

You've talked about creating a custom event trigger so that only timer or recording data is refreshed. Some tips how to do this?

Link to comment
Share on other sites

pünktchen

@@Spaceboy What version of the Emby Server do you have? Stable, beta or dev? This is really important, so i can give you some "dll's" to test!

Link to comment
Share on other sites

Spaceboy

@@Spaceboy What version of the Emby Server do you have? Stable, beta or dev? This is really important, so i can give you some "dll's" to test!

Hi puncktchen I'm on the beta server. Cheers!
Link to comment
Share on other sites

  • 2 weeks later...
Spaceboy

any further thoughts on this? i thought it was improving but i am sitting here 50mins + since a recording finished, waiting for it to be properly detected so it can be direct played

Link to comment
Share on other sites

pünktchen

@@Luke back to your suggestion... What would be the next step if i poll the backend for timer or recording changes?

You've talked about creating a custom event trigger so that only timer or recording data is refreshed. Some tips how to do this?

@@Luke
Link to comment
Share on other sites

What I would do is create a scheduled task, so you need a class that implements IScheduledTask. I can then show you how to hide it from the scheduled tasks config screen. Then configure the class with an interval trigger to run every 5 minutes. When a recording is active you could even run it every 30 seconds, but scheduled tasks don't have a way to let you adjust that on the fly.

 

Anyhow, you'll get some data back from the tv server, compare it to data you had before, and if something has changed you can trigger the RecordingStatusChanged event.

Link to comment
Share on other sites

pünktchen

Didn't you say that the RecordingStatusChanged event triggers a full guide refresh? That would really overshoot the target of refreshing recordings. Also is there an other plugin that uses events, because this is completely new for me!?

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

try something like

if (RecordingDataChanged != null) {
RecordingDataChanged(this, EventArgs.Empty);
}
Link to comment
Share on other sites

pünktchen

With "EventArgs.Empty" i get an error "cannot convert from 'System.EventArgs' to 'MediaBrowser.Controller.LiveTv.RecordingStatusChangedEventArgs'"?!

 

So i've tried something other (don't know what i'm doing):

        public void CheckRecordingStatus(CancellationToken cancellationToken)
        {
            int currentActiveRecordings = Plugin.TvProxy.GetActiveCards(cancellationToken).Count(c => c.IsRecording);

            if (currentActiveRecordings != lastActiveRecordings && currentActiveRecordings > 0)
            {
                RecordingStatusChangedEventArgs args = new RecordingStatusChangedEventArgs();

                args.NewStatus = RecordingStatus.New;
                args.RecordingId = "123";

                RecordingStatusChanged(this, args);
            }

            lastActiveRecordings = currentActiveRecordings;
        }

        public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged; 

But now i get a System.NullReferenceException right at "RecordingStatusChanged(this, args)"

Link to comment
Share on other sites

that code looks good, but just make sure to always check RecordingStatusChanged for null.

Link to comment
Share on other sites

The only thing it does in the core is reset a value so that the next time the UI requests recordings, they are refreshed from the back end. Can you confirm that? thanks.

Link to comment
Share on other sites

pünktchen

Aah, that's interesting! Will check this later. If it's working, than only one question is left: How to hide the task?

Link to comment
Share on other sites

  • 2 weeks later...
pünktchen

Sorry!!! It took longer than expected, but here's something:

I've created two hidden tasks. One of these is always enabled and checks every minute if the number of recordings has changed. If yes, then RecordingStatusChanged event is triggered

and hopefully your recordings get refreshed with mediainfo.

The other task is only enabled if you have enabled "caching of timers" in the advanced plugin settings. This task runs every 15 minutes to refresh and cache all timers. I've completely overhauled the caching

and you should see great performance improvements in every screen, especially if you have lots of schedules.

Also there's a new setting in the program options of the plugin to use channel logos as program images.

At least there's a new setting in the recording options that i could not test that much because the Android TV app shows some strange values when trying to seek.

 

And of course the attached version has some fixes for bugs that nobody ever noticed  :o

 

Please test all aspects of the plugin. Playback of tv, finished and inprogress recordings. Timer creation, modification and deletion. Just everything  :lol:

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...