New: Add TMDB/IMDB url in Kodi metadata

pull/2/head
FuNK3Y 5 years ago committed by Devin Buhl
parent e8b658646a
commit fedf2326f0

@ -102,17 +102,12 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFile)
{
if (!Settings.MovieMetadata)
var xmlResult = string.Empty;
if (Settings.MovieMetadata)
{
return null;
}
_logger.Debug("Generating Movie Metadata for: {0}", Path.Combine(movie.Path, movieFile.RelativePath));
var watched = GetExistingWatchedStatus(movie, movieFile.RelativePath);
var xmlResult = string.Empty;
var sb = new StringBuilder();
var xws = new XmlWriterSettings();
xws.OmitXmlDeclaration = true;
@ -243,17 +238,20 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
xmlResult += doc.ToString();
xmlResult += Environment.NewLine;
}
}
if (Settings.MovieMetadataURL)
{
xmlResult += "https://www.themoviedb.org/movie/" + movie.TmdbId;
xmlResult += Environment.NewLine;
xmlResult += "https://www.imdb.com/title/" + movie.ImdbId;
xmlResult += Environment.NewLine;
}
var metadataFileName = GetMovieMetadataFilename(movieFile.RelativePath);
if (Settings.UseMovieNfo)
{
metadataFileName = "movie.nfo";
}
return new MetadataFileResult(metadataFileName, xmlResult.Trim(Environment.NewLine.ToCharArray()));
return xmlResult == string.Empty ? null : new MetadataFileResult(metadataFileName, xmlResult.Trim(Environment.NewLine.ToCharArray()));
}
public override List<ImageFileResult> MovieImages(Movie movie)
@ -278,9 +276,16 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
}
private string GetMovieMetadataFilename(string movieFilePath)
{
if (Settings.UseMovieNfo)
{
return Path.Combine(Path.GetDirectoryName(movieFilePath), "movie.nfo");
}
else
{
return Path.ChangeExtension(movieFilePath, "nfo");
}
}
private bool GetExistingWatchedStatus(Movie movie, string movieFilePath)
{

@ -19,6 +19,7 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
public XbmcMetadataSettings()
{
MovieMetadata = true;
MovieMetadataURL = true;
MovieImages = true;
UseMovieNfo = false;
}
@ -26,10 +27,13 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
[FieldDefinition(0, Label = "Movie Metadata", Type = FieldType.Checkbox)]
public bool MovieMetadata { get; set; }
[FieldDefinition(1, Label = "Movie Images", Type = FieldType.Checkbox)]
[FieldDefinition(1, Label = "Movie Metadata URL", Type = FieldType.Checkbox, HelpText = "Radarr will write the tmdb/imdb url in the .nfo file", Advanced = true)]
public bool MovieMetadataURL { get; set; }
[FieldDefinition(2, Label = "Movie Images", Type = FieldType.Checkbox)]
public bool MovieImages { get; set; }
[FieldDefinition(2, Label = "Use Movie.nfo", Type = FieldType.Checkbox, HelpText = "Radarr will write metadata to movie.nfo instead of the default <movie-filename>.nfo")]
[FieldDefinition(3, Label = "Use Movie.nfo", Type = FieldType.Checkbox, HelpText = "Radarr will write metadata to movie.nfo instead of the default <movie-filename>.nfo")]
public bool UseMovieNfo { get; set; }
public bool IsValid => true;

Loading…
Cancel
Save