Exemplo n.º 1
0
        private void UpdateRecentlyAdded(IDbConnection con)
        {
            var allContent = PlexContent.GetAll();

            var content = new HashSet <RecentlyAddedLog>();

            foreach (var plexContent in allContent)
            {
                content.Add(new RecentlyAddedLog
                {
                    AddedAt    = DateTime.UtcNow,
                    ProviderId = plexContent.ProviderId
                });
            }

            Log.BatchInsert(content, "RecentlyAddedLog");

            var allEp = PlexEpisodes.GetAll();

            content.Clear();
            foreach (var ep in allEp)
            {
                content.Add(new RecentlyAddedLog
                {
                    AddedAt    = DateTime.UtcNow,
                    ProviderId = ep.ProviderId
                });
            }

            Log.BatchInsert(content, "RecentlyAddedLog");
        }
Exemplo n.º 2
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");


        }