Example #1
0
        /// <summary>
        /// Resolves the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        /// <returns>BoxSet.</returns>
        protected override BoxSet Resolve(ItemResolveArgs args)
        {
            // It's a boxset if all of the following conditions are met:
            // Is a Directory
            // Contains [boxset] in the path
            if (args.IsDirectory)
            {
                var filename = Path.GetFileName(args.Path);

                if (string.IsNullOrEmpty(filename))
                {
                    return(null);
                }

                if (filename.IndexOf("[boxset]", StringComparison.OrdinalIgnoreCase) != -1 ||
                    args.ContainsFileSystemEntryByName("collection.xml"))
                {
                    return(new BoxSet
                    {
                        Path = args.Path,
                        Name = ResolverHelper.StripBrackets(Path.GetFileName(args.Path))
                    });
                }
            }

            return(null);
        }
Example #2
0
 public void TestStripBrackets()
 {
     Assert.AreEqual("My Movie", ResolverHelper.StripBrackets("My Movie [boxset] [blah blah]"));
     Assert.AreEqual("file 01", ResolverHelper.StripBrackets("[tag1] file 01 [tvdbid=12345]"));
     Assert.AreEqual("file 01", ResolverHelper.StripBrackets("[tag1] file 01 [tmdbid=12345]"));
     Assert.AreEqual("file 01", ResolverHelper.StripBrackets("[tag1] file [boxset] [tvdbid=12345] 01 [tmdbid=12345]"));
 }