Make maximum description length configurable
This commit is contained in:
@@ -31,6 +31,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
||||
CollectionTitle = string.Empty;
|
||||
_tubeArchivistUrl = string.Empty;
|
||||
TubeArchivistApiKey = string.Empty;
|
||||
MaxDescriptionLength = 500;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,5 +67,10 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
||||
/// Gets or sets TubeArchivist API key.
|
||||
/// </summary>
|
||||
public string TubeArchivistApiKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets maximum series and episodes overviews length.
|
||||
/// </summary>
|
||||
public int MaxDescriptionLength { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
<input id="TubeArchivistApiKey" name="TubeArchivistApiKey" type="text" is="emby-input" />
|
||||
<div class="fieldDescription">TubeArchivist API key</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="MaxDescriptionLength">Maximum overviews length</label>
|
||||
<input id="MaxDescriptionLength" name="MaxDescriptionLength" type="number" is="emby-input" min="0" />
|
||||
<div class="fieldDescription">This is the maximum length of the descriptions showed in series and episodes</div>
|
||||
</div>
|
||||
<div>
|
||||
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
|
||||
<span>Save</span>
|
||||
@@ -47,6 +52,7 @@
|
||||
document.querySelector('#CollectionTitle').value = config.CollectionTitle;
|
||||
document.querySelector('#TubeArchivistUrl').value = config.TubeArchivistUrl;
|
||||
document.querySelector('#TubeArchivistApiKey').value = config.TubeArchivistApiKey;
|
||||
document.querySelector('#MaxDescriptionLength').value = config.MaxDescriptionLength;
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
@@ -58,6 +64,7 @@
|
||||
config.CollectionTitle = document.querySelector('#CollectionTitle').value;
|
||||
config.TubeArchivistUrl = document.querySelector('#TubeArchivistUrl').value;
|
||||
config.TubeArchivistApiKey = document.querySelector('#TubeArchivistApiKey').value;
|
||||
config.MaxDescriptionLength = document.querySelector('#MaxDescriptionLength').value;
|
||||
ApiClient.updatePluginConfiguration(TAMetadataConfig.pluginUniqueId, config).then(function (result) {
|
||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||
});
|
||||
|
||||
@@ -7,8 +7,6 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
|
||||
/// </summary>
|
||||
public static class Utils
|
||||
{
|
||||
private static int maxDescriptionChars = 500;
|
||||
|
||||
/// <summary>
|
||||
/// Sanitize the given URL.
|
||||
/// </summary>
|
||||
@@ -41,7 +39,13 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
|
||||
/// <returns>A string with \n replaced by br tags.</returns>
|
||||
public static string FormatDescription(string description)
|
||||
{
|
||||
return description.Replace("\n", "<br>", System.StringComparison.CurrentCulture).Substring(0, maxDescriptionChars);
|
||||
var maxLength = 500;
|
||||
if (Plugin.Instance != null)
|
||||
{
|
||||
maxLength = Plugin.Instance.Configuration.MaxDescriptionLength;
|
||||
}
|
||||
|
||||
return description.Replace("\n", "<br>", System.StringComparison.CurrentCulture).Substring(0, maxLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user