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


C# IProvider.ConstructSupportImageLink方法代码示例

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


在下文中一共展示了IProvider.ConstructSupportImageLink方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = prov.ConstructSupportImageLink("plex_404.png");
            v2.ParentThumb = prov.ConstructSupportImageLink("plex_unsort.png");
            PlexDeviceInfo dinfo = prov.GetPlexClient();
            if (prov.ConstructFakeIosParent && dinfo != null && dinfo.Client == PlexClient.IOS)

                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:japanesemediamanager,项目名称:jmmserver,代码行数:27,代码来源:CommonImplementation.cs

示例2: 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(prov))
                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 = prov.ConstructSupportImageLink("plex_404.png");
                    m.ParentThumb = prov.ConstructSupportImageLink("plex_unsort.png");
                    m.ParentKey = null;
                    PlexDeviceInfo dinfo = prov.GetPlexClient();
                    if (prov.ConstructFakeIosParent && dinfo != null && dinfo.Client == PlexClient.IOS)

                        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:japanesemediamanager,项目名称:jmmserver,代码行数:32,代码来源:CommonImplementation.cs

示例3: GetFilters

        public MediaContainer GetFilters(IProvider prov, string uid)
        {
            int t = 0;
            int.TryParse(uid, out t);
            JMMUser user = t > 0 ? Helper.GetJMMUser(uid) : Helper.GetUser(uid);
            if (user == null)
                return new MediaContainer() { ErrorString = "User not found" };
            int userid = user.JMMUserID;

            BreadCrumbs info = prov.UseBreadCrumbs
                ? new BreadCrumbs { Key = prov.ConstructFiltersUrl(userid), Title = "Anime" }
                : null;
            BaseObject ret =
                new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Show, "Anime", false, false, info));
            if (!ret.Init(prov))
                return new MediaContainer(); //Normal OPTION VERB
            List<Video> dirs = new List<Video>();
            try
            {
                using (var session = DatabaseFactory.SessionFactory.OpenSession())
                {
                    List<GroupFilter> allGfs = RepoFactory.GroupFilter.GetTopLevel().Where(a => a.InvisibleInClients == 0 &&
                    (
                        (a.GroupsIds.ContainsKey(userid) && a.GroupsIds[userid].Count > 0)
                        || (a.FilterType & (int)GroupFilterType.Directory) == (int)GroupFilterType.Directory)
                    ).ToList();

                    foreach (GroupFilter gg in allGfs)
                    {
                        Directory pp = Helper.DirectoryFromFilter(prov, gg, userid);
                        if (pp != null)
                            dirs.Add(prov, pp, info);
                    }
                    List<VideoLocal> vids = RepoFactory.VideoLocal.GetVideosWithoutEpisode();
                    if (vids.Count > 0)
                    {
                        Directory pp = new Directory() { Type = "show" };
                        pp.Key = prov.ShortUrl(prov.ConstructUnsortUrl(userid));
                        pp.Title = "Unsort";
                        pp.AnimeType = JMMContracts.PlexAndKodi.AnimeTypes.AnimeUnsort.ToString();
                        pp.Thumb = prov.ConstructSupportImageLink("plex_unsort.png");
                        pp.LeafCount = vids.Count.ToString();
                        pp.ViewedLeafCount = "0";
                        dirs.Add(prov, pp, info);
                    }
                    var playlists = RepoFactory.Playlist.GetAll();
                    if (playlists.Count > 0)
                    {
                        Directory pp = new Directory() { Type = "show" };
                        pp.Key = prov.ShortUrl(prov.ConstructPlaylistUrl(userid));
                        pp.Title = "Playlists";
                        pp.AnimeType = JMMContracts.PlexAndKodi.AnimeTypes.AnimePlaylist.ToString();
                        pp.Thumb = prov.ConstructSupportImageLink("plex_playlists.png");
                        pp.LeafCount = playlists.Count.ToString();
                        pp.ViewedLeafCount = "0";
                        dirs.Add(prov, pp, info);
                    }
                    dirs = dirs.OrderBy(a => a.Title).ToList();
                }
                ret.MediaContainer.RandomizeArt(prov, dirs);
                if (prov.AddPlexPrefsItem)
                {
                    Directory dir = new Directory();
                    dir.Prompt = "Search";
                    dir.Thumb = dir.Art = "/:/plugins/com.plexapp.plugins.myanime/resources/Search.png";
                    dir.Key = "/video/jmm/search";
                    dir.Title = "Search";
                    dir.Search = "1";
                    dirs.Add(dir);
                }
                if (prov.AddPlexSearchItem)
                {
                    Directory dir = new Directory();
                    dir.Thumb = dir.Art = "/:/plugins/com.plexapp.plugins.myanime/resources/Gear.png";
                    dir.Key = "/:/plugins/com.plexapp.plugins.myanime/prefs";
                    dir.Title = "Preferences";
                    dir.Settings = "1";
                    dirs.Add(dir);
                }
                ret.Childrens = dirs;
                PlexDeviceInfo dinfo = prov.GetPlexClient();
                if (dinfo!=null)
                    logger.Info(dinfo.ToString());
                return ret.GetStream(prov);
            }
            catch (Exception ex)
            {
                logger.Error( ex,ex.ToString());
                return new MediaContainer() { ErrorString = "System Error, see JMMServer logs for more information" };
            }
        }
开发者ID:japanesemediamanager,项目名称:jmmserver,代码行数:91,代码来源:CommonImplementation.cs

示例4: 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(prov))
                        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(prov);
                            dir.Art = anime?.GetDefaultFanartDetailsNoBlanks(sessionWrapper)?.GenArt(prov);
                            dir.Banner = anime?.GetDefaultWideBannerDetailsNoBlanks(sessionWrapper)?.GenArt(prov);
                        }
                        else
                        {
                            dir.Thumb = prov.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(prov))
                    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);
                            PlexDeviceInfo dinfo = prov.GetPlexClient();
                            if (prov.ConstructFakeIosParent && dinfo!=null && dinfo.Client==PlexClient.IOS)
                                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(prov, vids);
                ret.Childrens = vids;
                return ret.GetStream(prov);
            }
            return new MediaContainer() { ErrorString = "Invalid Playlist" };
        }
开发者ID:japanesemediamanager,项目名称:jmmserver,代码行数:100,代码来源:CommonImplementation.cs


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