当前位置: 首页>>代码示例>>C#>>正文


C# IProvider.ConstructFakeIosThumb方法代码示例

本文整理汇总了C#中IProvider.ConstructFakeIosThumb方法的典型用法代码示例。如果您正苦于以下问题:C# IProvider.ConstructFakeIosThumb方法的具体用法?C# IProvider.ConstructFakeIosThumb怎么用?C# IProvider.ConstructFakeIosThumb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProvider的用法示例。


在下文中一共展示了IProvider.ConstructFakeIosThumb方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFromFile

 private MediaContainer GetFromFile(IProvider prov, int userid, string Id, BreadCrumbs info)
 {
     int id;
     if (!int.TryParse(Id, out id))
         return new MediaContainer() { ErrorString = "Invalid File Id" };
     VideoLocal vi = RepoFactory.VideoLocal.GetByID(id);
     BaseObject ret =
         new BaseObject(prov.NewMediaContainer(MediaContainerTypes.File,
             Path.GetFileNameWithoutExtension(vi.FileName ?? ""),
             true, false, info));
     Video v2 = Helper.VideoFromVideoLocal(prov, vi, userid);
     List<Video> dirs = new List<Video>();
     dirs.EppAdd(prov, v2, info, true);
     v2.Thumb = Helper.ConstructSupportImageLink("plex_404.png");
     v2.ParentThumb = Helper.ConstructSupportImageLink("plex_unsort.png");
     if (prov.ConstructFakeIosParent)
         v2.GrandparentKey =
             prov.Proxyfy(prov.ConstructFakeIosThumb(userid, v2.ParentThumb,
                 v2.Art ?? v2.ParentArt ?? v2.GrandparentArt));
     v2.ParentKey = null;
     if (prov.UseBreadCrumbs)
         v2.Key = prov.ShortUrl(ret.MediaContainer.Key);
     ret.MediaContainer.Childrens = dirs;
     return ret.GetStream(prov);
 }
开发者ID:ElementalCrisis,项目名称:jmmserver,代码行数:25,代码来源:CommonImplementation.cs

示例2: GetFromEpisode

        private MediaContainer GetFromEpisode(IProvider prov, int userid, string Id, BreadCrumbs info)
        {
            int id;
            if (!int.TryParse(Id, out id))
                return new MediaContainer() { ErrorString = "Invalid Episode Id" };
            BaseObject ret =
                new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Episode, "Episode", true, true, info));
            using (var session = DatabaseFactory.SessionFactory.OpenSession())
            {
                List<Video> dirs = new List<Video>();
                ISessionWrapper sessionWrapper = session.Wrap();

                AnimeEpisode e = RepoFactory.AnimeEpisode.GetByID(id);
                if (e == null)
                    return new MediaContainer() { ErrorString = "Invalid Episode Id" };
                KeyValuePair<AnimeEpisode, Contract_AnimeEpisode> ep =
                    new KeyValuePair<AnimeEpisode, Contract_AnimeEpisode>(e,
                        e.GetUserContract(userid));
                if (ep.Value != null && ep.Value.LocalFileCount == 0)
                    return new MediaContainer() { ErrorString = "Episode do not have videolocals" };
                AniDB_Episode aep = ep.Key.AniDB_Episode;
                if (aep == null)
                    return new MediaContainer() { ErrorString = "Invalid Episode AniDB link not found" };
                AnimeSeries ser = RepoFactory.AnimeSeries.GetByID(ep.Key.AnimeSeriesID);
                if (ser == null)
                    return new MediaContainer() { ErrorString = "Invalid Serie" };
                AniDB_Anime anime = ser.GetAnime();
                Contract_AnimeSeries con = ser.GetUserContract(userid);
                if (con == null)
                    return new MediaContainer() { ErrorString = "Invalid Serie, Contract not found" };
                try
                {
                    Video v = Helper.VideoFromAnimeEpisode(prov, con.CrossRefAniDBTvDBV2, ep, userid);
                    if (v != null)
                    {
                        Video nv = ser.GetPlexContract(userid);
                        Helper.AddInformationFromMasterSeries(v, con, ser.GetPlexContract(userid), prov is KodiProvider);
                        if (v.Medias != null && v.Medias.Count > 0)
                        {
                            v.Type = "episode";
                            dirs.EppAdd(prov, v, info, true);
                            if (prov.ConstructFakeIosParent)
                                v.GrandparentKey =
                                    prov.Proxyfy(prov.ConstructFakeIosThumb(userid, v.ParentThumb,
                                        v.Art ?? v.ParentArt ?? v.GrandparentArt));
                            v.ParentKey = null;
                        }
                        if (prov.UseBreadCrumbs)
                            v.Key = prov.ShortUrl(ret.MediaContainer.Key);
                        ret.MediaContainer.Art = Helper.ReplaceSchemeHost(nv.Art ?? nv.ParentArt ?? nv.GrandparentArt);
                    }
                    ret.MediaContainer.Childrens = dirs;
                    return ret.GetStream(prov);
                }
                catch (Exception ex)
                {
                    //Fast fix if file do not exist, and still is in db. (Xml Serialization of video info will fail on null)
                }
            }
            return new MediaContainer() { ErrorString = "Episode Not Found" };
        }
