Jump to content

VDR plugin development


Tuxx

Recommended Posts

domenic

EDIT Never Mind what is below.... it does implement  "CancellationToken"

 

 

 

I think I have figured it out.... looks like the new version of the server actually implements "CancellationToken", which my version does not do.....This will take some time to resolve...

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

domenic

Update nuget and make sure it compiles

the source code for emby-server-3.1.2 has the following in its packages directory:

Emby.XmlTv.1.0.3           MediaBrowser.Common.3.0.687  Microsoft.IO.RecyclableMemoryStream.1.2.1  PropertyChanged.Fody.1.40.3  SharpCompress.0.14.0    SQLitePCLRaw.core.1.1.1
ImageMagickSharp.1.0.0.18  MediaBrowser.Common.3.0.688  Mono.Posix.4.0.0.0                         repositories.config          SimpleInjector.3.2.4    SQLitePCLRaw.provider.sqlite3.net45.1.1.1
ini-parser.2.3.0           MediaBrowser.Naming.1.0.4    NLog.4.4.0-betaV15                         ServiceStack.Text.4.5.4      SQLitePCL.pretty.1.1.0  UniversalDetector.1.0.1

A little odd that it has both MB.Comon versions 687 and 688

 

I updated nuget to the 688 version and it compiles with the same issue.

 

I have also updated to the latest version 692 and it compiles but same issue. 

 

The startup does have an issue:

Info, App, Loading VdrLiveTV, Version=1.0.6214.26289, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.Api, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.WebDashboard, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.Model, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.Common, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.Controller, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.Providers, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading Emby.Photos, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading Emby.Common.Implementations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading Emby.Server.Implementations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading Emby.Server.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.MediaEncoding, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading Emby.Dlna, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.LocalMetadata, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.XbmcMetadata, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.Server.Mono, Version=3.1.2.0, Culture=neutral, PublicKeyToken=null
Info, App, Loading MediaBrowser.IsoMounting.Linux, Version=1.0.6170.29462, Culture=neutral, PublicKeyToken=null
Info, App, Loading Emby.Server.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.
Error, App, LoaderException: Could not load file or assembly or one of its dependencies.

but how do I track down these messages, they of course only show up when my plugin is installed...

Edited by domenic
Link to comment
Share on other sites

You should not be adding all of those packages to your plugin. The only one you need is MediaBrowser.Server.Core.

 

For starters, check your plugin constructor and make sure it's not doing any work. That's always been a guideline but now it will cause problems if you are doing that. Make sure your plugin is not references any assemblies outside of the defaults and the server nuget package.

 

If the issue persists, add more logging to your plugin to see how far it's getting in trying to load.

Link to comment
Share on other sites

domenic

You should not be adding all of those packages to your plugin. The only one you need is MediaBrowser.Server.Core.

 

For starters, check your plugin constructor and make sure it's not doing any work. That's always been a guideline but now it will cause problems if you are doing that. Make sure your plugin is not references any assemblies outside of the defaults and the server nuget package.

 

If the issue persists, add more logging to your plugin to see how far it's getting in trying to load.

here is my packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="MediaBrowser.Common" version="3.0.692" targetFramework="net45" />
  <package id="MediaBrowser.Server.Core" version="3.0.692" targetFramework="net45" />
  <package id="ServiceStack.Client" version="4.5.4" targetFramework="net45" />
  <package id="ServiceStack.Interfaces" version="4.5.4" targetFramework="net45" />
  <package id="ServiceStack.Text" version="4.5.4" targetFramework="net45" />
</packages>

Note that I have to include MediaBrowser.Common as it is a dependancy of MediaBrowser.Server.Core.  The plugin uses the ServiceStack to connect to VDR and get the Channel Data

 

            baseUrl = string.Format("http://{0}:{1}", host, port);

            client = new JsonServiceClient(baseUrl);

 

I don't believe there are any other extra packages...

 

As I am not much of a programer which part of the application code is the "constructor"

 

Domenic

Link to comment
Share on other sites

domenic

So another hint then, what package does emby provide to replace ServiceStack?  in this case it is used for the JsonServiceClient....  Do you know of an existing plugin that calls a restful API?

Link to comment
Share on other sites

domenic

Well rather than rebuild, I am going to 'borrow' the NextPVR code and use it as a template...

 

It is mostly the same functionality... stay tuned

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

domenic

OK I have rebuilt based off the NextPvr code. live TV works with guide information. Have not started on timers or recordings yet.

 

Note the same issue exists, not all of the guide data is loaded.

 

When I have more time I will continue with the project.. I do need to make one change, the plugin icon in emby shows the Next PVR logo. Where is this stored so I can update it.

MediaBrowser.Plugins.VDR.dll.zip

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

Great job. As far as the logo, you need to make sure you have changed both the plugin name and the plugin guid in assemblyinfo.cs. That will remove the nextpvr logo. Then later once this goes into the catalog, then we can look at assigning it an image.

Link to comment
Share on other sites

domenic

OK, I have updated the guid to be the same as the old plugin, and I get a nice blank logo. I updated the plugin in my previous post

 

Domenic

