VicMoore 566 Posted November 17, 2023 Author Share Posted November 17, 2023 @LukeI am making great progress on the virtualTvExample GUI. I am now trying to transfer the channel info to the tuner. When the virtualTvExample.js code is started the "return function (view, params) {" is invoked and I get "view" and "params". I don't understand how "params" gets set. I do understand that "params.Id" is the id of the tuner and it is used to get the tuner configuration. For me the "params" is always undefined. Is there an easy way to get the tuner id? My goal is to send and receive info between the JS GUI and the respective tuner. In the virtualTvExample code this is done via "getTunerHostConfiguration(params.id).then(function (info) {" but you need to know "params.Id" and its "undefined" Vic Link to comment Share on other sites More sharing options...
Luke 37155 Posted November 17, 2023 Share Posted November 17, 2023 3 hours ago, VicMoore said: @LukeI am making great progress on the virtualTvExample GUI. I am now trying to transfer the channel info to the tuner. When the virtualTvExample.js code is started the "return function (view, params) {" is invoked and I get "view" and "params". I don't understand how "params" gets set. I do understand that "params.Id" is the id of the tuner and it is used to get the tuner configuration. For me the "params" is always undefined. Is there an easy way to get the tuner id? My goal is to send and receive info between the JS GUI and the respective tuner. In the virtualTvExample code this is done via "getTunerHostConfiguration(params.id).then(function (info) {" but you need to know "params.Id" and its "undefined" Vic It gets passed in by the core web app. Those are the query string params for your view. You probably won’t need them. Link to comment Share on other sites More sharing options...
VicMoore 566 Posted November 20, 2023 Author Share Posted November 20, 2023 @Lukethe gui for VirtualTvExample is finished and I am now working on the rules engine. I have one question. When I send channel data to the tuner using info.ProviderOptions = JSON.stringify(providerOptions); // // save tuner data // ApiClient.saveTunerHostConfiguration(info).then(function (result) { console.log("===== result1 = ", result); }, function (result) { console.log("===== result2 = ", result); }); a new tuner get created. The emby log is attached below. How do I keep this from happening? Vic P.S. I need to mention that when virtualTVExample (I call it embyTV) first loads it runs ApiClient.getDefaultTunerHostConfiguration('virtualtvexample').then(function (info) { masterInfo_Object = info; }); to get the info object; Whenever I use ApiClient.getDefaultTunerHostConfiguration('virtualtvexample').then(function (info) { } 'info' is returned as undefined. embyserver (2).txt Link to comment Share on other sites More sharing options...
Luke 37155 Posted November 20, 2023 Share Posted November 20, 2023 Did you compare to the example? Link to comment Share on other sites More sharing options...
VicMoore 566 Posted November 20, 2023 Author Share Posted November 20, 2023 I am using the sample code. I only added Logger statements to learn how the code works. Vic Link to comment Share on other sites More sharing options...
Luke 37155 Posted November 20, 2023 Share Posted November 20, 2023 What you need to do is save to create a new one, then click on the existing record in live tv setup to edit. Link to comment Share on other sites More sharing options...
VicMoore 566 Posted November 20, 2023 Author Share Posted November 20, 2023 I pressed save and it caused a new tuner to be added to liveTV (I don't know what was triggered to cause this to happen). On the new tuner in liveTV I clicked edit. This action brought me back to the virtualTvExample gui. If I save again, then another tuner is created. What in the virtualTvExample code signals the LiveTV code to make another tuner? Vic Link to comment Share on other sites More sharing options...
VicMoore 566 Posted November 21, 2023 Author Share Posted November 21, 2023 (edited) @LukeOK, after much study, I figured it out. The method "ApiClient.saveTunerHostConfiguration(info)" creates the TvTuner and that is what its supposed to do. I have that working now in the code. The nut I have yet to crack is how to transfer the channel data from my javascript code to the c# code, so I can set up the channels and assign programs to them. There must be a simple way to do this. So, I am back to studying Luke, thank you so much for your help. Your pointers have kept me going in the right direction. Vic Edited November 21, 2023 by VicMoore Link to comment Share on other sites More sharing options...
Luke 37155 Posted November 21, 2023 Share Posted November 21, 2023 54 minutes ago, VicMoore said: @LukeOK, after much study, I figured it out. The method "ApiClient.saveTunerHostConfiguration(info)" creates the TvTuner and that is what its supposed to do. I have that working now in the code. The nut I have yet to crack is how to transfer the channel data from my javascript code to the c# code, so I can set up the channels and assign programs to them. There must be a simple way to do this. So, I am back to studying Luke, thank you so much for your help. Your pointers have kept me going in the right direction. Vic https://github.com/MediaBrowser/Tvheadend/blob/master/TVHeadEnd/LiveTvService.cs#L68C45-L68C69 Link to comment Share on other sites More sharing options...
VicMoore 566 Posted November 22, 2023 Author Share Posted November 22, 2023 @LukeThank you for the pointer. I have spent hours reading through the code and have enjoyed every moment. I have learned a lot. In both the tvHeadend and virtualTvExample the "ApiClient.saveTunerHostConfiguration(info)" is called only once to create and setup the tuner. Thereafter, getting new EPG data is triggered only via the "Refresh Guide" in "Scheduled Tasks." In my revised "virtualTvExample code that works just fine. I am changing the code to receive an object from the JS GUI, and within that obj is an array that has the media information for the EPG. To do this, I cannot use "ApiClient.saveTunerHostConfiguration(info)" just to update the "ProviderOptions", because it will create another tuner. By the way, I did notice that you added var options = GetProviderOptions<ProviderTunerOptions>(tuner); in the C# code in all of the places where it might be needed. What neither code example has is a way in the JS to update and add data to the "ProviderOptions" within the C# code. The ApiClient documentation that I have does not include "saveTunerHostConfiguration(info)" or any other tuner related methods. So I could be missing how to apply options to prevent new tuners from being created. I will continue to study. Vic Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now