开发者ID:ElementalCrisis,项目名称:jmmserver,代码行数:61,代码来源:CommonImplementation.cs

示例3: GetUnsort

 private MediaContainer GetUnsort(IProvider prov, int userid, BreadCrumbs info)
 {
     BaseObject ret =
         new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Video, "Unsort", true, true, info));
     if (!ret.Init())
         return new MediaContainer();
     List<Video> dirs = new List<Video>();
     List<VideoLocal> vids = RepoFactory.VideoLocal.GetVideosWithoutEpisode();
     foreach (VideoLocal v in vids.OrderByDescending(a => a.DateTimeCreated))
     {
         try
         {
             Video m = Helper.VideoFromVideoLocal(prov, v, userid);
             dirs.Add(prov, m, info);
             m.Thumb = Helper.ConstructSupportImageLink("plex_404.png");
             m.ParentThumb = Helper.ConstructSupportImageLink("plex_unsort.png");
             m.ParentKey = null;
             if (prov.ConstructFakeIosParent)
                 m.GrandparentKey =
                     prov.Proxyfy(prov.ConstructFakeIosThumb(userid, m.ParentThumb,
                         m.Art ?? m.ParentArt ?? m.GrandparentArt));
         }
         catch (Exception e)
         {
             //Fast fix if file do not exist, and still is in db. (Xml Serialization of video info will fail on null)
         }
     }
     ret.Childrens = dirs;
     return ret.GetStream(prov);
 }
开发者ID:ElementalCrisis,项目名称:jmmserver,代码行数:30,代码来源:CommonImplementation.cs

示例4: GetItemsFromSerie


