コード例 #1
0
        public override void ProcessCommand()
        {
            logger.Info("Processing CommandRequest_UpdateMyListFileStatus: {0}", Hash);


            try
            {
                VideoLocalRepository   repVids     = new VideoLocalRepository();
                AnimeEpisodeRepository repEpisodes = new AnimeEpisodeRepository();

                // NOTE - we might return more than one VideoLocal record here, if there are duplicates by hash
                VideoLocal vid = repVids.GetByHash(this.Hash);
                if (vid != null)
                {
                    bool isManualLink = false;
                    List <CrossRef_File_Episode> xrefs = vid.EpisodeCrossRefs;
                    if (xrefs.Count > 0)
                    {
                        isManualLink = xrefs[0].CrossRefSource != (int)CrossRefSource.AniDB;
                    }

                    if (isManualLink)
                    {
                        JMMService.AnidbProcessor.UpdateMyListFileStatus(xrefs[0].AnimeID,
                                                                         xrefs[0].Episode.EpisodeNumber, this.Watched);
                        logger.Info("Updating file list status (GENERIC): {0} - {1}", vid.ToString(), this.Watched);
                    }
                    else
                    {
                        if (WatchedDateAsSecs > 0)
                        {
                            DateTime?watchedDate = Utils.GetAniDBDateAsDate(WatchedDateAsSecs);
                            JMMService.AnidbProcessor.UpdateMyListFileStatus(vid, this.Watched, watchedDate);
                        }
                        else
                        {
                            JMMService.AnidbProcessor.UpdateMyListFileStatus(vid, this.Watched, null);
                        }
                        logger.Info("Updating file list status: {0} - {1}", vid.ToString(), this.Watched);
                    }

                    if (UpdateSeriesStats)
                    {
                        // update watched stats
                        List <AnimeEpisode> eps = repEpisodes.GetByHash(vid.ED2KHash);
                        if (eps.Count > 0)
                        {
                            // all the eps should belong to the same anime
                            eps[0].GetAnimeSeries().QueueUpdateStats();
                            //eps[0].AnimeSeries.TopLevelAnimeGroup.UpdateStatsFromTopLevel(true, true, false);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error processing CommandRequest_UpdateMyListFileStatus: {0} - {1}", Hash, ex.ToString());
                return;
            }
        }
コード例 #2
0
ファイル: VideoLocal.cs プロジェクト: ewelike23/jmm
        public List <AnimeEpisode> GetAnimeEpisodes(ISession session)
        {
            AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();

            return(repEps.GetByHash(session, Hash));
        }