Jump to content

New plugin for NextPVR


Recommended Posts

emveepee

Unfortunately sub does not want to provide the field with the zap2it id via his api.  Can I provide a custom provider,  could I provide just the series name as the ID if the data has season/episode information?  I understand for some shows with new casts and years or different countries (Shameless, Love Island) it will be a small issue.

 

Martin

Link to post
Share on other sites

When i tried to match by name before, there was enough troubleshooting related to incorrect that i had to remove it to make it go away. some from our very own @@arrbee99 if i recall.

 

So i don't want to go back to that, however, in theory, you could do something like this.

 

Give it some proprietary provider id value, 

program.SeriesProviderIds["nextPvrSeriesId"] = id; 

Make sure this is some kind of id-like value, and not a name. if you want to base it on the name, then hash it first.

 

Then you could write a series provider and attach the same to the series object in their library:

using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Providers;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Serialization;

namespace NextPvr
{	public class NextPvrSeriesProvider : IRemoteMetadataProvider<Series, SeriesInfo>
    {
        public NextPvrSeriesProvider()
        {
            
        }

        public async Task<IEnumerable<RemoteSearchResult>> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken)
        {
            return Array.Empty<RemoteSearchResult>();
        }

        public async Task<MetadataResult<Series>> GetMetadata(SeriesInfo itemId, CancellationToken cancellationToken)
        {
            var result = new MetadataResult<Series>();

            result.Item = new Series();
            result.HasMetadata = true;
			
			result.Item.ProviderIds["nextPvrSeriesId"] = id; 

            return result;
        }

        public string Name
        {
            get { return "Next PVR Series"; }
        }

        public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
        {
            throw new NotImplementedException();
        }
    }
}

I just whipped that up, it might not compile.

Link to post
Share on other sites

The only thing with that approach is the user will have to enable the series provider in their library settings.

Link to post
Share on other sites
arrbee99

Could someone possibly briefly explain the object of the exercise, preferably using really small words ? Doesn't NPVR provide info and art about programs which you access at the moment, or is this something completely different ?

Link to post
Share on other sites

I personally wouldn't do the series provider though. Users will have to enable it, then refresh metadata on series. It will be somewhat manual.

 

If you don't want to provide zap2it, why not provide the moviedb or tvdb id's instead? Doesn't next pvr do lookups with them?

Link to post
Share on other sites
emveepee

@@arrbee99 the reason I want to do this is for users who have rich guide data (unfortunately not you) to be able to view upcoming shows in a series.  I haven't seen it but I use this feature on the zap2it website.

 

@@Luke, sub doesn't store the standard id's, only the zap2it ID would be possible for SD or zap2xml users.  The NextPVR  storage key for metadata is the title once there's a hit that is what is retrieved.  It can be changed by the user if the autodetection was off.   Unfortunately there is no way to retrieve image by this key since it is more persistent then the episode id for guide data art.

 

Martin

Edited by emveepee
Link to post
Share on other sites
  • 3 months later...

I just upgraded to 4.3.0.19 beta to see how the season/episode handling is for NextPVR recordings and now there are two issues.

 

1.  Under NextPVR Recordings there seems to be just a season folder page with no links to the individual files

 

2.  Under Recordings  recordings are still linked by just season/episode  as duplicates.

 

What is the proper way to tell Emby about external PVR recordings.

 

I believe the relevant code is

 

 

            var series = allRecordings
                .Where(i => i.IsSeries)
                .OrderBy(i =>i.StartDate)
                .ToLookup(i => i.Name, StringComparer.OrdinalIgnoreCase);

            result.Items.AddRange(series.OrderBy(i => i.Key).Select(i => new ChannelItemInfo
            {
                Name = i.Key,
                SeriesName = i.Key,
                FolderType = ChannelFolderType.Container,
                Id = "series_" + i.Key.GetMD5().ToString("N"),
                Type = ChannelItemType.Folder,
                DateCreated = i.Last().StartDate,
                ImageUrl = i.Last().ImageUrl.Replace("&landscape=true", "")
            }));

 

and

 

 

private ChannelItemInfo ConvertToChannelItem(MyRecordingInfo item)
        {
            var path = string.IsNullOrEmpty(item.Path) ? item.Url : item.Path;
            System.Diagnostics.Debug.WriteLine(item.Name + " " + item.Id);
            if (item.Status == RecordingStatus.New )
                System.Diagnostics.Debug.WriteLine(item.Name + " " + item.Id);

            //string itemEpisodeTitle = string.Format("S{0}:E{1} {2}", item.SeasonNumber, item.EpisodeNumber, item.EpisodeTitle);
      
            var channelItem = new ChannelItemInfo
            {
                Name = string.IsNullOrEmpty(item.EpisodeTitle) ? item.Name : item.EpisodeTitle,
                SeriesName = !string.IsNullOrEmpty(item.EpisodeTitle) || item.IsSeries ? item.Name : null,
                OfficialRating = item.OfficialRating,
                CommunityRating = item.CommunityRating,
                ContentType = item.IsMovie ? ChannelMediaContentType.Movie : (item.IsSeries ? ChannelMediaContentType.Episode : ChannelMediaContentType.Clip),
                Genres = item.Genres,
                ImageUrl = item.ImageUrl,
                Id = item.Id,
                ParentIndexNumber = item.SeasonNumber,
                IndexNumber = item.EpisodeNumber,
                MediaType = _radioChannels.ContainsKey(item.ChannelId) ? ChannelMediaType.Audio : ChannelMediaType.Video,
                MediaSources = item.Status == RecordingStatus.New ? null: new List<MediaSourceInfo>
                {
                    new MediaSourceInfo
                    {
                        Path = path,
                        Protocol = path.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? MediaProtocol.Http : MediaProtocol.File,
                        Id = item.Id,
                        IsInfiniteStream = item.Status == RecordingStatus.InProgress ? true : false,
                        RunTimeTicks = (item.EndDate - item.StartDate).Ticks,
                    }
                },
                PremiereDate = item.OriginalAirDate,
                ProductionYear = item.ProductionYear,
                Type = ChannelItemType.Media,
                DateCreated = item.StartDate,
                DateModified = item.DateLastUpdated,
                Overview = item.Overview,
                IsLiveStream = item.Status == MediaBrowser.Model.LiveTv.RecordingStatus.InProgress,
                Etag = item.Status.ToString()
            };
            System.Diagnostics.Debug.WriteLine(channelItem.SeriesName.GetMD5().ToString("N") + " " + channelItem.Name);
            return channelItem;
        }
 

 

