Merge pull request #336 from Radarr/patch/add-imdb-to-naming

Add IMDb ID to file naming
pull/2/head
Devin Buhl 8 years ago committed by GitHub
commit cbb2b778a6

@ -161,6 +161,7 @@ namespace NzbDrone.Core.Organizer
AddMovieTokens(tokenHandlers, movie);
AddReleaseDateTokens(tokenHandlers, movie.Year); //In case we want to separate the year
AddImdbIdTokens(tokenHandlers, movie.ImdbId);
AddQualityTokens(tokenHandlers, movie, movieFile);
AddMediaInfoTokens(tokenHandlers, movieFile);
AddMovieFileTokens(tokenHandlers, movieFile);
@ -301,6 +302,7 @@ namespace NzbDrone.Core.Organizer
AddMovieTokens(tokenHandlers, movie);
AddReleaseDateTokens(tokenHandlers, movie.Year);
AddImdbIdTokens(tokenHandlers, movie.ImdbId);
return CleanFolderName(ReplaceTokens(namingConfig.MovieFolderFormat, tokenHandlers, namingConfig));
}
@ -477,6 +479,11 @@ namespace NzbDrone.Core.Organizer
tokenHandlers["{Release Year}"] = m => string.Format("{0}", releaseYear.ToString()); //Do I need m.CustomFormat?
}
private void AddImdbIdTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, string imdbId)
{
tokenHandlers["{IMDb Id}"] = m => $"{imdbId}";
}
private void AddSeasonTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, int seasonNumber)
{
tokenHandlers["{Season}"] = m => seasonNumber.ToString(m.CustomFormat);
@ -508,6 +515,7 @@ namespace NzbDrone.Core.Organizer
{
tokenHandlers["{Original Title}"] = m => GetOriginalTitle(episodeFile);
tokenHandlers["{Original Filename}"] = m => GetOriginalFileName(episodeFile);
//tokenHandlers["{IMDb Id}"] = m =>
tokenHandlers["{Release Group}"] = m => episodeFile.ReleaseGroup ?? m.DefaultValue("Sonarr");
}

@ -47,7 +47,8 @@ namespace NzbDrone.Core.Organizer
_movie = new Movie
{
Title = "Movie Title",
Year = 2010
Year = 2010,
ImdbId = "tt0066921"
};
_standardSeries = new Series

@ -72,6 +72,7 @@
{{> MediaInfoNamingPartial}}
{{> ReleaseGroupNamingPartial}}
{{> OriginalTitleNamingPartial}}
{{> ImdbIdNamingPartial}}
{{> SeparatorNamingPartial}}
</ul>
</div>
@ -161,6 +162,7 @@
<ul class="dropdown-menu">
{{> MovieTitleNamingPartial}}
{{> ReleaseYearNamingPartial}}
{{> ImdbIdNamingPartial}}
</ul>
</div>
</div>

@ -0,0 +1 @@
<li><a href="#" data-token="IMDb Id">IMDb Id</a></li>
Loading…
Cancel
Save