public async Task GetAllPlexEpisodes()
        {
            PlexEpisodes.Setup(x => x.GetAllAsync()).ReturnsAsync(F.CreateMany <PlexEpisodes>().ToList());
            var episodes = await Checker.GetEpisodes();

            Assert.That(episodes.Count(), Is.GreaterThan(0));
        }
        public bool IsEpisodeAvailableTest(string providerId, int season, int episode)
        {
            var expected = new List <PlexEpisodes>
            {
                new PlexEpisodes {
                    EpisodeNumber = 1, ShowTitle = "The Flash", ProviderId = 23.ToString(), SeasonNumber = 1, EpisodeTitle = "Pilot"
                }
            };

            PlexEpisodes.Setup(x => x.Custom(It.IsAny <Func <IDbConnection, IEnumerable <PlexEpisodes> > >())).Returns(expected);

            var result = Checker.IsEpisodeAvailable(providerId, season, episode);

            return(result);
        }
Exemplo n.º 3
0
        private void UpdateRecentlyAdded(IDbConnection con)
        {

            //Delete the recently added table, lets start again
            Log.DeleteAll("RecentlyAddedLog");



            // Plex 
            var plexAllContent = PlexContent.GetAll();
            var content = new HashSet<RecentlyAddedLog>();
            foreach (var plexContent in plexAllContent)
            {
                if(plexContent.Type == PlexMediaType.Artist) continue;
                content.Add(new RecentlyAddedLog
                {
                    AddedAt = DateTime.UtcNow,
                    ProviderId = plexContent.ProviderId
                });
            }
            Log.BatchInsert(content, "RecentlyAddedLog");

            var plexEpisodeses = PlexEpisodes.GetAll();
            content.Clear();
            foreach (var ep in plexEpisodeses)
            {
                content.Add(new RecentlyAddedLog
                {
                    AddedAt = DateTime.UtcNow,
                    ProviderId = ep.RatingKey
                });
            }
            Log.BatchInsert(content, "RecentlyAddedLog");

            // Emby 
            content.Clear();
            var embyContent = EmbyContent.GetAll();
            foreach (var plexContent in embyContent)
            {
                content.Add(new RecentlyAddedLog
                {
                    AddedAt = DateTime.UtcNow,
                    ProviderId = plexContent.EmbyId
                });
            }
            Log.BatchInsert(content, "RecentlyAddedLog");

            var embyEpisodes = EmbyEpisodes.GetAll();
            content.Clear();
            foreach (var ep in embyEpisodes)
            {
                content.Add(new RecentlyAddedLog
                {
                    AddedAt = DateTime.UtcNow,
                    ProviderId = ep.EmbyId
                });
            }
            Log.BatchInsert(content, "RecentlyAddedLog");


        }