//.........这里部分代码省略.........
                    return new MediaContainer() {ErrorString = "Invalid Series, Contract Not Found"};
                Video nv = ser.GetPlexContract(userid);

                Dictionary<AnimeEpisode, Contract_AnimeEpisode> episodes = ser.GetAnimeEpisodes()
                    .ToDictionary(a => a, a => a.GetUserContract(userid));
                episodes = episodes.Where(a => a.Value == null || a.Value.LocalFileCount > 0)
                    .ToDictionary(a => a.Key, a => a.Value);
                if (eptype.HasValue)
                {
                    ret =
                        new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Episode, ser.GetSeriesName(), true,
                            true, info));
                    if (!ret.Init())
                        return new MediaContainer();
                    ret.MediaContainer.Art = cseries.AniDBAnime?.AniDBAnime?.DefaultImageFanart.GenArt();
                    ret.MediaContainer.LeafCount =
                        (cseries.WatchedEpisodeCount + cseries.UnwatchedEpisodeCount).ToString();
                    ret.MediaContainer.ViewedLeafCount = cseries.WatchedEpisodeCount.ToString();
                    episodes = episodes.Where(a => a.Key.EpisodeTypeEnum == eptype.Value)
                        .ToDictionary(a => a.Key, a => a.Value);
                }
                else
                {
                    ret = new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Show, "Types", false, true, info));
                    if (!ret.Init())
                        return new MediaContainer();
                    ret.MediaContainer.Art = cseries.AniDBAnime?.AniDBAnime?.DefaultImageFanart.GenArt();
                    ret.MediaContainer.LeafCount =
                        (cseries.WatchedEpisodeCount + cseries.UnwatchedEpisodeCount).ToString();
                    ret.MediaContainer.ViewedLeafCount = cseries.WatchedEpisodeCount.ToString();
                    List<enEpisodeType> types = episodes.Keys.Select(a => a.EpisodeTypeEnum).Distinct().ToList();
                    if (types.Count > 1)
                    {
                        List<PlexEpisodeType> eps = new List<PlexEpisodeType>();
                        foreach (enEpisodeType ee in types)
                        {
                            PlexEpisodeType k2 = new PlexEpisodeType();
                            PlexEpisodeType.EpisodeTypeTranslated(k2, ee,
                                (AnimeTypes) cseries.AniDBAnime.AniDBAnime.AnimeType,
                                episodes.Count(a => a.Key.EpisodeTypeEnum == ee));
                            eps.Add(k2);
                        }
                        List<Video> dirs = new List<Video>();
                        //bool converttoseason = true;

                        foreach (PlexEpisodeType ee in  eps.OrderBy(a=>a.Name))
                        {
                            Video v = new Directory();
                            v.Art = nv.Art;
                            v.Title = ee.Name;
                            v.AnimeType = "AnimeType";
                            v.LeafCount = ee.Count.ToString();
                            v.ChildCount = v.LeafCount;
                            v.ViewedLeafCount = "0";
                            v.Key = prov.ShortUrl(prov.ConstructSerieIdUrl(userid, ee.Type + "_" + ser.AnimeSeriesID));
                            v.Thumb = Helper.ConstructSupportImageLink(ee.Image);
                            if ((ee.AnimeType == AnimeTypes.Movie) || (ee.AnimeType == AnimeTypes.OVA))
                            {
                                v = Helper.MayReplaceVideo(v, ser, cseries, userid, false, nv);
                            }
                            dirs.Add(prov, v, info, false, true);
                        }
                        ret.Childrens = dirs;
                        return ret.GetStream(prov);
                    }
                }
                List<Video> vids = new List<Video>();

                if ((eptype.HasValue) && (info!=null))
                    info.ParentKey = info.GrandParentKey;
                bool hasRoles = false;
                foreach (KeyValuePair<AnimeEpisode, Contract_AnimeEpisode> ep in episodes)
                {
                    try
                    {
                        Video v = Helper.VideoFromAnimeEpisode(prov, cseries.CrossRefAniDBTvDBV2, ep, userid);
                        if (v!=null && v.Medias != null && v.Medias.Count > 0)
                        {
                            if (nocast && !hasRoles) hasRoles = true;
                            Helper.AddInformationFromMasterSeries(v, cseries, nv, hasRoles);
                            v.Type = "episode";
                            vids.Add(prov, v, info);
                            if (prov.ConstructFakeIosParent)
                                v.GrandparentKey =
                                    prov.Proxyfy(prov.ConstructFakeIosThumb(userid, v.ParentThumb,
                                        v.Art ?? v.ParentArt ?? v.GrandparentArt));
                            v.ParentKey = null;
                            if (!hasRoles) hasRoles = true;
                        }
                    }
                    catch (Exception e)
                    {
                        //Fast fix if file do not exist, and still is in db. (Xml Serialization of video info will fail on null)
                    }
                }
                ret.Childrens = vids.OrderBy(a => int.Parse(a.EpisodeNumber)).ToList();
                //FilterExtras(prov,ret.Childrens);
                return ret.GetStream(prov);
            }
        }
开发者ID:ElementalCrisis,项目名称:jmmserver,代码行数:101,代码来源:CommonImplementation.cs

