Jump to content

How to build the EMBY EPG using JS


VicMoore

Recommended Posts

VicMoore

 

@pünktchenperhaps it would be better if I ask specific questions. I noticed that you add virtualTV as a live tv host using the endpoint /LiveTv/TunerHosts  (POST). 

Response body
Download
[
  {
    "Id": "aade3b8dd2814d7b8b376cc7f008a486",
    "Type": "VirtualTVTuner",
    "FriendlyName": "VirtualTV",
    "SetupUrl": "configurationpage?name=virtualtvtuner",
    "ImportFavoritesOnly": false,
    "AllowHWTranscoding": true,
    "TunerCount": 0,
    "DataVersion": 0
  }
]

1) is the Id in the body above, the GUID from the virtualTV plugin or is it something else? Please explain this field.

2) Is it correct that the SetUp URL is from your plugin.cs file, more specifically it is the name you gave to one of your configuration pages in plugin.cs. I assume this URL gets called when the EPG is displayed.  Could you explain this parameter in more detail?

3) Is the URL in the body of your original POST request (to add virtualTv as a tuner host), the URL for the virtualTV plugin?  If so, what URL did you provide? If not, then what is it?

4) I assume that when you become a tuner host, you must implement some interfaces. It this is true, what are these interfaces?

5) once you are a live tv host how do you use that position to program the EPG?

The answers to these questions will start me on the path to programming the EPG.  

 

Thanks for your help, Vic

 

Link to comment
Share on other sites

pünktchen
1 hour ago, VicMoore said:

I don't know how to write data to this EPG.

I already gave you the answer: POST to livetv/programs

image.png.27d7b0ba7aa54198f3ca94d41e67319c.png

That's all you really need!

Link to comment
Share on other sites

VicMoore

Thanks @pünktchen I appreciate your help and apologize for not understanding your answer quicker. I will try this POST and let you know how it goes.  

Vic

Edited by VicMoore
Link to comment
Share on other sites

VicMoore

@pünktchenI just tried a POST to "/LiveTv/Programs" and it worked the same as a GET to that same endpoint. I used the same body for the POST that the GET returned, except I changed some of the entries.  After the POST, when I fetched the channels again, nothing changed.  I used Swagger for the test.  Am I missing something? What should be in the body of the POST?

Could you send me a code sample?

Vic

Edited by VicMoore
Link to comment
Share on other sites

pünktchen
9 minutes ago, VicMoore said:

Could you send me a code sample?

No, because i only have C# code. I don't use the Rest API. We have to ask @Lukeabout post to livetv/program then.

Link to comment
Share on other sites

VicMoore

@LukeI am trying to write to the Emby EPG using the REST API.  @pünktchensaid a POST to the endpoint "/LiveTv/Programs" would write the body of the POST to the EPG.  I tried this and it just returned the EPG programs.  The quote from @pünktchenis given below.


image.png.27d7b0ba7aa54198f3ca94d41e67319c.png
 

@Lukeis this how you write to the EPG?  If not, then how is it done?  I know you are busy, and I am sorry to trouble you with my questions.

Vic

Link to comment
Share on other sites

28 minutes ago, VicMoore said:

@LukeI am trying to write to the Emby EPG using the REST API.  @pünktchensaid a POST to the endpoint "/LiveTv/Programs" would write the body of the POST to the EPG.  I tried this and it just returned the EPG programs.  The quote from @pünktchenis given below.


image.png.318cd5fb4e21b3cdc3a74e38151f9380.png

@Lukeis this how you write to the EPG?  If not, then how is it done?  I know you are busy, and I am sorry to trouble you with my questions.

Vic

 

I'm afraid, there is no way to write programs to the database like this.

The documentation text is not wrong, it is correct.

Both request methods are doing the same in this case (POST and GET).

  • Like 1
  • Facepalm 1
Link to comment
Share on other sites

VicMoore

Thanks @softworkz, I went and looked at "Emby/MediaBrowser.Api/LiveTv/LiveTvService.cs" and found the same thing. Both routes are the same

    [Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]


 @softworkz you have helped me many times in the past, and I am very grateful.  Can you point me in the right direction for creating and editing the Emby EPG?

Vic

 

Link to comment
Share on other sites

12 minutes ago, VicMoore said:

Thanks @softworkz, I went and looked at "Emby/MediaBrowser.Api/LiveTv/LiveTvService.cs" and found the same thing. Both routes are the same

    [Route("/LiveTv/Programs", "GET,POST", Summary = "Gets available live tv epgs..")]


 @softworkz you have helped me many times in the past, and I am very grateful.  Can you point me in the right direction for creating and editing the Emby EPG?

I'm afraid, I can't answer this as I'm not familiar with the old live tv implementation.

I could only explain how it works in TVnext - but that doesn't help you much right now 😞 

 

Link to comment
Share on other sites

VicMoore

@softworkzyou are very kind. I appreciate the direct answer.  Out of curiosity, what is TVnext? 

Vic

Link to comment
Share on other sites

VicMoore

@softworkzyou are doing some amazing work.  If I can help in any way just let me know, I work free 🙂  No matter what, I appreciate your friendship.

Vic

