Exemplo n.º 1
0
        public override ItemList?ProcessShow(ShowConfiguration si, bool forceRefresh)
        {
            //If we have KODI New style images being downloaded then we want to check that 3 files exist
            //for the cachedSeries:
            //http://wiki.xbmc.org/index.php?title=XBMC_v12_(Frodo)_FAQ#Local_images
            //poster
            //banner
            //fanart

            if (TVSettings.Instance.KODIImages)
            {
                ItemList theActionList = new ItemList();
                // base folder:
                if (!string.IsNullOrEmpty(si.AutoAddFolderBase) && si.AllFolderLocations(false).Count > 0)
                {
                    FileInfo posterJpg = FileHelper.FileInFolder(si.AutoAddFolderBase, "poster.jpg");
                    FileInfo bannerJpg = FileHelper.FileInFolder(si.AutoAddFolderBase, "banner.jpg");
                    FileInfo fanartJpg = FileHelper.FileInFolder(si.AutoAddFolderBase, "fanart.jpg");

                    if ((forceRefresh || !posterJpg.Exists) && !donePosterJpg.Contains(si.AutoAddFolderBase))
                    {
                        string path = si.CachedShow?.GetSeriesPosterPath();
                        if (!string.IsNullOrEmpty(path))
                        {
                            theActionList.Add(new ActionDownloadImage(si, null, posterJpg, path, false));
                            donePosterJpg.Add(si.AutoAddFolderBase);
                        }
                    }

                    if ((forceRefresh || !bannerJpg.Exists) && !doneBannerJpg.Contains(si.AutoAddFolderBase))
                    {
                        string path = si.CachedShow?.GetSeriesWideBannerPath();
                        if (!string.IsNullOrEmpty(path))
                        {
                            theActionList.Add(new ActionDownloadImage(si, null, bannerJpg, path, false));
                            doneBannerJpg.Add(si.AutoAddFolderBase);
                        }
                    }

                    if ((forceRefresh || !fanartJpg.Exists) && !doneFanartJpg.Contains(si.AutoAddFolderBase))
                    {
                        string path = si.CachedShow?.GetSeriesFanartPath();
                        if (!string.IsNullOrEmpty(path))
                        {
                            theActionList.Add(new ActionDownloadImage(si, null, fanartJpg, path));
                            doneFanartJpg.Add(si.AutoAddFolderBase);
                        }
                    }
                }
                return(theActionList);
            }
            return(base.ProcessShow(si, forceRefresh));
        }