Пример #1
0
        int IComparable <EpisodeData> .CompareTo(EpisodeData other)
        {
            if (other == null)
            {
                return(1);
            }

            var compare = SortName.CompareTo(other.SortName);

            if (compare == 0)
            {
                compare = SeasonNumber.PadLeft(2, '0').CompareTo(other.SeasonNumber.PadLeft(2, '0'));
            }

            if (compare == 0)
            {
                compare = EpisodeNumber.CompareTo(other.EpisodeNumber);
            }

            if (compare == 0)
            {
                compare = AddInfo.CompareTo(other.AddInfo);
            }

            return(compare);
        }
        public List <string> ToSearchParameters()
        {
            List <string> parms = new List <string>();

            if (AniDB_Anime == null)
            {
                RefreshAnime();
            }
            VM_AniDB_Anime anime = AniDB_Anime;

            if (anime == null)
            {
                return(parms);
            }

            // only use the first 2 words of the anime's title
            string[] titles = anime.MainTitle.Split(' ');
            int      i      = 0;

            foreach (string s in titles)
            {
                i++;
                parms.Add(s.Trim());
                if (i == 2)
                {
                    break;
                }
            }
            parms.Add(EpisodeNumber.ToString().PadLeft(2, '0'));
            return(parms);
        }
Пример #3
0
 public override string ToString()
 {
     return(new StringBuilder("Episode: ")
            .Append(EpisodeNumber.ToString())
            .Append(" ")
            .Append(OldFilename)
            .ToString());
 }
Пример #4
0
 protected override async Task SaveInternal()
 {
     Title.Save();
     SeasonNumber.Save();
     EpisodeNumber.Save();
     EpisodeMetadata metadata = CreateMetadata();
     await _metadataService.Save(Path, metadata);
 }
        public async Task Update(string episodeFile, string serieId)
        {
            EpisodeNumber   episode  = TvShowHelper.FindEpisodeNumberFromFile(_fileSystemService, episodeFile);
            EpisodeMetadata metadata = await GetMetadata(episodeFile, serieId, episode);

            metadata.PlayCount       = 0;
            metadata.FileInformation = _fileInformationService.GetVideoFileInformation(episodeFile);
            await Save(episodeFile, metadata);
        }
 public override int GetHashCode() {
   int hash = 1;
   if (ProgramName.Length != 0) hash ^= ProgramName.GetHashCode();
   if (EpisodeName.Length != 0) hash ^= EpisodeName.GetHashCode();
   if (EpisodeNumber != 0) hash ^= EpisodeNumber.GetHashCode();
   if (IsLive != false) hash ^= IsLive.GetHashCode();
   if (_unknownFields != null) {
     hash ^= _unknownFields.GetHashCode();
   }
   return hash;
 }
 private async Task<EpisodeMetadata> GetMetadata(string episodeFile, string serieId, EpisodeNumber episode)
 {
     try
     {
         return await _metadataUpdater.GetEpisodeMetadata(serieId, episode.SeasonNumber, episode.EpisodeSeasonNumber);
     }
     catch (ApiException)
     {
         throw new EpisodeNotFoundException(episodeFile);
     }
 }
Пример #8
0
        private string GetEpisodenNumberWithZeros()
        {
            int    maxNumberLength = ViewModel.Current.MaxEpisodeNumber.ToString().Length;
            string numberText      = EpisodeNumber.ToString();

            for (int i = numberText.Length; i < maxNumberLength; i++)
            {
                numberText = "0" + numberText;
            }

            return(numberText);
        }
Пример #9
0
        /*
         * public Raw_AniDB_Episode(XmlNode node, int anid)
         * {
         *      ProcessEpisodeSource(node, anid);
         * }*/

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("episodeID: " + EpisodeID.ToString());
            sb.Append(" | animeID: " + AnimeID.ToString());
            sb.Append(" | episodeNumber: " + EpisodeNumber.ToString());
            sb.Append(" | episodeType: " + EpisodeType.ToString());
            sb.Append(" | englishName: " + EnglishName);
            sb.Append(" | airDate: " + AirDate);
            //sb.Append(" | AirDateFormatted: " + AirDateFormatted);

            return(sb.ToString());
        }