Edited by VicMoore
  • Like 1
Link to comment
Share on other sites

Just now, VicMoore said:

@softworkzyou are doing some amazing work.  If I can help in any way just let me know, I work free 🙂  No matter what I appreciate your friendship.

Thanks for the kind words - you are very welcome!

Regarding help - yes hopefully soon. The project is still on hold pending a beta test phase with a larger audience and I hope we'll get to it very soon.

  • Like 1
Link to comment
Share on other sites

BillOatman

@VicMoore I suspect what you need is the DB schema so you can go at the DB directly.  Not sure how anxious team emby would be to have people doing that :)

Link to comment
Share on other sites

11 minutes ago, BillOatman said:

@VicMoore I suspect what you need is the DB schema so you can go at the DB directly.  Not sure how anxious team emby would be to have people doing that :)

It's not about anxiety - it's just not an acceptable way of interaction. 

The fact that a database exists, doesn't mean that it can be used and accessed externally. The way how Emby interacts with the database is not made for sharing data between multiple consumers. It expects the data being shaped and stored in certain ways you cannot know about and which can change from version to version.

Emby is an application server where the database is just an (internal) implementation detail. Other architectures exist where this is different and the database is an instance of its own and direct database access is a valid and supported pattern for interfacing.
But in case of Emby, the DB is an internal component only.

Link to comment
Share on other sites

VicMoore

@LukeI am skilled in C# and JS.  Can you give me a pointer to a person, code interface, documentation, or code that will prophet my search for information on how to create a new Row in the Emby embedded EPG ?  

Vic

Link to comment
Share on other sites

VicMoore

Thanks @softworkzfor the clarification.  I promise that I will not access the DB directly. Do you know anyone that can help me understand how to create a row in the Emby EPG?   @BillOatmanI appreciate your suggestion. Your heart was in the right place. Perhaps there is a way to get to the EPG indirectly.

Vic

Link to comment
Share on other sites

Well - a row in the EPG represents a channel, so when you want to add a row, you need to add a channel.

A channel can only come from a Tuner Provider - which would also be responsible for injecting the content of the channel.

Let's start from a different angle - what do you want to achieve eventually?

Link to comment
Share on other sites

VicMoore

@Lukeand @softworkz the ApiClient supports the following two methods.  Can you point me to someone that can tell me how these methods work.  I am very experienced in using the ApiClient. I don't need much help.

Vic

 

function modifyEpgRow(result) {

    result.Type = 'EpgChannel';
    result.ServerId = this.serverId();
}

function modifyEpgResponse(result) {

    result.Items.forEach(modifyEpgRow.bind(this));

    return result;
}

 

Link to comment
Share on other sites

VicMoore

@softworkzthanks for the creative thought.  My goal is to build an EPG that Emby clients can use to select Emby library content to play.  I am very familiar with the content in the current EPG for both channels from VirtualTV and IPTV sources.  I also know that virtualTV registers itself as a TV Host.  So I suspect that the levers to manipulate the EPG are in one or more interfaces that a TV host implements.  I just don't know which ones.  I also noticed the following two methods in the ApiClient. I need some one to give me an example of how to use these methods.

Vic

function modifyEpgRow(result) {

    result.Type = 'EpgChannel';
    result.ServerId = this.serverId();
}

function modifyEpgResponse(result) {

    result.Items.forEach(modifyEpgRow.bind(this));

    return result;
}

Link to comment
Share on other sites

1 hour ago, VicMoore said:

My goal is to build an EPG that Emby clients can use to select Emby library content to play. 

To be honest, I don't understand the concept. Neither did when I came to know the virtual tv plugin initially nor now. 

Why show things in a timeline which aren't bound to that time line in any way? You scroll through a channel and then you say, "ok, now I will watch a video what would be broadcast on this channel in the afternoon of the day after tomorrow, if it would be a real tv channel. But since it's not a real tv channel all the shown time values are completely irrelevant because I can watch it whenever I want anyway..

My brain cannot compute this, but I acknowledge that it is liked by many. Yet I'm wondering whether it's essentially the time line ordering that matters for people or whether it's rather about the layout and presentation why people like it.

Edited by softworkz
  • Haha 1
Link to comment
Share on other sites

pünktchen
1 hour ago, softworkz said:

Well - a row in the EPG represents a channel, so when you want to add a row, you need to add a channel.

A channel can only come from a Tuner Provider - which would also be responsible for injecting the content of the channel.

What about a guide data provider plugin? There are the xmltv and Emby guide data plugins, so it must be possible without creating a tuner source provider!

Link to comment
Share on other sites

1 minute ago, pünktchen said:

What about a guide data provider plugin? There are the xmltv and Emby guide data plugins, so it must be possible without creating a tuner source provider!

TVnext has public interfaces for EPG data providers, in case of legacy TV I know that there has never been a public API for guide providers. You are right: the providers were moved into plugins and so there must be an API. I could look up the code, but what I won't find there is whether the intention has changed (allowing plugin EPG providers). It's something for Luke  to answer..

Link to comment
Share on other sites

7 minutes ago, pünktchen said:

it must be possible without creating a tuner source provider!

If there was, I probably don't wanna know... 

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...