Martin

Link to post
Share on other sites

I just checked the DVBViewer code and it is slightly different from the MP code sinse it creates _season_ folders.  Is this something that NextPVR should implement?

 

Martin

Edited by emveepee
Link to post
Share on other sites

I saw your post, which is why I am asking if the logic says I need to create the _season_ folder even if the implementation is broken.

 

Martin

Link to post
Share on other sites
pünktchen

Sometimes i think there isn't any logic or even Luke doesn't know about it. It's up to you if you want season folders. But you have to set them as "plain" folders not "season" folders because of the broken implementation.

 

For my personal use and because of the many bugs in Emby i've created a flat hierarchy with numbers in the episode title.

Link to post
Share on other sites

In the current implementation under NextPVR Recordings I just get series meta data, no files, and under the general recordings they are merged by season/episode I don't care about creating series folders.  I just need to implement something that works and without source code or documentation I need better guidance on the best way to achieve this that actually works.

 

Martin

Link to post
Share on other sites

yea I apologize but I've just never gone through implementing this with channel plugins. The existing next pvr plugin just sends back a flat list of recordings, and I realize it's not as feature rich, but it does work and allow you to play your recordings. I will look at supporting these more complex structures when I can.

 

@@Luke Does that mean I should not be setting the series and episode number?

 

Martin

Link to post
Share on other sites
  • 1 month later...

Where does the Premiered date show for EPG entries?  The table does have the DateTimeOffset stored.

 

Martin

Edited by emveepee
Link to post
Share on other sites

Doesn't seem to be there

 

 

5df5567064f9f_details.jpg

{

"Name": "The Big Bang Theory",
"ServerId": "1265f3018714434585f75b26baa38064",
"Id": "442588",
"Etag": "2f3b2c043838862ad79057ba23262df7",
"DateCreated": "2019-12-14T21:19:43.0000000+00:00",
"CanDelete": false,
"CanDownload": false,
"SortName": "big bang theory intimacy acceleration",
"PremiereDate": "2015-02-26T00:00:00.0000000+00:00",
"ExternalUrls": [ ],
"OfficialRating": "PG",
"ChannelId": "161509",
"ChannelName": "TDCC",
"Overview": "Penny and Sheldon design an experiment -- as a joke -- to make participants fall in love; Howard and Bernadette get into trouble at the airport.",
"Taglines": [ ],
"Genres": [

"Sitcom"

],
"RunTimeTicks": 18000000000,
"ChannelNumber": "42",
"IndexNumber": 16,
"ParentIndexNumber": 8,
"RemoteTrailers": [ ],
"ProviderIds": { },
"ParentId": "161509",
"Type": "Program",
"Studios": [ ],
"GenreItems": [

{

"Name": "Sitcom",
"Id": 161410

}

],
"TagItems": [

{

"Name": "Repeat",
"Id": 161669

},
{

"Name": "Series",
"Id": 161670

}

],
"DisplayPreferencesId": "8cab5e5f60ae4830c47f6431bbe4c3cb",
"Tags": [ ],
"PrimaryImageAspectRatio": 0.6666666666666666,
"SeasonName": "Season 8",
"ImageTags": {

"Primary": "581df0dca5d81e9fb2acb309b4e2c522"

},
"BackdropImageTags": [ ],
"MediaType": "Video",
"EndDate": "2019-12-16T00:00:00.0000000+00:00",
"LockedFields": [ ],
"LockData": false,
"ChannelPrimaryImageTag": "2519554a842de49e7c43ac15be031edd",
"StartDate": "2019-12-15T23:30:00.0000000+00:00",
"IsRepeat": true,
"EpisodeTitle": "The Intimacy Acceleration",
"IsSeries": true

}

Martin

Edited by emveepee
Link to post
Share on other sites

I just configured the Emby Live TV option and it doesn't show the original air date either.  Looking at library.db the type 27 recording doesn't even populate the PremiereDate field.

 

My main question is to confirm that the DateTimeOffset is UTC  Schedules Direct delivers them in Local Time so I though Emby might not want them converted.

 

Martin

Link to post
Share on other sites

Sorry it is not there in Emby Live TV EPG and since it not even populated in the database for Emby  I also don't get the Season heading in the guide for either source.

 

Martin

Link to post
Share on other sites

In the popup displayed when clicking a program cell, yes i can confirm some data is missing there. I'll look at that.

 

But if you go to the suggestions tab and click into the full detail screen, both of those pieces of info will be there.

Link to post
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...