Beispiel #1
0
        private TraktSyncCollectionPostBuilder AddShowOrIgnore(TraktShow show, TraktMetadata metadata = null,
                                                               DateTime?collectedAt = null)
        {
            if (ContainsShow(show))
            {
                return(this);
            }

            var collectionShow = new TraktSyncCollectionPostShow();

            collectionShow.Ids   = show.Ids;
            collectionShow.Title = show.Title;
            collectionShow.Year  = show.Year;

            if (metadata != null)
            {
                collectionShow.Metadata = metadata;
            }

            if (collectedAt.HasValue)
            {
                collectionShow.CollectedAt = collectedAt.Value.ToUniversalTime();
            }

            (_collectionPost.Shows as List <TraktSyncCollectionPostShow>).Add(collectionShow);

            return(this);
        }
Beispiel #2
0
        private void CreateOrSetShow(TraktShow show, IEnumerable <TraktSyncCollectionPostShowSeason> showSeasons,
                                     TraktMetadata metadata = null, DateTime?collectedAt = null)
        {
            var existingShow = _collectionPost.Shows.Where(s => s.Ids == show.Ids).FirstOrDefault();

            if (existingShow != null)
            {
                existingShow.Seasons = showSeasons;
            }
            else
            {
                var collectionShow = new TraktSyncCollectionPostShow();
                collectionShow.Ids   = show.Ids;
                collectionShow.Title = show.Title;
                collectionShow.Year  = show.Year;

                if (metadata != null)
                {
                    collectionShow.Metadata = metadata;
                }

                if (collectedAt.HasValue)
                {
                    collectionShow.CollectedAt = collectedAt.Value.ToUniversalTime();
                }

                collectionShow.Seasons = showSeasons;
                (_collectionPost.Shows as List <TraktSyncCollectionPostShow>).Add(collectionShow);
            }
        }