コード例 #1
0
ファイル: OmdbMovieInfo.cs プロジェクト: Vasar007/ProjectV
        /// <summary>
        /// Determines whether specified instance of <see cref="OmdbMovieInfo" /> is equal to caller
        /// object.
        /// </summary>
        /// <param name="other">Other object to compare.</param>
        /// <returns><c>true</c> if values are memberwise equals, <c>false</c> otherwise.</returns>
        private bool IsEqual(OmdbMovieInfo other)
        {
            // Note: list with genre IDs usually has only few items and that is why comparison
            // using contains method is considered the best option here.

            return(string.Equals(Rated, other.Rated, StringComparison.Ordinal) &&
                   Metascore.Equals(other.Metascore) &&
                   GenreIds.All(genreId => other.GenreIds.Contains(genreId)) &&
                   string.Equals(PosterPath, other.PosterPath, StringComparison.Ordinal));
        }
コード例 #2
0
        public string GetDirectoryName()
        {
            string meta = string.Empty;

            if (!Metascore.IsZero())
            {
                meta = $", Meta-{Math.Round(Metascore, 1)}";
            }
            string ebert = string.Empty;

            if (StdEbertRating != 0)
            {
                ebert = $" Ebert-{EbertRating}";
            }
            string name = $"{Math.Round(Score,1)}, {Title} ({Year}) [{Runtime}] IMDB-{imdbRating}. RT={Math.Round(StdRtMeter??0,1)}%.{Math.Round(StdRtRating ?? 0,1)}, Meta-{Math.Round(Metascore,1)}{ebert}";


            if (Settings.Config.AppendGenre && !string.IsNullOrWhiteSpace(Genre))
            {
                var    genres      = Genre.Split(',').Select(x => $"[{x.Trim()}]");
                string genreString = string.Join(" ", genres);
                name = $"{name} {genreString}";
            }
            if (Settings.Config.AppendOscars && !Awards.IsNullOrWhitespace() && Awards.ToLowerInvariant().Contains("oscar"))
            {
                string oscarTag = OscarTagger.GetOscarTag(Awards);
                if (!oscarTag.IsNullOrWhitespace())
                {
                    name = $"{name} {oscarTag}";
                }
            }
            var invalid = Path.GetInvalidFileNameChars().Intersect(name);

            if (invalid.Any())
            {
                foreach (var i in invalid)
                {
                    name = name.Replace(i.ToString(), String.Empty);
                }
            }


            return(name);
        }