Пример #10
0
        public override int GetHashCode()
        {
            int ret = (Title != null) ? Title.GetHashCode() : 0;

            ret  = (ret * 397) ^ ((EpisodeNumber != null) ? EpisodeNumber.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((EpisodeTitle != null) ? EpisodeTitle.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((Synopsis != null) ? Synopsis.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((Team1 != null) ? Team1.GetHashCode() : 0);
            ret  = (ret * 397) ^ ((Team2 != null) ? Team2.GetHashCode() : 0);
            ret  = (ret * 397) ^ SeriesID.GetHashCode();
            ret &= 0x7fffffff;

            return(ret);
        }
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + EntityID.GetHashCode();
            hash = hash * 23 + EpisodeNumber.GetHashCode();
            hash = hash * 23 + ErrorCode.GetHashCode();
            hash = hash * 23 + ErrorMesg.GetHashCode();
            hash = hash * 23 + Facility.GetHashCode();
            hash = hash * 23 + OptionId.GetHashCode();
            hash = hash * 23 + OptionStaffId.GetHashCode();
            hash = hash * 23 + OptionUserId.GetHashCode();
            hash = hash * 23 + SystemCode.GetHashCode();
            foreach (var form in this.Forms)
            {
                hash = hash * 23 + form.GetHashCode();
            }
            return(hash);
        }
Пример #12
0
        public int CompareTo(AnimeEpisodeVM obj)
        {
            switch (SortType)
            {
            case SortMethod.EpisodeNumber:
                return(EpisodeNumber.CompareTo(obj.EpisodeNumber));

            case SortMethod.AirDate:
                if (AniDB_AirDate.HasValue && obj.AniDB_AirDate.HasValue)
                {
                    return(AniDB_AirDate.Value.CompareTo(obj.AniDB_AirDate.Value));
                }
                else
                {
                    return(0);
                }

            default:
                return(EpisodeNumber.CompareTo(obj.EpisodeNumber));
            }
        }
Пример #13
0
        private void SetEpisodeNameVariants()
        {
            EpisodeNumberAndName = string.Format("{0} - {1}", EpisodeNumber, EpisodeName);
            string shortType = "";

            switch (EpisodeTypeEnum)
            {
            case JMMClient.EpisodeType.Credits: shortType = "C"; break;

            case JMMClient.EpisodeType.Episode: shortType = ""; break;

            case JMMClient.EpisodeType.Other: shortType = "O"; break;

            case JMMClient.EpisodeType.Parody: shortType = "P"; break;

            case JMMClient.EpisodeType.Special: shortType = "S"; break;

            case JMMClient.EpisodeType.Trailer: shortType = "T"; break;
            }
            EpisodeNumberAndNameWithType = string.Format("{0}{1} - {2}", shortType, EpisodeNumber, EpisodeName);
            EpisodeNumberWithType        = string.Format("{0} {1}", EpisodeTypeEnum.ToString(), EpisodeNumber);
            EpisodeTypeAndNumber         = string.Format("{0}{1}", shortType, EpisodeNumber);
            EpisodeTypeAndNumberAbsolute = string.Format("{0}{1}", shortType, EpisodeNumber.ToString().PadLeft(5, '0'));

            EpisodeNumberAndNameTruncated = EpisodeNumberAndName;
            if (EpisodeNumberAndName.Length > 60)
            {
                EpisodeNumberAndNameTruncated = EpisodeNumberAndName.Substring(0, 60) + "...";
            }

            EpisodeNumberAndNameWithTypeTruncated = EpisodeNumberAndNameWithType;
            if (EpisodeNumberAndNameWithTypeTruncated.Length > 60)
            {
                EpisodeNumberAndNameWithTypeTruncated = EpisodeNumberAndNameWithType.Substring(0, 60) + "...";
            }
        }
        private void SetEpisodeNameVariants()
        {
            EpisodeNumberAndName = $"{EpisodeNumber} - {EpisodeName}";
            string shortType = "";

            switch (EpisodeTypeEnum)
            {
            case enEpisodeType.Credits: shortType = "C"; break;

            case enEpisodeType.Episode: shortType = ""; break;

            case enEpisodeType.Other: shortType = "O"; break;

            case enEpisodeType.Parody: shortType = "P"; break;

            case enEpisodeType.Special: shortType = "S"; break;

            case enEpisodeType.Trailer: shortType = "T"; break;
            }
            EpisodeNumberAndNameWithType = $"{shortType}{EpisodeNumber} - {EpisodeName}";
            EpisodeNumberWithType        = $"{EpisodeTypeEnum.ToString()} {EpisodeNumber}";
            EpisodeTypeAndNumber         = $"{shortType}{EpisodeNumber}";
            EpisodeTypeAndNumberAbsolute = $"{shortType}{EpisodeNumber.ToString().PadLeft(5, '0')}";

            EpisodeNumberAndNameTruncated = EpisodeNumberAndName;
            if (EpisodeNumberAndName.Length > 60)
            {
                EpisodeNumberAndNameTruncated = EpisodeNumberAndName.Substring(0, 60) + "...";
            }

            EpisodeNumberAndNameWithTypeTruncated = EpisodeNumberAndNameWithType;
            if (EpisodeNumberAndNameWithTypeTruncated.Length > 60)
            {
                EpisodeNumberAndNameWithTypeTruncated = EpisodeNumberAndNameWithType.Substring(0, 60) + "...";
            }
        }
Пример #15
0
        private void RefreshFromMetadata(EpisodeMetadata metadata)
        {
            Title.Value = metadata.Title;
            Title.Save();
            Rating             = metadata.Rating;
            SeasonNumber.Value = metadata.SeasonNumber;
            SeasonNumber.Save();
            EpisodeNumber.Value = metadata.EpisodeNumber;
            EpisodeNumber.Save();
            Plot = metadata.Plot;
            ImagePath.RefreshImage(metadata.ImagePath);
            ImageUrl         = metadata.ImageUrl;
            PlayCount        = metadata.PlayCount;
            LastPlayed       = metadata.LastPlayed;
            AiredDate        = metadata.AiredDate;
            DisplaySeason    = metadata.DisplaySeason;
            DisplayEpisode   = metadata.DisplayEpisode;
            EpisodeBookmarks = metadata.EpisodeBookmarks;

            Credits.ReplaceWith(metadata.Credits);
            Directors.ReplaceWith(metadata.Director);

            _localMetadataExists = metadata.FileInformation != null;
        }
Пример #16
0
 public string GetNumber()
 {
     return($"S{SeasonNumber.ToString().PadLeft(2, '0')}E{EpisodeNumber.ToString().PadLeft(2, '0')}");
 }
 private async Task <EpisodeMetadata> GetMetadata(string episodeFile, string serieId, EpisodeNumber episode)
 {
     try
     {
         return(await _metadataUpdater.GetEpisodeMetadata(serieId, episode.SeasonNumber, episode.EpisodeSeasonNumber));
     }
     catch (ApiException)
     {
         throw new EpisodeNotFoundException(episodeFile);
     }
 }
Пример #18
0
 public override string ToString()
 {
     return("s" + Season.ToString("D2") + " e" + EpisodeNumber.ToString("D2") + " - " + EpisodeName);
 }
Пример #19
0
 public override int GetHashCode()
 {
     return(SearchMode.GetHashCode() ^ SeasonNumber.GetHashCode() ^ EpisodeNumber.GetHashCode());
 }