New: Add TVDB URL in Kodi metadata

This commit is contained in:
Zippy79 2021-08-02 05:29:25 +09:00 committed by GitHub
parent 4bf3ab1511
commit 155dbd4dd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 76 deletions

View File

@ -15,6 +15,7 @@ import ProviderFieldFormGroup from 'Components/Form/ProviderFieldFormGroup';
function EditMetadataModalContent(props) {
const {
advancedSettings,
isSaving,
saveError,
item,
@ -56,6 +57,7 @@ function EditMetadataModalContent(props) {
return (
<ProviderFieldFormGroup
key={field.name}
advancedSettings={advancedSettings}
provider="metadata"
{...field}
isDisabled={!enable.value}
@ -88,6 +90,7 @@ function EditMetadataModalContent(props) {
}
EditMetadataModalContent.propTypes = {
advancedSettings: PropTypes.bool.isRequired,
isSaving: PropTypes.bool.isRequired,
saveError: PropTypes.object,
item: PropTypes.object.isRequired,

View File

@ -9,9 +9,10 @@ import EditMetadataModalContent from './EditMetadataModalContent';
function createMapStateToProps() {
return createSelector(
(state) => state.settings.advancedSettings,
(state, { id }) => id,
(state) => state.settings.metadata,
(id, metadata) => {
(advancedSettings, id, metadata) => {
const {
isSaving,
saveError,
@ -22,6 +23,7 @@ function createMapStateToProps() {
const settings = selectSettings(_.find(items, { id }), pendingChanges, saveError);
return {
advancedSettings,
id,
isSaving,
saveError,

View File

@ -137,12 +137,11 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
public override MetadataFileResult SeriesMetadata(Series series)
{
if (!Settings.SeriesMetadata)
{
return null;
}
var xmlResult = string.Empty;
_logger.Debug("Generating tvshow.nfo for: {0}", series.Title);
if (Settings.SeriesMetadata)
{
_logger.Debug("Generating Series Metadata for: {0}", series.Title);
var sb = new StringBuilder();
var xws = new XmlWriterSettings();
xws.OmitXmlDeclaration = true;
@ -214,12 +213,23 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
var doc = new XDocument(tvShow);
doc.Save(xw);
_logger.Debug("Saving tvshow.nfo for {0}", series.Title);
return new MetadataFileResult("tvshow.nfo", doc.ToString());
xmlResult += doc.ToString();
}
}
if (Settings.SeriesMetadataUrl)
{
if (Settings.SeriesMetadata)
{
xmlResult += Environment.NewLine;
}
xmlResult += "https://www.thetvdb.com/?tab=series&id=" + series.TvdbId;
}
return xmlResult == string.Empty ? null : new MetadataFileResult("tvshow.nfo", xmlResult);
}
public override MetadataFileResult EpisodeMetadata(Series series, EpisodeFile episodeFile)
{
if (!Settings.EpisodeMetadata)

View File

@ -19,25 +19,29 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
public XbmcMetadataSettings()
{
SeriesMetadata = true;
SeriesMetadataUrl = false;
EpisodeMetadata = true;
SeriesImages = true;
SeasonImages = true;
EpisodeImages = true;
}
[FieldDefinition(0, Label = "Series Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "tvshow.nfo")]
[FieldDefinition(0, Label = "Series Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "tvshow.nfo with full series metadata")]
public bool SeriesMetadata { get; set; }
[FieldDefinition(1, Label = "Episode Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "<filename>.nfo")]
[FieldDefinition(1, Label = "Series Metadata URL", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "tvshow.nfo with TheTVDB show URL (can be combined with 'Series Metadata')", Advanced = true)]
public bool SeriesMetadataUrl { get; set; }
[FieldDefinition(2, Label = "Episode Metadata", Type = FieldType.Checkbox, Section = MetadataSectionType.Metadata, HelpText = "<filename>.nfo")]
public bool EpisodeMetadata { get; set; }
[FieldDefinition(2, Label = "Series Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "fanart.jpg, poster.jpg, banner.jpg")]
[FieldDefinition(3, Label = "Series Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "fanart.jpg, poster.jpg, banner.jpg")]
public bool SeriesImages { get; set; }
[FieldDefinition(3, Label = "Season Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "season##-poster.jpg, season##-banner.jpg, season-specials-poster.jpg, season-specials-banner.jpg")]
[FieldDefinition(4, Label = "Season Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "season##-poster.jpg, season##-banner.jpg, season-specials-poster.jpg, season-specials-banner.jpg")]
public bool SeasonImages { get; set; }
[FieldDefinition(4, Label = "Episode Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "<filename>-thumb.jpg")]
[FieldDefinition(5, Label = "Episode Images", Type = FieldType.Checkbox, Section = MetadataSectionType.Image, HelpText = "<filename>-thumb.jpg")]
public bool EpisodeImages { get; set; }
public bool IsValid => true;