Skip to content

Commit

Permalink
Fix for {collectionFolder}
Browse files Browse the repository at this point in the history
  • Loading branch information
SirSparkles committed Nov 27, 2021
1 parent 02be9d2 commit c2b39ff
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions TVRename/Settings/CustomMovieName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,19 @@ public static List<string> ExamplePresets(MovieConfiguration s)
public static string NameFor(MovieConfiguration? m, string styleString) => NameFor(m, styleString, false, true);

[NotNull]
public static string DirectoryNameFor(MovieConfiguration? m, string styleString) => NameFor(m, styleString, false, false);
public static string DirectoryNameFor(MovieConfiguration? m, string styleString)
{
if (styleString.StartsWith("{collectionFolder}", StringComparison.OrdinalIgnoreCase))
{
if (m?.InCollection ?? false)
{
return m.CachedMovie?.CollectionName + "\\" + NameFor(m, styleString.RemoveFirst("{collectionFolder}/".Length), false, false);
}
return NameFor(m, styleString.RemoveFirst("{collectionFolder}/".Length), false, false);
}
return NameFor(m, styleString, false, false);
}

[NotNull]
public static string NameFor(MovieConfiguration m, string styleString, string? extension)
{
Expand Down Expand Up @@ -84,7 +96,7 @@ public static string NameFor(MovieConfiguration? m, string styleString, bool url
name = name.ReplaceInsensitive("{Imdb}", m.CachedMovie?.Imdb);
name = name.ReplaceInsensitive("{CollectionName}", m.CachedMovie?.CollectionName);
name = name.ReplaceInsensitive("{MovieType}", m.CachedMovie?.MovieType);
return isfilename ? TVSettings.DirectoryFriendly(name.Trim()) : name.Trim();
return isfilename ? TVSettings.Instance.FilenameFriendly(name.Trim()) : TVSettings.DirectoryFriendly(name.Trim());
}

[NotNull]
Expand Down

0 comments on commit c2b39ff

Please sign in to comment.