Edited by domenic
Link to comment
Share on other sites

domenic

I think the guide collection is over welming the vdr server. What would be the best way to "sleep" for 10 seconds between my web calls?

Link to comment
Share on other sites

domenic

So looking at the logs, and dumping the data returned from VDR, it all looks good, as I see all the guide data. The inserts must not be pushed into the database. Lets assume some of the records are being rejected, can you point me to the data definition of program info. Also a document that specifies the minimum requirements for a program info record.

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

domenic

I still believe there is something a little off in Emby and the Guide data storage. Here is the test I ran. I configured one channel in VDR. Configured One Day for Guide in Emby. Setup the following test code:

        public IEnumerable<ProgramInfo> GetPrograms(Stream stream, IJsonSerializer json, string channelId, ILogger logger)
        {
            var root = json.DeserializeFromStream<RootObject>(stream);
            UtilsHelper.DebugInformation(logger,string.Format("[VDR] GetPrograms Response: {0}",json.SerializeToString(root)));
            logger.Info(string.Format("[VDR] Display Root Object: {0}", json.SerializeToString(root)));
            if (root != null && root.events != null)
            {
                return root.events.Select(epg => new ProgramInfo()
                {
                ChannelId = channelId,
                //Id = epg.id.ToString(),
                Id = "124941420000"
                //Overview = Regex.Replace(epg.description,@"\t|\n|\r", ""),
                //Overview = Regex.Replace(epg.description,@"[^A-Za-z0-9]", " "),
                Overview = "Overview",
                StartDate = ApiHelper.DateTimeFromUnixTimestampSeconds(epg.start_time).ToUniversalTime(),
                EndDate =  ApiHelper.DateTimeFromUnixTimestampSeconds(epg.start_time).ToUniversalTime().AddSeconds(epg.duration),
                //Genres = new List<string>(),
                Genres = new List<string>(new string[] {"sports", "movie"}),
                //OriginalAirDate = parse infom from Description
                //OriginalAirDate = null,
                OriginalAirDate = DateTime.UtcNow,
                //Name = Regex.Replace(epg.title,@"[^A-Za-z0-9]"," "),
                Name = "Name",
                //OfficialRating = parse infom from Description
                //OfficialRating = null,
                OfficialRating = "G",
                //CommunityRating = null, // not provided
                CommunityRating = 10,
                //EpisodeTitle = epg.short_text,
                EpisodeTitle = "EpisodeTitle",
                Audio = ParseAudio(epg.description),
                IsHD = false, // not provided default to false
                IsRepeat = false,
                IsSeries = epg.description.Contains("series", StringComparison.OrdinalIgnoreCase),
                HasImage = (epg.images > 0),
                ImageUrl = (epg.images > 0) ?  (_baseUrl + "/events/image/1/" + epg.id.ToString(_usCulture)) : null,
                IsNews = epg.description.Contains("news", StringComparison.OrdinalIgnoreCase),
                IsMovie = epg.description.Contains("movie", StringComparison.OrdinalIgnoreCase),
                IsKids = epg.description.Contains("kids", StringComparison.OrdinalIgnoreCase),

                IsSports = epg.description.Contains("sports", StringComparison.OrdinalIgnoreCase) ||
                    epg.description.Contains("Sports non-event", StringComparison.OrdinalIgnoreCase) ||
                    epg.description.Contains("Sports event", StringComparison.OrdinalIgnoreCase) ||
                    epg.description.Contains("Sports talk", StringComparison.OrdinalIgnoreCase) ||
                    epg.description.Contains("Sports news", StringComparison.OrdinalIgnoreCase)
                });
              }
                return new List<ProgramInfo>();
            }

Note I am hard coding most of the variables - the exceptions are ChannelId, StartDate, and EndDate. The result should be a fully populated Guide of one channel with the same program. Which I see. When I select the channel I get the screen shot attached. It appears sometimes I get Name and sometimes I get Name - EpisodeTitle but all of the entries should be identical, with the hardcoded values Name - EpisodeTitle.

Any idea based on the code why some of the data would be dropped?

post-37739-0-26033600-1484677972_thumb.png

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

Try refreshing the guide data. also you just edited your post and now the code is all on one line and hard to read.

  • Like 1
Link to comment
Share on other sites

domenic

Try refreshing the guide data. also you just edited your post and now the code is all on one line and hard to read.

That is with the updated Guide Data....(code replaced)

  • Like 1
Link to comment
Share on other sites

domenic

Ok, thanks, I have added all the channels back and have some missing data..... Attached is the raw data from the log file (logger.Info(string.Format("[VDR] Display Root Object: {0}", json.SerializeToString(root)));

 

My data for this channel does not show up until 3:00 PM CST, the rest is dropped.

data.txt

post-37739-0-48254800-1484679732_thumb.png

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

domenic

There are 3 missing entries:   Look for Start times before Unix Time Stamp 1484686800.

 

is it possible to access this data with the API and a curl call?

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

domenic

The only oditity I see with the data is the non printable chars /n and /r that is in the description data but it does exist in every description.

 

If it helps I could tar some/all of the filesystem data (emby data) and share it for you to review?

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