mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Merge pull request #336 from Radarr/patch/add-imdb-to-naming
Add IMDb ID to file naming
This commit is contained in:
commit
cbb2b778a6
@ -161,6 +161,7 @@ public string BuildFileName(Movie movie, MovieFile movieFile, NamingConfig namin
|
||||
|
||||
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 @@ public string GetMovieFolder(Movie movie, NamingConfig namingConfig = null)
|
||||
|
||||
AddMovieTokens(tokenHandlers, movie);
|
||||
AddReleaseDateTokens(tokenHandlers, movie.Year);
|
||||
AddImdbIdTokens(tokenHandlers, movie.ImdbId);
|
||||
|
||||
return CleanFolderName(ReplaceTokens(namingConfig.MovieFolderFormat, tokenHandlers, namingConfig));
|
||||
}
|
||||
@ -477,6 +479,11 @@ private void AddReleaseDateTokens(Dictionary<string, Func<TokenMatch, string>> t
|
||||
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 @@ private void AddMovieFileTokens(Dictionary<string, Func<TokenMatch, string>> tok
|
||||
{
|
||||
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 @@ public FileNameSampleService(IBuildFileNames buildFileNames)
|
||||
_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…
Reference in New Issue
Block a user