Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 347b2131db | |||
| 5a7b43f6e9 | |||
| 6f6cb3dab6 | |||
| 80b236d643 | |||
| 8b491ee673 | |||
| 7e6a757aa1 | |||
| c3b2512f6a | |||
| df36579616 | |||
| 46088c2373 | |||
| f9a82e2109 | |||
| 7436c8643c | |||
| c1969a949c | |||
| a2429c89ff | |||
| 06860f43fc | |||
| d03ee06947 | |||
| a3cf4564b4 | |||
| 57263ee789 |
@@ -0,0 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>1.2.2.0</Version>
|
||||
<AssemblyVersion>1.2.2.0</AssemblyVersion>
|
||||
<FileVersion>1.2.2.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
|
||||
}
|
||||
else
|
||||
{
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url)), cancellationToken).ConfigureAwait(false);
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url).TrimEnd('/')), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
|
||||
}
|
||||
else
|
||||
{
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url)), cancellationToken).ConfigureAwait(false);
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url).TrimEnd('/')), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
|
||||
}
|
||||
else
|
||||
{
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url)), cancellationToken).ConfigureAwait(false);
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url).TrimEnd('/')), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
|
||||
}
|
||||
else
|
||||
{
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url)), cancellationToken).ConfigureAwait(false);
|
||||
return await Plugin.Instance.HttpClient.GetAsync(new Uri(Utils.SanitizeUrl(Plugin.Instance.Configuration.TubeArchivistUrl + url).TrimEnd('/')), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Utilities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -70,6 +71,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
/// Gets channel tags.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "channel_tags")]
|
||||
[JsonConverter(typeof(TagsJsonConverter))]
|
||||
public Collection<string> Tags { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -108,6 +110,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
return new Series
|
||||
{
|
||||
Name = Name,
|
||||
Overview = Utils.FormatDescription(Description),
|
||||
Studios = new[] { Name },
|
||||
ProviderIds = new Dictionary<string, string>()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom JsonConverter to handle tags list that could be null.
|
||||
/// </summary>
|
||||
public class TagsJsonConverter : JsonConverter
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType == typeof(Collection<string>);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
|
||||
{
|
||||
JToken token = JToken.Load(reader);
|
||||
var tags = new Collection<string>();
|
||||
|
||||
if (token.Type == JTokenType.Array)
|
||||
{
|
||||
var stringArray = token.ToObject<string[]>();
|
||||
if (stringArray != null)
|
||||
{
|
||||
foreach (var tag in stringArray)
|
||||
{
|
||||
tags.Add(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
var tags = (Collection<string>)(value ?? Array.Empty<string>());
|
||||
|
||||
writer.WriteStartArray();
|
||||
foreach (var tag in tags)
|
||||
{
|
||||
writer.WriteValue(tag);
|
||||
}
|
||||
|
||||
writer.WriteEndArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Utilities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -54,6 +55,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
/// Gets video tags.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "tags")]
|
||||
[JsonConverter(typeof(TagsJsonConverter))]
|
||||
public Collection<string> Tags { get; }
|
||||
|
||||
/// <summary>
|
||||
@@ -112,6 +114,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
return new Episode
|
||||
{
|
||||
Name = Title,
|
||||
Overview = Utils.FormatDescription(Description),
|
||||
SeasonName = Published.Year.ToString(CultureInfo.CurrentCulture),
|
||||
ParentIndexNumber = Published.Year,
|
||||
SeriesName = Channel.Name,
|
||||
|
||||
@@ -31,5 +31,26 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Utilities
|
||||
|
||||
return cleanedUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Format episodes and series descriptions replacing newlines with br tags.
|
||||
/// </summary>
|
||||
/// <param name="description">String to format.</param>
|
||||
/// <returns>A string with \n replaced by br tags.</returns>
|
||||
public static string FormatDescription(string description)
|
||||
{
|
||||
var maxLength = 500;
|
||||
if (Plugin.Instance != null)
|
||||
{
|
||||
maxLength = Plugin.Instance.Configuration.MaxDescriptionLength;
|
||||
}
|
||||
|
||||
if (description.Length > maxLength)
|
||||
{
|
||||
description = description.Replace("\n", "<br>", System.StringComparison.CurrentCulture).Substring(0, maxLength);
|
||||
}
|
||||
|
||||
return description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,14 @@ The plugin interacts with TubeArchivist APIs to fetch videos and channels metada
|
||||
## Configuration
|
||||
<p>This plugin requires that you have already an instance of TubeArchivist up and running.</p>
|
||||
Once installed, you have to configure the following parameters in the plugin configuration:
|
||||
- Collection display name
|
||||
- TubeArchivist instance address
|
||||
- TubeArchivist API key
|
||||
<ul>
|
||||
<li>Collection display name</li>
|
||||
<li>TubeArchivist instance address</li>
|
||||
<li>TubeArchivist API key</li>
|
||||
<li>Overviews length (channels and videos descriptions)</li>
|
||||
</ul>
|
||||
|
||||

|
||||

|
||||
|
||||
## Use the plugin
|
||||
<p>Using the plugin is very simple. Let's start from the beginning:</p>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: "TubeArchivistMetadata"
|
||||
guid: "dc97d0c6-28b0-4242-afb4-5833ae1b3715"
|
||||
version: "1.0.0.0"
|
||||
version: "1.2.2.0"
|
||||
targetAbi: "10.8.0.0"
|
||||
framework: "net6.0"
|
||||
overview: "Metadata for your TubeArchivist library on Jellyfin"
|
||||
@@ -13,4 +13,4 @@ owner: "DarkFighterLuke"
|
||||
artifacts:
|
||||
- "Jellyfin.Plugin.TubeArchivistMetadata.dll"
|
||||
changelog: >
|
||||
First release
|
||||
Fix bug on description length substringing
|
||||
|
||||
+34
-2
@@ -6,14 +6,46 @@
|
||||
"description": "A new and fully integrated way to manage metadata and organize your TubeArchivist library videos on Jellyfin.",
|
||||
"owner": "DarkFighterLuke",
|
||||
"overview": "Metadata for your TubeArchivist library on Jellyfin",
|
||||
"imageUrl": "logo.png",
|
||||
"imageUrl": "https://raw.githubusercontent.com/DarkFighterLuke/TubeArchivistMetadata/master/images/logo.png",
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.2.2.0",
|
||||
"changelog": "Fix bug on description length substringing\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/DarkFighterLuke/TubeArchivistMetadata/releases/download/v1.2.2/TubeArchivistMetadata-1.2.2.zip",
|
||||
"checksum": "82d04546916e1ba76d56de28e648447a",
|
||||
"timestamp": "2024-03-15 10:12:00"
|
||||
},
|
||||
{
|
||||
"version": "1.2.1.0",
|
||||
"changelog": "Make maximum description length configurable\nTruncate descriptions to 500 characters\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/DarkFighterLuke/TubeArchivistMetadata/releases/download/v1.2.1/TubeArchivistMetadata-1.2.1.zip",
|
||||
"checksum": "cf68d169956f166a6ee68a06192651c2",
|
||||
"timestamp": "2024-03-14 21:50:00"
|
||||
},
|
||||
{
|
||||
"version": "1.2.0.0",
|
||||
"changelog": "Add episodes and series overview\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/DarkFighterLuke/TubeArchivistMetadata/releases/download/v1.2.0/TubeArchivistMetadata-1.2.0.zip",
|
||||
"checksum": "75812a4464bf68c43fb9dcdb74d924e3",
|
||||
"timestamp": "2024-03-14 20:00:00"
|
||||
},
|
||||
{
|
||||
"version": "1.1.1.0",
|
||||
"changelog": "Handle empty tags for videos and channels\nFix URL by removing trailing slash for images\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/DarkFighterLuke/TubeArchivistMetadata/releases/download/v1.1.1/TubeArchivistMetadata-1.1.1.zip",
|
||||
"checksum": "84ce752ce662e834690512c88ba48664",
|
||||
"timestamp": "2024-03-14 16:35:00"
|
||||
},
|
||||
{
|
||||
"version": "1.1.0.0",
|
||||
"changelog": "Fix field name and add placeholders\nFix URL in logs after redirection\nAdd schema to TubeArchivist URL if not present in settings\nFix a particular case\nLog configuration settings at initialization\nSanitize URLs\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/DarkFighterLuke/TubeArchivistMetadata/releases/download/v1.1.0/TubeArchivistMetadata-1.1.0.zip",
|
||||
"checksum": "167f1aa170e0426fd918c37a647aa882",
|
||||
"checksum": "de4b6562973b7f75b6afe3a441bb0e19",
|
||||
"timestamp": "2024-03-13 15:02:00"
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user