示例5: GetItemsFromPlaylist

        private MediaContainer GetItemsFromPlaylist(IProvider prov, int userid, string id, BreadCrumbs info)
        {
            var PlaylistID = -1;
            int.TryParse(id, out PlaylistID);

            if (PlaylistID == 0)
            {
                using (var session = DatabaseFactory.SessionFactory.OpenSession())
                {
                    var ret = new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Show, "Playlists", true, true, info));
                    if (!ret.Init())
                        return new MediaContainer(); //Normal
                    var retPlaylists = new List<Video>();
                    var playlists = RepoFactory.Playlist.GetAll();
                    var sessionWrapper = session.Wrap();

                    foreach (var playlist in playlists)
                    {
                        var dir = new Directory();
                        dir.Key = prov.ShortUrl(prov.ConstructPlaylistIdUrl(userid, playlist.PlaylistID));
                        dir.Title = playlist.PlaylistName;
                        dir.Id = playlist.PlaylistID.ToString();
                        dir.AnimeType = JMMContracts.PlexAndKodi.AnimeTypes.AnimePlaylist.ToString();
                        var episodeID = -1;
                        if (int.TryParse(playlist.PlaylistItems.Split('|')[0].Split(';')[1], out episodeID))
                        {
                            var anime = RepoFactory.AnimeEpisode.GetByID(episodeID).GetAnimeSeries(sessionWrapper).GetAnime();
                            dir.Thumb = anime?.GetDefaultPosterDetailsNoBlanks(sessionWrapper)?.GenPoster();
                            dir.Art = anime?.GetDefaultFanartDetailsNoBlanks(sessionWrapper)?.GenArt();
                            dir.Banner = anime?.GetDefaultWideBannerDetailsNoBlanks(sessionWrapper)?.GenArt();
                        }
                        else
                        {
                            dir.Thumb = Helper.ConstructSupportImageLink("plex_404V.png");
                        }
                        dir.LeafCount = playlist.PlaylistItems.Split('|').Count().ToString();
                        dir.ViewedLeafCount = "0";
                        retPlaylists.Add(prov, dir, info);
                    }
                    retPlaylists = retPlaylists.OrderBy(a => a.Title).ToList();
                    ret.Childrens = retPlaylists;
                    return ret.GetStream(prov);
                }
            }
            if (PlaylistID > 0)
            {
                var playlist = RepoFactory.Playlist.GetByID(PlaylistID);
                var playlistItems = playlist.PlaylistItems.Split('|');
                var vids = new List<Video>();
                var ret =
                    new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Episode, playlist.PlaylistName, true, true,
                        info));
                if (!ret.Init())
                    return new MediaContainer(); //Normal
                foreach (var item in playlistItems)
                {
                    try
                    {
                        var episodeID = -1;
                        int.TryParse(item.Split(';')[1], out episodeID);
                        if (episodeID < 0) return new MediaContainer() { ErrorString = "Invalid Episode ID" };
                        AnimeEpisode e = RepoFactory.AnimeEpisode.GetByID(episodeID);
                        if (e == null)
                            return new MediaContainer() { ErrorString = "Invalid Episode" };
                        KeyValuePair<AnimeEpisode, Contract_AnimeEpisode> ep =
                            new KeyValuePair<AnimeEpisode, Contract_AnimeEpisode>(e,
                                e.GetUserContract(userid));
                        if (ep.Value != null && ep.Value.LocalFileCount == 0)
                            continue;
                        AnimeSeries ser = RepoFactory.AnimeSeries.GetByID(ep.Key.AnimeSeriesID);
                        if (ser == null)
                            return new MediaContainer() { ErrorString = "Invalid Series" };
                        Contract_AnimeSeries con = ser.GetUserContract(userid);
                        if (con == null)
                            return new MediaContainer() { ErrorString = "Invalid Series, Contract not found" };
                        Video v = Helper.VideoFromAnimeEpisode(prov, con.CrossRefAniDBTvDBV2, ep, userid);
                        if (v != null && v.Medias != null && v.Medias.Count > 0)
                        {
                            Helper.AddInformationFromMasterSeries(v, con, ser.GetPlexContract(userid));
                            v.Type = "episode";
                            vids.Add(prov, v, info);
                            if (prov.ConstructFakeIosParent)
                                v.GrandparentKey =
                                    prov.Proxyfy(prov.ConstructFakeIosThumb(userid, v.ParentThumb,
                                        v.Art ?? v.ParentArt ?? v.GrandparentArt));
                            v.ParentKey = null;
                        }
                    }
                    catch (Exception e)
                    {
                        //Fast fix if file do not exist, and still is in db. (Xml Serialization of video info will fail on null)
                    }
                }
                ret.MediaContainer.RandomizeArt(vids);
                ret.Childrens = vids;
                return ret.GetStream(prov);
            }
            return new MediaContainer() { ErrorString = "Invalid Playlist" };
        }
开发者ID:ElementalCrisis,项目名称:jmmserver,代码行数:99,代码来源:CommonImplementation.cs


注:本文中的IProvider.ConstructFakeIosThumb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。