Ejemplo n.º 1
0
 public static void FillInfo(this Video m, HistoryInfo info)
 {
     if (info != null)
     {
         if (info.Key != null)
         {
             m.Key = Proxyfy(info);
         }
         if (info.ParentKey != null)
         {
             m.ParentKey = PlexHelper.PlexProxy(info.ParentKey);
         }
         if (info.GrandParentKey != null)
         {
             m.GrandparentKey = PlexHelper.PlexProxy(info.GrandParentKey);
         }
         m.Title            = info.Title ?? "";
         m.ParentTitle      = info.ParentTitle ?? "";
         m.GrandparentTitle = info.GrandParentTitle ?? "";
         m.Title1           = info.GrandParentTitle;
         m.Title2           = info.ParentTitle;
         m.Art              = info.Art;
         m.ParentArt        = info.ParentArt;
         m.GrandparentArt   = info.GrandParentArt;
         m.Thumb            = info.Thumb;
         m.ParentThumb      = info.ParentThumb;
         m.GrandparentThumb = info.GrandParentThumb;
     }
 }
Ejemplo n.º 2
0
 public static string GenArt(this Contract_AniDB_Anime_DefaultImage im)
 {
     if (im == null)
     {
         return(null);
     }
     return(PlexHelper.ConstructImageLink((int)im.ImageType, im.AnimeID));
 }
Ejemplo n.º 3
0
 public static string GenPoster(this Contract_AniDB_Anime_DefaultImage im, string fallbackimage = "plex_404V.png")
 {
     if ((im == null) || (im.AnimeID == 0))
     {
         return(PlexHelper.ConstructSupportImageLink(fallbackimage));
     }
     return(PlexHelper.ConstructThumbLink((int)im.ImageType, im.AnimeID));
 }
Ejemplo n.º 4
0
 public static string GenPoster(this MetroContract_Anime_Episode im, string fallbackimage = "plex_404.png")
 {
     if ((im == null) || (im.ImageID == 0))
     {
         return(PlexHelper.ConstructSupportImageLinkTV(fallbackimage));
     }
     return(PlexHelper.ConstructThumbLink((int)im.ImageType, im.ImageID));
 }
Ejemplo n.º 5
0
 public static string GenArt(this ImageDetails im)
 {
     if (im == null)
     {
         return(null);
     }
     return(PlexHelper.ConstructImageLink((int)im.ImageType, im.ImageID));
 }
Ejemplo n.º 6
0
 public static string GenPoster(this ImageDetails im, string fallbackimage = "plex_404V.png")
 {
     if ((im == null) || (im.ImageID == 0))
     {
         return(PlexHelper.ConstructSupportImageLink(fallbackimage));
     }
     return(PlexHelper.ConstructThumbLink((int)im.ImageType, im.ImageID));
 }
Ejemplo n.º 7
0
        private static string Proxyfy(HistoryInfo info)
        {
            string key = info.Key;

            if (key.Contains("/GetMetadata/"))
            {
                return(PlexHelper.PlexProxy(key + "/" + info.ToKey()));
            }
            return(PlexHelper.PlexProxy(key));
        }
Ejemplo n.º 8
0
        public static Hub Clone(this Hub o)
        {
            Hub h = new Hub();

            h.HubIdentifier = o.HubIdentifier;
            h.Key           = PlexHelper.ReplaceSchemeHost(o.Key);
            h.More          = o.More;
            h.Size          = o.Size;
            h.Title         = o.Title;
            h.Type          = o.Type;
            return(h);
        }
Ejemplo n.º 9
0
 public System.IO.Stream GetStream()
 {
     if (MediaContainer.Childrens.Count > 0 && MediaContainer.Childrens[0].Type == "movie")
     {
         MediaContainer.ViewGroup = null;
         MediaContainer.ViewMode  = null;
     }
     if (WebOperationContext.Current != null && WebOperationContext.Current.IncomingRequest.Headers.AllKeys.Contains("X-Plex-Product"))
     {
         //Fix for android hang, if the type is populated
         string kh = WebOperationContext.Current.IncomingRequest.Headers.Get("X-Plex-Product").ToUpper();
         if (kh.Contains("ANDROID"))
         {
             MediaContainer.Childrens.ForEach(a =>
             {
                 a.Type = null;
             });
         }
     }
     return(PlexHelper.GetStreamFromXmlObject(MediaContainer));
 }
Ejemplo n.º 10
0
        public static Video Clone(this Video o)
        {
            Video v;

            if (o is Directory)
            {
                v = new Directory();
            }
            else
            {
                v = new Video();
            }
            v.AddedAt        = o.AddedAt;
            v.AirDate        = o.AirDate;
            v.Art            = PlexHelper.ReplaceSchemeHost(o.Art);
            v.ParentArt      = PlexHelper.ReplaceSchemeHost(o.ParentArt);
            v.GrandparentArt = PlexHelper.ReplaceSchemeHost(o.GrandparentArt);
            v.ChapterSource  = o.ChapterSource;
            v.ContentRating  = o.ContentRating;
            v.Duration       = o.Duration;
            v.EpNumber       = o.EpNumber;
            v.EpisodeCount   = o.EpisodeCount;
            v.ExtraType      = o.ExtraType;
            if (o.Extras != null)
            {
                v.Extras      = new Extras();
                v.Extras.Size = o.Extras.Size;
                if (o.Extras.Videos != null)
                {
                    v.Extras.Videos = new List <Video>();
                    o.Extras.Videos.ForEach(a => v.Extras.Videos.Add(a.Clone()));
                }
            }
            v.Genres               = o.Genres;
            v.GrandparentKey       = o.GrandparentKey;
            v.GrandparentRatingKey = o.GrandparentRatingKey;
            v.GrandparentTitle     = o.GrandparentTitle;
            v.Group                 = o.Group;
            v.Guid                  = o.Guid;
            v.Index                 = o.Index;
            v.Key                   = PlexHelper.ReplaceSchemeHost(o.Key);
            v.LeafCount             = o.LeafCount;
            v.Medias                = o.Medias;
            v.OriginalTitle         = o.OriginalTitle;
            v.OriginallyAvailableAt = o.OriginallyAvailableAt;
            v.ParentIndex           = o.ParentIndex;
            v.ParentKey             = o.ParentKey;
            v.ParentRatingKey       = o.ParentRatingKey;
            v.ParentTitle           = o.ParentTitle;
            v.PrimaryExtraKey       = o.PrimaryExtraKey;
            v.Rating                = o.Rating;
            v.RatingKey             = o.RatingKey;
            if (o.Related != null)
            {
                v.Related = new List <Hub>();
                o.Related.ForEach(a => v.Related.Add(a.Clone()));
            }
            v.Roles            = o.Roles;
            v.Season           = o.Season;
            v.SourceTitle      = o.SourceTitle;
            v.Summary          = o.Summary;
            v.Tagline          = o.Tagline;
            v.Tags             = o.Tags;
            v.Thumb            = PlexHelper.ReplaceSchemeHost(o.Thumb);
            v.ParentThumb      = PlexHelper.ReplaceSchemeHost(o.ParentThumb);
            v.GrandparentThumb = PlexHelper.ReplaceSchemeHost(o.GrandparentThumb);
            v.Title            = o.Title;
            v.Type             = o.Type;
            v.UpdatedAt        = o.UpdatedAt;
            v.Url             = PlexHelper.ReplaceSchemeHost(o.Url);
            v.ViewCount       = o.ViewCount;
            v.ViewOffset      = o.ViewOffset;
            v.ViewedLeafCount = o.ViewedLeafCount;
            v.Year            = o.Year;
            return(v);
        }