Compare commits
117 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 80a1b6050d | |||
| a4942e78b6 | |||
| 48070f311e | |||
| 96a72ab909 | |||
| 9c6aa56db0 | |||
| 413f45046d | |||
| 5ad6b2a381 | |||
| 795047a50e | |||
| 323a208de2 | |||
| 55d320c456 | |||
| d5f2f0ae8e | |||
| c3bdfc26ea | |||
| c6f7f79385 | |||
| 53ede13f54 | |||
| eeda7dd91e | |||
| 867fbbae5b | |||
| 76ac750de2 | |||
| ddbbb4ba25 | |||
| 3fca2d1e09 | |||
| 4f2f6c0429 | |||
| ebb2cdfcc6 | |||
| c058a35abe | |||
| 11eb456c56 | |||
| 4db1ce755a | |||
| a424721d93 | |||
| 16598bb86e | |||
| 98472b5aa6 | |||
| ab96b227a1 | |||
| 5ff96113c8 | |||
| 6697f2b4cc | |||
| a45ef87f84 | |||
| 157facdceb | |||
| be8481c795 | |||
| bd0a8371a5 | |||
| a75c474647 | |||
| 1dd7019676 | |||
| 355576c283 | |||
| 9091cdbe5b | |||
| a162ebb25d | |||
| 36eec27d9f | |||
| 2fee654efe | |||
| ce8aea629b | |||
| a8f821625b | |||
| 6cb2d89b95 | |||
| 080f3856b7 | |||
| b436ae13a1 | |||
| dce122840c | |||
| 9129bbda71 | |||
| 698237a77a | |||
| 0bb2cb1108 | |||
| 286d43c840 | |||
| 622079c887 | |||
| c9cc4f150e | |||
| 52342b3dc3 | |||
| 9fff31c451 | |||
| 233595baac | |||
| a968ae838c | |||
| 44d00af16f | |||
| 8edb8c9202 | |||
| 625b6b6958 | |||
| 6e76761994 | |||
| b07ffb2a83 | |||
| b3ef252edb | |||
| 4ffdbaf7f8 | |||
| fc221e4407 | |||
| b65f6332cb | |||
| 1a3fa6e823 | |||
| 962794c62c | |||
| 9a40ba93e8 | |||
| fd4a9a0130 | |||
| cc28016984 | |||
| 9179ea8602 | |||
| 6675f7f762 | |||
| 8b49afad25 | |||
| e355c304a2 | |||
| 2bdee20beb | |||
| a085a5a4bf | |||
| 3f0267ced0 | |||
| 70123f597a | |||
| b4d6ea2646 | |||
| e0ef8b1e86 | |||
| 362582dddf | |||
| 1c49427761 | |||
| 49effb3d3f | |||
| 66e6a49cc7 | |||
| 3dca19c3e5 | |||
| 55ab16a01a | |||
| 08c8df0292 | |||
| 1a8f3b1aa7 | |||
| 59bfaa077e | |||
| 9635a49c06 | |||
| 00eeff552c | |||
| 4294e7d138 | |||
| b2c7ba6509 | |||
| 81895dadab | |||
| 59710b2aba | |||
| f34db507b0 | |||
| a2432beaa2 | |||
| c908ea5b9c | |||
| e61beea66b | |||
| 61b3849406 | |||
| cb9f79b3fa | |||
| cf7cdb1ab3 | |||
| f202240fe6 | |||
| b9d0aeeb05 | |||
| 46ac3cfdfa | |||
| a00060ca9c | |||
| c3f5248c80 | |||
| 9921dd2308 | |||
| 1fcbbba49f | |||
| 4557ab6efd | |||
| 9febfef12a | |||
| 8842a5fdf9 | |||
| 40d5c90c4c | |||
| 634b3f7dc7 | |||
| 195acd2f1b | |||
| 14032d3ed3 |
@@ -15,8 +15,12 @@ body:
|
||||
options:
|
||||
- label: I'm running the latest version of tubearchivist-jf-plugin.
|
||||
required: true
|
||||
- label: I'm running the latest version of TubeArchivist.
|
||||
required: true
|
||||
- label: I have read the [how to open an issue](https://github.com/tubearchivist/tubearchivist/blob/master/CONTRIBUTING.md#how-to-open-an-issue) guide, particularly the [bug report](https://github.com/tubearchivist/tubearchivist/blob/master/CONTRIBUTING.md#bug-report) section.
|
||||
required: true
|
||||
- label: I have searched for both closed and open already existing issues about the problem I am reporting.
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: os
|
||||
|
||||
@@ -11,12 +11,13 @@ jobs:
|
||||
name: Build & Release
|
||||
permissions:
|
||||
contents: write
|
||||
packages: read
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
ref: master
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get release version
|
||||
@@ -26,7 +27,15 @@ jobs:
|
||||
- name: Setup .Net
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 6.0.x
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Add Jellyfin GitHub Nuget registry to sources
|
||||
run: |
|
||||
dotnet nuget add source \
|
||||
--username DarkFighterLuke \
|
||||
--password ${{ secrets.GITHUB_TOKEN }} \
|
||||
--store-password-in-clear-text \
|
||||
--name github https://nuget.pkg.github.com/jellyfin/index.json
|
||||
|
||||
- name: Get version number only
|
||||
run: |
|
||||
@@ -51,11 +60,12 @@ jobs:
|
||||
|
||||
|
||||
- name: Build Jellyfin Plugin
|
||||
uses: oddstr13/jellyfin-plugin-repository-manager@843260fcdfda7cba229c5abd77bdd9c6fc4e850b # v1.1.0
|
||||
uses: DarkFighterLuke/jellyfin-plugin-repository-manager@7a96768accc155ac7b597351b5033532f3c48173
|
||||
id: jprm
|
||||
with:
|
||||
dotnet-target: net6.0
|
||||
dotnet-target: net8.0
|
||||
version: ${VERSION}
|
||||
update-manifest: "true"
|
||||
|
||||
- name: Create release
|
||||
uses: ncipollo/release-action@v1
|
||||
@@ -67,10 +77,10 @@ jobs:
|
||||
tag: ${{ steps.newtag.outputs.tag }}
|
||||
allowUpdates: true
|
||||
|
||||
- name: Update manifest.json
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
- name: Commit manifest.json
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
branch: master
|
||||
commit_message: "Update manifest.json"
|
||||
file_pattern: manifest.json
|
||||
skip_fetch: true
|
||||
add: manifest.json
|
||||
commit: --signoff
|
||||
message: "Update manifest.json"
|
||||
pull: "--no-rebase -X ours origin master"
|
||||
|
||||
@@ -3,3 +3,4 @@ obj/
|
||||
.vs/
|
||||
.idea/
|
||||
artifacts
|
||||
nuget.config
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>1.2.3.0</Version>
|
||||
<AssemblyVersion>1.2.3.0</AssemblyVersion>
|
||||
<FileVersion>1.2.3.0</FileVersion>
|
||||
<Version>1.3.7.0</Version>
|
||||
<AssemblyVersion>1.3.7.0</AssemblyVersion>
|
||||
<FileVersion>1.3.7.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Utilities;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -13,6 +15,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
||||
{
|
||||
private ILogger _logger;
|
||||
private string _tubeArchivistUrl;
|
||||
private string _tubeArchivistApiKey;
|
||||
private HashSet<string> _jfUsernamesTo;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PluginConfiguration"/> class.
|
||||
@@ -30,8 +34,13 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
||||
|
||||
CollectionTitle = string.Empty;
|
||||
_tubeArchivistUrl = string.Empty;
|
||||
TubeArchivistApiKey = string.Empty;
|
||||
_tubeArchivistApiKey = string.Empty;
|
||||
MaxDescriptionLength = 500;
|
||||
JFTASync = false;
|
||||
JFUsernameFrom = string.Empty;
|
||||
TAJFSync = false;
|
||||
_jfUsernamesTo = new HashSet<string>();
|
||||
TAJFTaskInterval = 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,17 +69,92 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
|
||||
_logger.LogInformation("{Message}", "Given TubeArchivist URL contains no schema. Adding http://...");
|
||||
_tubeArchivistUrl = Utils.SanitizeUrl("http://" + value);
|
||||
}
|
||||
|
||||
Plugin.Instance?.LogTAApiConnectionStatus();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets TubeArchivist API key.
|
||||
/// </summary>
|
||||
public string TubeArchivistApiKey { get; set; }
|
||||
public string TubeArchivistApiKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tubeArchivistApiKey;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_tubeArchivistApiKey = value;
|
||||
Plugin.Instance?.LogTAApiConnectionStatus();
|
||||
Plugin.Instance?.UpdateAuthorizationHeader(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets maximum series and episodes overviews length.
|
||||
/// </summary>
|
||||
public int MaxDescriptionLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to enable TA->JF playback progress synchronization.
|
||||
/// </summary>
|
||||
public bool TAJFSync { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to enable JF->TA playback progress synchronization.
|
||||
/// </summary>
|
||||
public bool JFTASync { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the playback progress owner Jellyfin username to synchronize data to TubeArchivist.
|
||||
/// </summary>
|
||||
public string JFUsernameFrom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the playback progress owners Jellyfin usernames to synchronize data from TubeArchivist.
|
||||
/// </summary>
|
||||
public string JFUsernamesTo
|
||||
{
|
||||
get
|
||||
{
|
||||
_logger.LogDebug("JFUsernamesTo configured: {Message}", string.Join(", ", _jfUsernamesTo));
|
||||
return string.Join(", ", _jfUsernamesTo);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
// Clear existing usernames
|
||||
_jfUsernamesTo.Clear();
|
||||
|
||||
// Split by comma, then trim each part to remove leading/trailing spaces
|
||||
foreach (var username in value.Split(','))
|
||||
{
|
||||
var trimmedUsername = username.Trim();
|
||||
if (!string.IsNullOrEmpty(trimmedUsername))
|
||||
{
|
||||
_jfUsernamesTo.Add(trimmedUsername);
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogDebug("Set JFUsernamesTo to: {Message}", string.Join(", ", _jfUsernamesTo));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the interval in seconds at which the TubeArchivist to Jellyfin playback progress synchronization task should run.
|
||||
/// It requires Jellyfin server restart to take effect.
|
||||
/// </summary>
|
||||
public int TAJFTaskInterval { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the playback progress owners Jellyfin usernames to synchronize data from TubeArchivist.
|
||||
/// </summary>
|
||||
/// <returns>An array of usernames.</returns>
|
||||
public HashSet<string> GetJFUsernamesToArray()
|
||||
{
|
||||
return _jfUsernamesTo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Template</title>
|
||||
<title>TubeArchivistMetadata</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -12,25 +12,72 @@
|
||||
<div data-role="content">
|
||||
<div class="content-primary">
|
||||
<form id="TemplateConfigForm">
|
||||
<div>
|
||||
<h1>TubeArchivistMetadata</h1>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="CollectionTitle">Collection Title</label>
|
||||
<input id="CollectionTitle" name="CollectionTitle" type="text" is="emby-input" placeholder="eg. YouTube" />
|
||||
<input id="CollectionTitle" name="CollectionTitle" type="text" is="emby-input"
|
||||
placeholder="eg. YouTube" />
|
||||
<div class="fieldDescription">TubeArchivist collection display name</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="TubeArchivistUrl">TubeArchivist URL</label>
|
||||
<input id="TubeArchivistUrl" name="TubeArchivistUrl" type="text" is="emby-input" placeholder="http://..." />
|
||||
<input id="TubeArchivistUrl" name="TubeArchivistUrl" type="text" is="emby-input"
|
||||
placeholder="http://..." />
|
||||
<div class="fieldDescription">TubeArchivist URL</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="TubeArchivistApiKey">TubeArchivist API key</label>
|
||||
<label class="inputLabel inputLabelUnfocused" for="TubeArchivistApiKey">TubeArchivist API
|
||||
key</label>
|
||||
<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>
|
||||
<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>
|
||||
<h2>Playback synchronization</h2>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label" for="JFTASync">
|
||||
<input id="JFTASync" name="JFTASync" type="checkbox" is="emby-checkbox" />
|
||||
<span>Synchronize Jellyfin playback progress to TubeArchivist</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="JFUsernameFrom">Jellyfin username to sync
|
||||
playback status from</label>
|
||||
<input id="JFUsernameFrom" name="JFUsernameFrom" type="text" is="emby-input"
|
||||
placeholder="Username1, username2, ..." />
|
||||
<div class="fieldDescription">This is the Jellyfin username to synchronize data from on
|
||||
TubeArchivist</div>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label class="emby-checkbox-label" for="TAJFSync">
|
||||
<input id="TAJFSync" name="TAJFSync" type="checkbox" is="emby-checkbox" />
|
||||
<span>Synchronize TubeArchivist playback progress to Jellyfin</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="JFUsernamesTo">Jellyfin usernames to sync
|
||||
playback status to</label>
|
||||
<input id="JFUsernamesTo" name="JFUsernamesTo" type="text" is="emby-input"
|
||||
placeholder="Username1, username2, ..." />
|
||||
<div class="fieldDescription">These are the (comma separated) Jellyfin usernames to synchronize
|
||||
data from TubeArchivist</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="TAJFTaskInterval">TubeArchivist to Jellyfin
|
||||
playback progress synchronization interval</label>
|
||||
<input id="TAJFTaskInterval" name="TAJFTaskInterval" type="number" is="emby-input" min="1" />
|
||||
<div class="fieldDescription">This is the TubeArchivist to Jellyfin playback progress
|
||||
synchronization interval in seconds (Jellyfin restart required).</div>
|
||||
</div>
|
||||
<div>
|
||||
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
|
||||
@@ -53,6 +100,11 @@
|
||||
document.querySelector('#TubeArchivistUrl').value = config.TubeArchivistUrl;
|
||||
document.querySelector('#TubeArchivistApiKey').value = config.TubeArchivistApiKey;
|
||||
document.querySelector('#MaxDescriptionLength').value = config.MaxDescriptionLength;
|
||||
document.querySelector('#JFTASync').checked = config.JFTASync;
|
||||
document.querySelector('#JFUsernamesTo').value = config.JFUsernamesTo;
|
||||
document.querySelector('#TAJFSync').checked = config.TAJFSync;
|
||||
document.querySelector('#JFUsernameFrom').value = config.JFUsernameFrom;
|
||||
document.querySelector('#TAJFTaskInterval').value = config.TAJFTaskInterval;
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
@@ -65,6 +117,11 @@
|
||||
config.TubeArchivistUrl = document.querySelector('#TubeArchivistUrl').value;
|
||||
config.TubeArchivistApiKey = document.querySelector('#TubeArchivistApiKey').value;
|
||||
config.MaxDescriptionLength = document.querySelector('#MaxDescriptionLength').value;
|
||||
config.JFTASync = document.querySelector('#JFTASync').checked;
|
||||
config.JFUsernamesTo = document.querySelector('#JFUsernamesTo').value;
|
||||
config.TAJFSync = document.querySelector('#TAJFSync').checked;
|
||||
config.JFUsernameFrom = document.querySelector('#JFUsernameFrom').value;
|
||||
config.TAJFTaskInterval = document.querySelector('#TAJFTaskInterval').value;
|
||||
ApiClient.updatePluginConfiguration(TAMetadataConfig.pluginUniqueId, config).then(function (result) {
|
||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>Jellyfin.Plugin.TubeArchivistMetadata</RootNamespace>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
@@ -11,8 +11,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.8.13" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.8.13" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.10.0" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.10.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Configuration;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Tasks;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Utilities;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Plugins;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata
|
||||
@@ -16,13 +27,29 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
|
||||
/// </summary>
|
||||
public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
|
||||
{
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Plugin"/> class.
|
||||
/// </summary>
|
||||
/// <param name="applicationPaths">Instance of the <see cref="IApplicationPaths"/> interface.</param>
|
||||
/// <param name="xmlSerializer">Instance of the <see cref="IXmlSerializer"/> interface.</param>
|
||||
/// <param name="logger">Instance of the <see cref="ILogger"/> interface.</param>
|
||||
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer, ILogger<Plugin> logger)
|
||||
/// <param name="sessionManager">Instance of the <see cref="ISessionManager"/> interface.</param>
|
||||
/// <param name="libraryManager">Instance of the <see cref="ILibraryManager"/> interface.</param>
|
||||
/// <param name="taskManager">Instance of the <see cref="ITaskManager"/> interface.</param>
|
||||
/// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param>
|
||||
/// <param name="userDataManager">Instance of the <see cref="IUserDataManager"/> interface.</param>
|
||||
public Plugin(
|
||||
IApplicationPaths applicationPaths,
|
||||
IXmlSerializer xmlSerializer,
|
||||
ILogger<Plugin> logger,
|
||||
ISessionManager sessionManager,
|
||||
ILibraryManager libraryManager,
|
||||
ITaskManager taskManager,
|
||||
IUserManager userManager,
|
||||
IUserDataManager userDataManager)
|
||||
: base(applicationPaths, xmlSerializer)
|
||||
{
|
||||
Instance = this;
|
||||
@@ -31,9 +58,36 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
|
||||
handler.AllowAutoRedirect = false;
|
||||
handler.CheckCertificateRevocationList = true;
|
||||
HttpClient = new HttpClient(handler);
|
||||
HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Token", Instance?.Configuration.TubeArchivistApiKey);
|
||||
UpdateAuthorizationHeader(Configuration.TubeArchivistApiKey);
|
||||
|
||||
SessionManager = sessionManager;
|
||||
sessionManager.PlaybackProgress += OnPlaybackProgress;
|
||||
LibraryManager = libraryManager;
|
||||
_userManager = userManager;
|
||||
_userDataManager = userDataManager;
|
||||
userDataManager.UserDataSaved += OnWatchedStatusChange;
|
||||
|
||||
var taToJellyfinProgressSyncTask = new TAToJellyfinProgressSyncTask(logger, libraryManager, userManager, userDataManager);
|
||||
var jfToTubearchivistProgressSyncTask = new JFToTubearchivistProgressSyncTask(logger, libraryManager, userManager, userDataManager);
|
||||
var isTAJFTaskPresent = taskManager.ScheduledTasks.Any(t => t.Name.Equals(taToJellyfinProgressSyncTask.Name, StringComparison.Ordinal));
|
||||
if (Instance!.Configuration.TAJFSync && !isTAJFTaskPresent)
|
||||
{
|
||||
logger.LogInformation("Queueing task {TaskName}.", taToJellyfinProgressSyncTask.Name);
|
||||
taskManager.AddTasks([taToJellyfinProgressSyncTask]);
|
||||
taskManager.Execute<TAToJellyfinProgressSyncTask>();
|
||||
}
|
||||
|
||||
var isJFTATaskPresent = taskManager.ScheduledTasks.Any(t => t.Name.Equals(jfToTubearchivistProgressSyncTask.Name, StringComparison.Ordinal));
|
||||
if (Instance!.Configuration.JFTASync && !isJFTATaskPresent)
|
||||
{
|
||||
logger.LogInformation("Queueing task {TaskName}.", jfToTubearchivistProgressSyncTask.Name);
|
||||
taskManager.AddTasks([jfToTubearchivistProgressSyncTask]);
|
||||
taskManager.Execute<JFToTubearchivistProgressSyncTask>();
|
||||
}
|
||||
|
||||
logger.LogInformation("{Message}", "Collection display name: " + Instance?.Configuration.CollectionTitle);
|
||||
logger.LogInformation("{Message}", "TubeArchivist API URL: " + Instance?.Configuration.TubeArchivistUrl);
|
||||
logger.LogInformation("{Message}", "Pinging TubeArchivist API...");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -57,6 +111,16 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
|
||||
/// </summary>
|
||||
public HttpClient HttpClient { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SessionManager used globally by the plugin.
|
||||
/// </summary>
|
||||
public ISessionManager SessionManager { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LibraryManager used globally by the plugin.
|
||||
/// </summary>
|
||||
public ILibraryManager LibraryManager { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<PluginPageInfo> GetPages() => new[]
|
||||
{
|
||||
@@ -66,5 +130,120 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
|
||||
EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Configuration.configPage.html", GetType().Namespace)
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Updates the HTTP client's Authorization header with the current API key.
|
||||
/// </summary>
|
||||
/// <param name="apiKey">TubeArchivist API key.</param>
|
||||
public void UpdateAuthorizationHeader(string apiKey)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(apiKey))
|
||||
{
|
||||
HttpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Token", apiKey);
|
||||
Logger.LogInformation("{Message}", "Updated Authorization header with API key");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("{Message}", "No TubeArchivist API key configured");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the TubeArchivist API connection status.
|
||||
/// </summary>
|
||||
public void LogTAApiConnectionStatus()
|
||||
{
|
||||
Logger.LogInformation("{Message}", "Ping...");
|
||||
|
||||
var api = TubeArchivistApi.GetInstance();
|
||||
Task.Run(() => api.Ping()).ContinueWith(
|
||||
task =>
|
||||
{
|
||||
if (task.Result != null)
|
||||
{
|
||||
Logger.LogInformation("{Message}", "TubeArchivist API said: " + task.Result.Response + "!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogCritical("{Message}", "TubeArchivist API was unreachable!");
|
||||
}
|
||||
},
|
||||
TaskScheduler.Default);
|
||||
}
|
||||
|
||||
private async void OnPlaybackProgress(object? sender, PlaybackProgressEventArgs eventArgs)
|
||||
{
|
||||
if (Instance!.Configuration.JFTASync && eventArgs.Users.Any(u => Instance!.Configuration.JFUsernameFrom.Equals(u.Username, StringComparison.Ordinal)))
|
||||
{
|
||||
BaseItem? season = LibraryManager.GetItemById(eventArgs.Item.ParentId);
|
||||
BaseItem? channel = LibraryManager.GetItemById(season!.ParentId);
|
||||
BaseItem? collection = LibraryManager.GetItemById(channel!.ParentId);
|
||||
if (collection?.Name.ToLower(CultureInfo.CurrentCulture) == Instance?.Configuration.CollectionTitle.ToLower(CultureInfo.CurrentCulture) && eventArgs.PlaybackPositionTicks != null)
|
||||
{
|
||||
long progress = (long)eventArgs.PlaybackPositionTicks / TimeSpan.TicksPerSecond;
|
||||
var videoId = Utils.GetVideoNameFromPath(eventArgs.Item.Path);
|
||||
var statusCode = await TubeArchivistApi.GetInstance().SetProgress(videoId, progress).ConfigureAwait(true);
|
||||
if (statusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
Logger.LogCritical("{Message}", $"POST /video/{videoId}/progress returned {statusCode} for video {eventArgs.Item.Name} with progress {progress} seconds");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnWatchedStatusChange(object? sender, UserDataSaveEventArgs eventArgs)
|
||||
{
|
||||
var user = _userManager.GetUserById(eventArgs.UserId);
|
||||
if (Configuration.JFTASync && user != null && Configuration.GetJFUsernamesToArray().Contains(user!.Username))
|
||||
{
|
||||
var isPlayed = eventArgs.Item.IsPlayed(user);
|
||||
Logger.LogDebug("User {UserId} changed watched status to {Status} for the item {ItemName}", eventArgs.UserId, isPlayed, eventArgs.Item.Name);
|
||||
string itemYTId;
|
||||
try
|
||||
{
|
||||
if (eventArgs.Item is Series)
|
||||
{
|
||||
itemYTId = Utils.GetChannelNameFromPath(eventArgs.Item.Path);
|
||||
}
|
||||
else if (eventArgs.Item is Episode)
|
||||
{
|
||||
itemYTId = Utils.GetVideoNameFromPath(eventArgs.Item.Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error while processing item path: {ItemPath}", eventArgs.Item.Path ?? "null");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var statusCode = await TubeArchivistApi.GetInstance().SetWatchedStatus(itemYTId, isPlayed).ConfigureAwait(true);
|
||||
if (statusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
Logger.LogCritical("POST /watched returned {StatusCode} for item {ItemName} ({VideoYTId}) with watched status {IsPlayed}", statusCode, eventArgs.Item.Name, itemYTId, isPlayed);
|
||||
}
|
||||
|
||||
if (eventArgs.Item is Episode)
|
||||
{
|
||||
var progress = _userDataManager.GetUserData(user, eventArgs.Item).PlaybackPositionTicks / TimeSpan.TicksPerSecond;
|
||||
var videoId = Utils.GetVideoNameFromPath(eventArgs.Item.Path);
|
||||
statusCode = await TubeArchivistApi.GetInstance().SetProgress(videoId, progress).ConfigureAwait(true);
|
||||
if (statusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
Logger.LogCritical("{Message}", $"POST /video/{videoId}/progress returned {statusCode} for video {eventArgs.Item.Name} with progress {progress} seconds");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogCritical("An exception occurred while calling POST /watched for item {ItemName} ({VideoYTId}) with watched status {IsPlayed}: {ExceptionMessage}", eventArgs.Item.Name, itemYTId, isPlayed, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
|
||||
{
|
||||
Name = video.Channel.Name,
|
||||
ImageUrl = video.Channel.ThumbUrl,
|
||||
Type = PersonType.Actor,
|
||||
Type = Data.Enums.PersonKind.Actor,
|
||||
});
|
||||
result.HasMetadata = true;
|
||||
result.Item = video.ToEpisode();
|
||||
|
||||
@@ -85,6 +85,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
|
||||
Type = ImageType.Banner,
|
||||
Url = channel.BannerUrl
|
||||
});
|
||||
list.Add(new RemoteImageInfo
|
||||
{
|
||||
ProviderName = Name,
|
||||
Type = ImageType.Backdrop,
|
||||
Url = channel.TvartUrl
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Providers
|
||||
{
|
||||
Name = channel.Name,
|
||||
ImageUrl = channel.ThumbUrl,
|
||||
Type = PersonType.Actor,
|
||||
Type = Data.Enums.PersonKind.Actor,
|
||||
});
|
||||
result.HasMetadata = true;
|
||||
result.Item = channel.ToSeries();
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Utilities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Task to sync Jellyfin playback progresses to TubeArchivist.
|
||||
/// </summary>
|
||||
public class JFToTubearchivistProgressSyncTask : IScheduledTask
|
||||
{
|
||||
private readonly ILogger<Plugin> _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JFToTubearchivistProgressSyncTask"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">Logger.</param>
|
||||
/// <param name="libraryManager">Library manager.</param>
|
||||
/// <param name="userManager">User manager.</param>
|
||||
/// <param name="userDataManager">User data manager.</param>
|
||||
public JFToTubearchivistProgressSyncTask(ILogger<Plugin> logger, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_libraryManager = libraryManager;
|
||||
_userManager = userManager;
|
||||
_userDataManager = userDataManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name => "JFToTubeArchivistProgressSyncTask";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Description => "This tasks syncs Jellyfin playback progresses to TubeArchivist";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Category => "TubeArchivistMetadata";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Key => "JFToTubeArchivistProgressSyncTask";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
progress.Report(0);
|
||||
if (Plugin.Instance!.Configuration.JFTASync)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
_logger.LogInformation("Starting Jellyfin->TubeArchivist playback progresses synchronization.");
|
||||
var taApi = TubeArchivistApi.GetInstance();
|
||||
var videosCount = 0;
|
||||
var jfUsername = Plugin.Instance!.Configuration.JFUsernameFrom;
|
||||
var user = _userManager.GetUserByName(jfUsername);
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogInformation("{Message}", $"Jellyfin user with username {jfUsername} not found");
|
||||
return;
|
||||
}
|
||||
|
||||
var collectionItem = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
Name = Plugin.Instance?.Configuration.CollectionTitle,
|
||||
IncludeItemTypes = new[] { BaseItemKind.CollectionFolder }
|
||||
}).FirstOrDefault();
|
||||
|
||||
if (collectionItem == null)
|
||||
{
|
||||
var message = $"Collection '{Plugin.Instance?.Configuration.CollectionTitle}' not found.";
|
||||
_logger.LogCritical("{Message}", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
var collection = (CollectionFolder)collectionItem;
|
||||
var channels = collection.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Series }
|
||||
});
|
||||
_logger.LogInformation("Analyzing collection {Id} with name {Name}", collectionItem.Id, collectionItem.Name);
|
||||
_logger.LogDebug("Found {Message} channels", channels.Count);
|
||||
|
||||
foreach (Series channel in channels)
|
||||
{
|
||||
var channelYTId = Utils.GetChannelNameFromPath(channel.Path);
|
||||
var years = channel.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Season }
|
||||
});
|
||||
_logger.LogDebug("Found {Years} years in channel {ChannelName}", years.Count, channel.Name);
|
||||
|
||||
foreach (Season year in years)
|
||||
{
|
||||
var videos = year.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Episode }
|
||||
});
|
||||
_logger.LogDebug("Found {Videos} videos in year {YearName} of the channel {ChannelName}", videos.Count, year.Name, channel.Name);
|
||||
videosCount += videos.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogInformation("Found a total of {VideosCount} videos", videosCount);
|
||||
|
||||
var processedVideosCount = 0;
|
||||
if (collectionItem == null)
|
||||
{
|
||||
var message = $"Collection '{Plugin.Instance?.Configuration.CollectionTitle}' not found.";
|
||||
_logger.LogCritical("{Message}", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
var collection = (CollectionFolder)collectionItem;
|
||||
var channels = collection.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Series }
|
||||
});
|
||||
|
||||
foreach (Series channel in channels)
|
||||
{
|
||||
var channelYTId = Utils.GetChannelNameFromPath(channel.Path);
|
||||
var isChannelWatched = false;
|
||||
var isChannelCheckedForWatched = false;
|
||||
var years = channel.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Season }
|
||||
});
|
||||
|
||||
foreach (Season year in years)
|
||||
{
|
||||
var videos = year.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Episode }
|
||||
});
|
||||
videosCount += videos.Count;
|
||||
|
||||
foreach (Episode video in videos)
|
||||
{
|
||||
var videoYTId = Utils.GetVideoNameFromPath(video.Path);
|
||||
_logger.LogInformation("{VideoYtId}", videoYTId);
|
||||
HttpStatusCode statusCode;
|
||||
|
||||
if (!isChannelCheckedForWatched && channel.IsPlayed(user))
|
||||
{
|
||||
var isChannelPlayed = channel.IsPlayed(user);
|
||||
statusCode = await taApi.SetWatchedStatus(channelYTId, isChannelPlayed).ConfigureAwait(true);
|
||||
if (statusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
_logger.LogCritical("{Message}", $"POST /watched returned {statusCode} for channel {channel.Name} ({channelYTId}) with wacthed status {isChannelPlayed}");
|
||||
}
|
||||
else
|
||||
{
|
||||
isChannelWatched = true;
|
||||
}
|
||||
|
||||
isChannelCheckedForWatched = true;
|
||||
}
|
||||
|
||||
if (!isChannelWatched)
|
||||
{
|
||||
var isVideoPlayed = video.IsPlayed(user);
|
||||
statusCode = await taApi.SetWatchedStatus(videoYTId, isVideoPlayed).ConfigureAwait(true);
|
||||
if (statusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
_logger.LogCritical("{Message}", $"POST /watched returned {statusCode} for video {video.Name} ({videoYTId}) with wacthed status {isVideoPlayed}");
|
||||
}
|
||||
|
||||
_logger.LogInformation("{Message}", isVideoPlayed);
|
||||
if (!isVideoPlayed)
|
||||
{
|
||||
var playbackProgress = _userDataManager.GetUserData(user, video).PlaybackPositionTicks / TimeSpan.TicksPerSecond;
|
||||
statusCode = await taApi.SetProgress(videoYTId, playbackProgress).ConfigureAwait(true);
|
||||
if (statusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
_logger.LogCritical("{Message}", $"POST /video/{videoYTId}/progress returned {statusCode} for video {video.Name} with progress {progress} seconds");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processedVideosCount++;
|
||||
progress.Report(processedVideosCount * 100 / videosCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogInformation("Time elapsed: {Time}", DateTime.Now - start);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("Jellyfin->TubeArchivist playback synchronization is currently disabled.");
|
||||
}
|
||||
|
||||
progress.Report(100);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
{
|
||||
return
|
||||
[
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerStartup,
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Utilities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Task to sync TubeArchivist playback progresses to Jellyfin.
|
||||
/// </summary>
|
||||
public class TAToJellyfinProgressSyncTask : IScheduledTask
|
||||
{
|
||||
private readonly ILogger<Plugin> _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TAToJellyfinProgressSyncTask"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">Logger.</param>
|
||||
/// <param name="libraryManager">Library manager.</param>
|
||||
/// <param name="userManager">User manager.</param>
|
||||
/// <param name="userDataManager">User data manager.</param>
|
||||
public TAToJellyfinProgressSyncTask(ILogger<Plugin> logger, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager)
|
||||
{
|
||||
_logger = logger;
|
||||
_libraryManager = libraryManager;
|
||||
_userManager = userManager;
|
||||
_userDataManager = userDataManager;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name => "TAToJellyfinProgressSyncTask";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Description => "This tasks syncs TubeArchivist playback progresses to Jellyfin";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Category => "TubeArchivistMetadata";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Key => "TAToJellyfinProgressSyncTask";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
progress.Report(0);
|
||||
if (Plugin.Instance!.Configuration.TAJFSync)
|
||||
{
|
||||
var start = DateTime.Now;
|
||||
_logger.LogInformation("Starting TubeArchivist->Jellyfin playback progresses synchronization.");
|
||||
var taApi = TubeArchivistApi.GetInstance();
|
||||
var videosCount = 0;
|
||||
foreach (var jfUsername in Plugin.Instance!.Configuration.GetJFUsernamesToArray())
|
||||
{
|
||||
var user = _userManager.GetUserByName(jfUsername);
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogInformation("{Message}", $"Jellyfin user with username {jfUsername} not found");
|
||||
continue;
|
||||
}
|
||||
|
||||
var collectionItem = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
Name = Plugin.Instance?.Configuration.CollectionTitle,
|
||||
IncludeItemTypes = new[] { BaseItemKind.CollectionFolder }
|
||||
}).FirstOrDefault();
|
||||
|
||||
if (collectionItem == null)
|
||||
{
|
||||
var message = $"Collection '{Plugin.Instance?.Configuration.CollectionTitle}' not found.";
|
||||
_logger.LogCritical("{Message}", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
var collection = (CollectionFolder)collectionItem;
|
||||
var channels = collection.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Series }
|
||||
});
|
||||
_logger.LogInformation("Analyzing collection {Id} with name {Name}", collectionItem.Id, collectionItem.Name);
|
||||
_logger.LogDebug("Found {Message} channels", channels.Count);
|
||||
|
||||
foreach (Series channel in channels)
|
||||
{
|
||||
var years = channel.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Season }
|
||||
});
|
||||
_logger.LogDebug("Found {Years} years in channel {ChannelName}", years.Count, channel.Name);
|
||||
|
||||
foreach (Season year in years)
|
||||
{
|
||||
var videos = year.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Episode }
|
||||
});
|
||||
_logger.LogDebug("Found {Videos} videos in year {YearName} of the channel {ChannelName}", videos.Count, year.Name, channel.Name);
|
||||
|
||||
videosCount += videos.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogInformation("Found a total of {VideosCount} videos", videosCount);
|
||||
|
||||
var processedVideosCount = 0;
|
||||
foreach (var jfUsername in Plugin.Instance!.Configuration.GetJFUsernamesToArray())
|
||||
{
|
||||
var user = _userManager.GetUserByName(jfUsername);
|
||||
if (user == null)
|
||||
{
|
||||
_logger.LogInformation("{Message}", $"Jellyfin user with username {jfUsername} not found");
|
||||
continue;
|
||||
}
|
||||
|
||||
var collectionItem = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
Name = Plugin.Instance?.Configuration.CollectionTitle,
|
||||
IncludeItemTypes = new[] { BaseItemKind.CollectionFolder }
|
||||
}).FirstOrDefault();
|
||||
|
||||
if (collectionItem == null)
|
||||
{
|
||||
var message = $"Collection '{Plugin.Instance?.Configuration.CollectionTitle}' not found.";
|
||||
_logger.LogCritical("{Message}", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
var collection = (CollectionFolder)collectionItem;
|
||||
var channels = collection.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Series }
|
||||
});
|
||||
|
||||
foreach (Series channel in channels)
|
||||
{
|
||||
var years = channel.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Season }
|
||||
});
|
||||
|
||||
foreach (Season year in years)
|
||||
{
|
||||
var videos = year.GetChildren(user, false, new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = new[] { BaseItemKind.Episode }
|
||||
});
|
||||
|
||||
foreach (Episode video in videos)
|
||||
{
|
||||
var playbackProgress = await taApi.GetProgress(Utils.GetVideoNameFromPath(video.Path)).ConfigureAwait(true);
|
||||
if (playbackProgress != null)
|
||||
{
|
||||
var userItemData = _userDataManager.GetUserData(user, video);
|
||||
var userUpdateData = new UpdateUserItemDataDto
|
||||
{
|
||||
PlaybackPositionTicks = playbackProgress.Position * TimeSpan.TicksPerSecond
|
||||
};
|
||||
|
||||
var taVideoInfo = await taApi.GetVideo(Utils.GetVideoNameFromPath(video.Path)).ConfigureAwait(true);
|
||||
if (taVideoInfo != null)
|
||||
{
|
||||
if (taVideoInfo.Player.IsWatched)
|
||||
{
|
||||
userUpdateData.Played = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
userUpdateData.Played = false;
|
||||
}
|
||||
}
|
||||
|
||||
_userDataManager.SaveUserData(user, video, userUpdateData, UserDataSaveReason.UpdateUserData);
|
||||
_logger.LogInformation("{Message}", $"Playback progress for video {video.Name} set to {userItemData.PlaybackPositionTicks / TimeSpan.TicksPerSecond} seconds for user {jfUsername}.");
|
||||
_logger.LogInformation("{Message}", $"Watched status for video {video.Name} set to {userItemData.Played} seconds for user {jfUsername}.");
|
||||
|
||||
processedVideosCount++;
|
||||
progress.Report(processedVideosCount * 100 / videosCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_logger.LogInformation("Time elapsed: {Time}", DateTime.Now - start);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("TubeArchivist->Jellyfin playback synchronization is currently disabled.");
|
||||
}
|
||||
|
||||
progress.Report(100);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
{
|
||||
return
|
||||
[
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
IntervalTicks = TimeSpan.FromSeconds(Plugin.Instance!.Configuration.TAJFTaskInterval).Ticks
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
{
|
||||
/// <summary>
|
||||
/// A class representing TubeArchivist API video watched status.
|
||||
/// </summary>
|
||||
public class Watched
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Watched"/> class.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the video/channel/playlist.</param>
|
||||
/// <param name="isWatched">Watched status.</param>
|
||||
public Watched(string id, bool isWatched)
|
||||
{
|
||||
Id = id;
|
||||
IsWatched = isWatched;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id of the video/channel/playlist.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "id")]
|
||||
public string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the item has been watched or not.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "is_watched")]
|
||||
public bool IsWatched { get; }
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -126,7 +126,9 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
Type = ImageType.Primary
|
||||
}
|
||||
},
|
||||
Tags = this.Tags.ToArray<string>()
|
||||
Tags = this.Tags != null ?
|
||||
this.Tags.ToArray<string>() :
|
||||
[]
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
{
|
||||
/// <summary>
|
||||
/// A class representing TubeArchivist API ping response data.
|
||||
/// </summary>
|
||||
public class PingResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingResponse"/> class.
|
||||
/// </summary>
|
||||
/// <param name="response">Response from the API ("pong").</param>
|
||||
/// <param name="user">TubeArchivist user id.</param>
|
||||
/// <param name="version">TubeArchivist version.</param>
|
||||
public PingResponse(
|
||||
string response,
|
||||
int user,
|
||||
string version)
|
||||
{
|
||||
this.Response = response;
|
||||
this.User = user;
|
||||
this.Version = version;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets response to the ping ("pong").
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "response")]
|
||||
public string Response { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets user id.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "user")]
|
||||
public int User { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets TubeArchivist version.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "version")]
|
||||
public string Version { get; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.TubeArchivistMetadata.Utilities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -64,7 +65,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
/// <returns>A task.</returns>
|
||||
public async Task<Channel?> GetChannel(string channelId)
|
||||
{
|
||||
ResponseContainer<Channel>? channel = null;
|
||||
Channel? channel = null;
|
||||
|
||||
var channelsEndpoint = "/api/channel/";
|
||||
var url = new Uri(Utils.SanitizeUrl(Plugin.Instance?.Configuration.TubeArchivistUrl + channelsEndpoint + channelId));
|
||||
@@ -81,10 +82,10 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string rawData = await response.Content.ReadAsStringAsync().ConfigureAwait(true);
|
||||
channel = JsonConvert.DeserializeObject<ResponseContainer<Channel>>(rawData);
|
||||
channel = JsonConvert.DeserializeObject<Channel>(rawData);
|
||||
}
|
||||
|
||||
return channel?.Data;
|
||||
return channel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -94,7 +95,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
/// <returns>A task.</returns>
|
||||
public async Task<Video?> GetVideo(string videoId)
|
||||
{
|
||||
ResponseContainer<Video>? video = null;
|
||||
Video? video = null;
|
||||
|
||||
var videosEndpoint = "/api/video/";
|
||||
var url = new Uri(Utils.SanitizeUrl(Plugin.Instance?.Configuration.TubeArchivistUrl + videosEndpoint + videoId));
|
||||
@@ -111,10 +112,94 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string rawData = await response.Content.ReadAsStringAsync().ConfigureAwait(true);
|
||||
video = JsonConvert.DeserializeObject<ResponseContainer<Video>>(rawData);
|
||||
_logger.LogInformation("{Message}", rawData);
|
||||
video = JsonConvert.DeserializeObject<Video>(rawData);
|
||||
}
|
||||
|
||||
return video?.Data;
|
||||
return video;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates connection and authentication to TubeArchivist.
|
||||
/// </summary>
|
||||
/// <returns>The ping response.</returns>
|
||||
public async Task<PingResponse?> Ping()
|
||||
{
|
||||
PingResponse? pong = null;
|
||||
|
||||
var pingEndpoint = "/api/ping/";
|
||||
var url = new Uri(Utils.SanitizeUrl(Plugin.Instance!.Configuration.TubeArchivistUrl + pingEndpoint));
|
||||
var response = await client.GetAsync(url).ConfigureAwait(true);
|
||||
|
||||
while (response.StatusCode == HttpStatusCode.Moved)
|
||||
{
|
||||
url = response.Headers.Location;
|
||||
_logger.LogInformation("{Message}", "Received redirect to: " + url);
|
||||
response = await client.GetAsync(url).ConfigureAwait(true);
|
||||
}
|
||||
|
||||
_logger.LogInformation("{Message}", url + ": " + response.StatusCode);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string rawData = await response.Content.ReadAsStringAsync().ConfigureAwait(true);
|
||||
pong = JsonConvert.DeserializeObject<PingResponse>(rawData);
|
||||
}
|
||||
|
||||
return pong;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send video playback progress to TubeArchivist.
|
||||
/// </summary>
|
||||
/// <param name="videoId">Video id.</param>
|
||||
/// <param name="progress">Progress in seconds.</param>
|
||||
/// <returns>The response <see cref="HttpStatusCode"/>.</returns>
|
||||
public async Task<HttpStatusCode> SetProgress(string videoId, long progress)
|
||||
{
|
||||
var progressEndpoint = $"/api/video/{videoId}/progress/";
|
||||
var url = new Uri(Utils.SanitizeUrl(Plugin.Instance!.Configuration.TubeArchivistUrl + progressEndpoint));
|
||||
var body = JsonConvert.SerializeObject(new Progress(progress));
|
||||
|
||||
var response = await client.PostAsync(url, new StringContent(body, Encoding.UTF8, "application/json")).ConfigureAwait(true);
|
||||
|
||||
return response.StatusCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send video playback progress to TubeArchivist.
|
||||
/// </summary>
|
||||
/// <param name="videoId">Video id.</param>
|
||||
/// <returns>Video playback progress data.</returns>
|
||||
public async Task<Progress?> GetProgress(string videoId)
|
||||
{
|
||||
Progress? progress = null;
|
||||
|
||||
var video = await GetVideo(videoId).ConfigureAwait(true);
|
||||
if (video != null)
|
||||
{
|
||||
progress = new Progress((long)video.Player.Position);
|
||||
_logger.LogInformation("{Message}", $"Retrieved progress {video.Player.Position}");
|
||||
}
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set video/channel/playlist as watched on TubeArchivist.
|
||||
/// </summary>
|
||||
/// <param name="itemId">Video/channel/playlist id.</param>
|
||||
/// <param name="isWatched">Whether the item has been watched or not.</param>
|
||||
/// <returns>The response <see cref="HttpStatusCode"/>.</returns>
|
||||
public async Task<HttpStatusCode> SetWatchedStatus(string itemId, bool isWatched)
|
||||
{
|
||||
var watchedEndpoint = $"/api/watched/";
|
||||
var url = new Uri(Utils.SanitizeUrl(Plugin.Instance!.Configuration.TubeArchivistUrl + watchedEndpoint));
|
||||
var body = JsonConvert.SerializeObject(new Watched(itemId, isWatched));
|
||||
|
||||
var response = await client.PostAsync(url, new StringContent(body, Encoding.UTF8, "application/json")).ConfigureAwait(true);
|
||||
|
||||
return response.StatusCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
{
|
||||
/// <summary>
|
||||
/// A class representing TubeArchivist API video player data.
|
||||
/// </summary>
|
||||
public class Player
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Player"/> class.
|
||||
/// </summary>
|
||||
/// <param name="duration">Duration of the video.</param>
|
||||
/// <param name="isWatched">Whether the video is marked as watched.</param>
|
||||
/// <param name="position">Video watched seconds.</param>
|
||||
public Player(long duration, bool isWatched, double position)
|
||||
{
|
||||
Duration = duration;
|
||||
IsWatched = isWatched;
|
||||
Position = position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the duration of the video.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "duration")]
|
||||
public long Duration { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the video is marked as watched.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "watched")]
|
||||
public bool IsWatched { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the video watched seconds.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "position")]
|
||||
public double Position { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
{
|
||||
/// <summary>
|
||||
/// A class representing TubeArchivist API video progress data.
|
||||
/// </summary>
|
||||
public class Progress
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Progress"/> class.
|
||||
/// </summary>
|
||||
/// <param name="position">Playback progress in seconds.</param>
|
||||
/// <param name="youtubeId">Video YouTube id.</param>
|
||||
/// <param name="userId">Playback progress user id.</param>
|
||||
[JsonConstructor]
|
||||
public Progress(
|
||||
long position,
|
||||
string? youtubeId,
|
||||
long? userId)
|
||||
{
|
||||
YoutubeId = youtubeId;
|
||||
UserId = userId;
|
||||
Position = position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Progress"/> class.
|
||||
/// </summary>
|
||||
/// <param name="position">Playback progress in seconds.</param>
|
||||
public Progress(long position)
|
||||
{
|
||||
Position = position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the video YouTube id.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "youtube_id")]
|
||||
public string? YoutubeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets playback progress user id.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "user_id")]
|
||||
public long? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets video playback progress (in seconds).
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "position")]
|
||||
public long Position { get; set; }
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -27,6 +27,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
/// <param name="published">Video published date.</param>
|
||||
/// <param name="vidThumbUrl">Video thuumb image URL.</param>
|
||||
/// <param name="youtubeId">Video YouTube id.</param>
|
||||
/// <param name="player">Player info.</param>
|
||||
public Video(
|
||||
Channel channel,
|
||||
Collection<string> tags,
|
||||
@@ -34,7 +35,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
string description,
|
||||
DateTime published,
|
||||
string vidThumbUrl,
|
||||
string youtubeId)
|
||||
string youtubeId,
|
||||
Player player)
|
||||
{
|
||||
this.Channel = channel;
|
||||
this.Tags = tags;
|
||||
@@ -43,6 +45,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
this.Published = published;
|
||||
this.VidThumbUrl = vidThumbUrl;
|
||||
this.YoutubeId = youtubeId;
|
||||
Player = player;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -88,6 +91,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
|
||||
[JsonProperty(PropertyName = "youtube_id")]
|
||||
public string YoutubeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Getsthe player related info.
|
||||
/// </summary>
|
||||
[JsonProperty(PropertyName = "player")]
|
||||
public Player Player { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Converts the TubeArchivist API video to a Jellyfin <see cref="RemoteSearchResult"/> object.
|
||||
/// </summary>
|
||||
@@ -5,6 +5,14 @@
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Jellyfin release cycle has changed in the past few months and now it is shorter than before. The plugin supports only the latest Jellyfin release, in order to continue using this plugin with all the latest features you will need to upgrade your Jellyfin installation.
|
||||
> The same rule applies to TubeArchivist: the plugin is only guaranteed to work with the latest TubeArchivist version.
|
||||
|
||||
> [!WARNING]
|
||||
> Jellyfin 10.10 introduced a bug that prevents the plugin to correctly create Season folders by year. The bug has been finally solved on the Jellyfin codebase, but, until the next minor release, a manual build of the Jellyfin branch `release-10.10.z` is required in order to get the fix running.<br>
|
||||
> This is not a plugin bug, any issue opened about this bug will be immediately closed!
|
||||
|
||||
## About
|
||||
|
||||
<p>This plugin adds the metadata provider for <a href="https://www.tubearchivist.com/">TubeArchivist</a>, offering improved flexibility and native integration with Jellyfin compared to previous solutions.</p>
|
||||
@@ -46,6 +54,7 @@ Once installed, you have to configure the following parameters in the plugin con
|
||||
<li>TubeArchivist instance address</li>
|
||||
<li>TubeArchivist API key</li>
|
||||
<li>Overviews length (channels and videos descriptions)</li>
|
||||
<li>Playback synchronization settings discussed in the <a href="#playback-synchronization">Playback synchronization</a> paragraph</li>
|
||||
</ul>
|
||||
|
||||

|
||||
@@ -62,9 +71,29 @@ _NOTE: If you are using Docker containers, it is important to mount the TubeArch
|
||||
4. Scrolling down, uncheck all metadata and image providers except `TubeArchivist`. (You won't find TubeArchivist in seasons providers, so just disable everything there)
|
||||
5. Save and come back to Home, you will see the newly added library. Jellyfin will have executed the metadata fetching for you after the collection creation and then you will see the metadata and the images of channels and videos
|
||||
|
||||
|
||||
## Playback synchronization
|
||||
<p>Starting from v1.3.1 this plugin offers playback progress and watched status bidirectional synchronization, but you can choose to enable only a one way synchronization (Jellyfin->TubeArchivist or TubeArchivist->Jellyfin) too.</p>
|
||||
|
||||
### Jellyfin->TubeArchivist synchronization
|
||||
<p>This kind of synchronization is done listening for progress and watched status changes while playing the videos for the specified users.<br>Furthermore, there is a task that runs at Jellyfin startup to synchronize the whole library.</p>
|
||||
<p>In the plugin configuration you will find these settings:</p>
|
||||
|
||||

|
||||
<p>In the text field you can specify one Jellyfin username to synchronize data of to TubeArchivist.</p>
|
||||
|
||||
### TubeArchivist->Jellyfin synchronization
|
||||
<p>This kind of synchronization is done using a Jellyfin scheduled task that regularly synchronizes data from TubeArchivist API to Jellyfin.</p>
|
||||
<p>In the plugin configuration you will find these settings:</p>
|
||||
|
||||

|
||||
<p>In the first text field you can specify one or more Jellyfin usernames to update data for.<br>
|
||||
In the second field you can specify the interval in seconds the task should run at, so that you can choose according to your system requirements. The lower is the interval the higher will be the resources consuption on your system.</p>
|
||||
|
||||
|
||||
## Build
|
||||
|
||||
1. To build this plugin you will need [.Net 6.x](https://dotnet.microsoft.com/download/dotnet/6.0).
|
||||
1. To build this plugin you will need [.Net 8.x](https://dotnet.microsoft.com/download/dotnet/8.0).
|
||||
|
||||
2. Build plugin with following command
|
||||
```
|
||||
|
||||
+4
-4
@@ -2,9 +2,9 @@
|
||||
name: "TubeArchivistMetadata"
|
||||
guid: "dc97d0c6-28b0-4242-afb4-5833ae1b3715"
|
||||
imageUrl: https://raw.githubusercontent.com/tubearchivist/tubearchivist-jf-plugin/master/images/logo.png
|
||||
version: "1.2.4.0"
|
||||
targetAbi: "10.8.0.0"
|
||||
framework: "net6.0"
|
||||
version: "1.3.7.0"
|
||||
targetAbi: "10.10.0.0"
|
||||
framework: "net8.0"
|
||||
overview: "Metadata for your TubeArchivist library on Jellyfin"
|
||||
description: >
|
||||
TubeArchivistMetadata is a plugin that automatically manages
|
||||
@@ -14,4 +14,4 @@ owner: "DarkFighterLuke"
|
||||
artifacts:
|
||||
- "Jellyfin.Plugin.TubeArchivistMetadata.dll"
|
||||
changelog: >
|
||||
Fix issues with directory separators
|
||||
Fix JF->TA Sync
|
||||
|
||||
+95
-15
@@ -8,62 +8,142 @@
|
||||
"overview": "Metadata for your TubeArchivist library on Jellyfin",
|
||||
"imageUrl": "https://raw.githubusercontent.com/tubearchivist/tubearchivist-jf-plugin/master/images/logo.png",
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.3.7.0",
|
||||
"changelog": "Fix TA auth header\n",
|
||||
"targetAbi": "10.10.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.7/tubearchivistmetadata_1.3.7.0.zip",
|
||||
"checksum": "a0e4ee866f298df223a0b9b5cece16b0",
|
||||
"timestamp": "2025-05-26T21:43:54Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.6.0",
|
||||
"changelog": "Fix TA auth header\n",
|
||||
"targetAbi": "10.10.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.6/tubearchivistmetadata_1.3.6.0.zip",
|
||||
"checksum": "513cde64268867d0047009eb2d986054",
|
||||
"timestamp": "2025-03-10T22:01:13Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.5.0",
|
||||
"changelog": "Adapt to the new TA API changes Fix JF crash when setting watched status with TA offline\n",
|
||||
"targetAbi": "10.10.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.5/tubearchivistmetadata_1.3.5.0.zip",
|
||||
"checksum": "2536622c0ec73e6401860929f24849f7",
|
||||
"timestamp": "2025-03-10T17:47:43Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.4.0",
|
||||
"changelog": "Merge workaround for JF crashing when scanning Series pull request by wolffshots\n",
|
||||
"targetAbi": "10.10.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.4/tubearchivistmetadata_1.3.4.0.zip",
|
||||
"checksum": "1ee6041139a6fdc3cecc8b2a427c60a8",
|
||||
"timestamp": "2024-11-04T21:30:24Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.3.0",
|
||||
"changelog": "Add compatibility with Jellyfin 10.10\n",
|
||||
"targetAbi": "10.10.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.3/tubearchivistmetadata_1.3.3.0.zip",
|
||||
"checksum": "ee6431d8bdaf844672d167b6f3ee0a73",
|
||||
"timestamp": "2024-11-04T20:41:46Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.2.0",
|
||||
"changelog": "Add tasks progress status Adjust logs levels\n",
|
||||
"targetAbi": "10.9.1.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.2/tubearchivistmetadata_1.3.2.0.zip",
|
||||
"checksum": "6162235807535a5c2a7570276798e69e",
|
||||
"timestamp": "2024-09-14T13:41:58Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.1.0",
|
||||
"changelog": "Add support for Jellyfin 10.9.1\n",
|
||||
"targetAbi": "10.9.1.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.1/tubearchivistmetadata_1.3.1.0.zip",
|
||||
"checksum": "b0b526bbd1702970108e3b9a8c3709de",
|
||||
"timestamp": "2024-09-12T13:36:12Z"
|
||||
},
|
||||
{
|
||||
"version": "1.3.0.0",
|
||||
"changelog": "Add support for Jellyfin 10.9.1\n",
|
||||
"targetAbi": "10.9.1.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.3.0/tubearchivistmetadata_1.3.0.0.zip",
|
||||
"checksum": "e1fde6f75a10a5f17bc9cc5814949180",
|
||||
"timestamp": "2024-05-14T20:20:13Z"
|
||||
},
|
||||
{
|
||||
"version": "1.2.5.0",
|
||||
"changelog": "Ping the TA API to validate connection\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.5/tubearchivistmetadata_1.2.5.0.zip",
|
||||
"checksum": "e4a0d076ffd84c976ad66dde91dfb840",
|
||||
"timestamp": "2024-05-14T17:37:17Z"
|
||||
},
|
||||
{
|
||||
"version": "1.2.4.0",
|
||||
"changelog": "Fix issues with directory separators\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.4/tubearchivistmetadata_1.2.4.0.zip",
|
||||
"checksum": "b418a46d458fe28354580d70748b1ced",
|
||||
"timestamp": "2024-05-09T15:41:00Z"
|
||||
},
|
||||
{
|
||||
"version": "1.2.3.0",
|
||||
"changelog": "Add fix for unclosed HTML breaks\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.3/TubeArchivistMetadata-1.2.3.zip",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.3/tubearchivistmetadata_1.2.3.0.zip",
|
||||
"checksum": "f5328a662444739eaa7c59855bfcb203",
|
||||
"timestamp": "2024-04-18 21:45:00"
|
||||
"timestamp": "2024-04-18T21:45:00Z"
|
||||
},
|
||||
{
|
||||
"version": "1.2.2.0",
|
||||
"changelog": "Fix bug on description length substringing\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.2/TubeArchivistMetadata-1.2.2.zip",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.2/tubearchivistmetadata_1.2.2.0.zip",
|
||||
"checksum": "82d04546916e1ba76d56de28e648447a",
|
||||
"timestamp": "2024-03-15 10:12:00"
|
||||
"timestamp": "2024-03-15T10:12:00Z"
|
||||
},
|
||||
{
|
||||
"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/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.1/TubeArchivistMetadata-1.2.1.zip",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.1/tubearchivistmetadata_1.2.1.0.zip",
|
||||
"checksum": "cf68d169956f166a6ee68a06192651c2",
|
||||
"timestamp": "2024-03-14 21:50:00"
|
||||
"timestamp": "2024-03-14T21:50:00Z"
|
||||
},
|
||||
{
|
||||
"version": "1.2.0.0",
|
||||
"changelog": "Add episodes and series overview\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.0/TubeArchivistMetadata-1.2.0.zip",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.2.0/tubearchivistmetadata_1.2.0.0.zip",
|
||||
"checksum": "75812a4464bf68c43fb9dcdb74d924e3",
|
||||
"timestamp": "2024-03-14 20:00:00"
|
||||
"timestamp": "2024-03-14T20:00:00Z"
|
||||
},
|
||||
{
|
||||
"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/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.1.1/TubeArchivistMetadata-1.1.1.zip",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.1.1/tubearchivistmetadata_1.1.1.0.zip",
|
||||
"checksum": "84ce752ce662e834690512c88ba48664",
|
||||
"timestamp": "2024-03-14 16:35:00"
|
||||
"timestamp": "2024-03-14T16:35:00Z"
|
||||
},
|
||||
{
|
||||
"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/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.1.0/TubeArchivistMetadata-1.1.0.zip",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.1.0/tubearchivistmetadata_1.1.0.0.zip",
|
||||
"checksum": "de4b6562973b7f75b6afe3a441bb0e19",
|
||||
"timestamp": "2024-03-13 15:02:00"
|
||||
"timestamp": "2024-03-13T15:02:00Z"
|
||||
},
|
||||
{
|
||||
"version": "1.0.0.0",
|
||||
"changelog": "First release\n",
|
||||
"targetAbi": "10.8.0.0",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.0.0/TubeArchivistMetadata-1.0.0.zip",
|
||||
"sourceUrl": "https://github.com/tubearchivist/tubearchivist-jf-plugin/releases/download/v1.0.0/tubearchivistmetadata_1.0.0.0.zip",
|
||||
"checksum": "444f8980671de494b1875ee7d1657bcf",
|
||||
"timestamp": "2024-03-11 16:02:00"
|
||||
"timestamp": "2024-03-11T16:02:00Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
Reference in New Issue
Block a user