Compare commits

...

39 Commits

Author SHA1 Message Date
DarkFighterLuke 80a1b6050d Merge pull request #50 from tubearchivist/bugfix/sync-usernames
Update build.yml
2025-05-27 20:34:48 +02:00
DarkFighterLuke a4942e78b6 Update manifest.json
Signed-off-by: DarkFighterLuke <DarkFighterLuke@users.noreply.github.com>
2025-05-26 21:43:57 +00:00
DarkFighterLuke 48070f311e Merge pull request #49 from tubearchivist/bugfix/sync-usernames
JF->TA Sync fix
2025-05-26 23:43:57 +02:00
DarkFighterLuke 96a72ab909 Update build.yml 2025-05-26 23:41:43 +02:00
DarkFighterLuke 9c6aa56db0 Fix JFToTubearchivistProgressSyncTask 2025-05-26 23:38:04 +02:00
DarkFighterLuke 413f45046d Sync progress status in OnWatchedStatusChange when watched is false
modified:   Jellyfin.Plugin.TubeArchivistMetadata/Plugin.cs
2025-05-26 23:37:20 +02:00
DarkFighterLuke 5ad6b2a381 Fix OnPlaybackProgress collection name retrieval 2025-05-26 23:35:42 +02:00
DarkFighterLuke 795047a50e Update README.md 2025-03-13 23:17:08 +01:00
DarkFighterLuke 323a208de2 Update README.md 2025-03-13 23:16:26 +01:00
DarkFighterLuke 55d320c456 Update BUG-REPORT.yml 2025-03-13 23:10:01 +01:00
DarkFighterLuke d5f2f0ae8e Update BUG-REPORT.yml 2025-03-13 23:08:04 +01:00
DarkFighterLuke c3bdfc26ea Update manifest.json
Signed-off-by: DarkFighterLuke <DarkFighterLuke@users.noreply.github.com>
2025-03-10 22:01:17 +00:00
DarkFighterLuke c6f7f79385 Merge branch 'master' of github.com:tubearchivist/tubearchivist-jf-plugin 2025-03-10 23:00:05 +01:00
DarkFighterLuke 53ede13f54 Update build.yml 2025-03-10 22:59:59 +01:00
DarkFighterLuke eeda7dd91e Update manifest.json
Signed-off-by: DarkFighterLuke <DarkFighterLuke@users.noreply.github.com>
2025-03-10 21:55:37 +00:00
DarkFighterLuke 867fbbae5b Merge pull request #38 from mattkduran/master
Added new method for auth headers
2025-03-10 22:46:11 +01:00
DarkFighterLuke 76ac750de2 Fix UpdateAuthorizationHeader method 2025-03-10 22:44:37 +01:00
DarkFighterLuke ddbbb4ba25 Merge branch 'master' into master 2025-03-10 19:01:34 +01:00
DarkFighterLuke 3fca2d1e09 Update manifest.json
Signed-off-by: DarkFighterLuke <DarkFighterLuke@users.noreply.github.com>
2025-03-10 17:47:46 +00:00
DarkFighterLuke 4f2f6c0429 Merge pull request #41 from tubearchivist/ta-v0.5.0
TubeArchivist v0.5.0 new API
2025-03-10 18:45:14 +01:00
Matt Duran ebb2cdfcc6 Modified setter to allow for usernames with spaces 2025-03-06 20:58:19 -08:00
Matt Duran c058a35abe Added new method for auth headers 2025-03-03 09:48:10 -08:00
DarkFighterLuke 11eb456c56 Fix JF crash when setting watched status with TA offline 2025-02-22 15:39:58 +01:00
DarkFighterLuke 4db1ce755a Update build.yaml 2025-02-22 15:15:54 +01:00
DarkFighterLuke a424721d93 Update README.md 2025-02-22 15:14:11 +01:00
DarkFighterLuke 16598bb86e Adapt to the new TA API changes 2025-02-21 17:42:58 +01:00
DarkFighterLuke 98472b5aa6 Fix JF->TA watched status synchronization 2025-02-21 17:41:51 +01:00
DarkFighterLuke ab96b227a1 Merge pull request #31 from AgentK20/tag-nre-fix
Fix ArgumentNullException when channel has no tags
2025-01-08 23:12:25 +01:00
AgentK 5ff96113c8 Spacing 2024-12-01 11:12:34 -06:00
AgentK 6697f2b4cc Correctly handle the possibility of a null-deserialized tags 2024-12-01 11:09:53 -06:00
DarkFighterLuke a45ef87f84 Update manifest.json
Signed-off-by: DarkFighterLuke <DarkFighterLuke@users.noreply.github.com>
2024-11-04 21:30:26 +00:00
DarkFighterLuke 157facdceb Merge workaround for JF crashing when scanning Series pull request by wolffshots 2024-11-04 22:29:26 +01:00
DarkFighterLuke be8481c795 Remove useless comments 2024-11-04 22:26:42 +01:00
DarkFighterLuke bd0a8371a5 Merge pull request #26 from wolffshots/workaround-series-crash
Workaround for JF crashing when scanning Series
2024-11-04 22:23:45 +01:00
DarkFighterLuke a75c474647 Fix manifest.json 2024-11-04 21:52:19 +01:00
DarkFighterLuke 1dd7019676 Fix manifest.json 2024-11-04 21:47:55 +01:00
DarkFighterLuke 355576c283 Update README.md 2024-11-04 21:44:38 +01:00
DarkFighterLuke 9091cdbe5b Update manifest.json
Signed-off-by: DarkFighterLuke <DarkFighterLuke@users.noreply.github.com>
2024-11-04 20:41:49 +00:00
wolffshots 2fee654efe chore: wrap itemYTId stuff in try catch 2024-10-22 15:11:50 +02:00
11 changed files with 250 additions and 162 deletions
+4
View File
@@ -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
+3 -3
View File
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>1.3.3.0</Version>
<AssemblyVersion>1.3.3.0</AssemblyVersion>
<FileVersion>1.3.3.0</FileVersion>
<Version>1.3.7.0</Version>
<AssemblyVersion>1.3.7.0</AssemblyVersion>
<FileVersion>1.3.7.0</FileVersion>
</PropertyGroup>
</Project>
@@ -88,6 +88,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
{
_tubeArchivistApiKey = value;
Plugin.Instance?.LogTAApiConnectionStatus();
Plugin.Instance?.UpdateAuthorizationHeader(value);
}
}
@@ -124,8 +125,20 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Configuration
set
{
value.Replace(" ", string.Empty, StringComparison.CurrentCulture).Split(',').ToList().ForEach(u => _jfUsernamesTo.Add(u));
_logger.LogDebug("Set JFUsernamesTo to: {Message}", value);
// 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));
}
}
+60 -13
View File
@@ -28,6 +28,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
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.
@@ -57,11 +58,13 @@ 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);
@@ -128,6 +131,23 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
}
};
/// <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>
@@ -155,7 +175,8 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
{
if (Instance!.Configuration.JFTASync && eventArgs.Users.Any(u => Instance!.Configuration.JFUsernameFrom.Equals(u.Username, StringComparison.Ordinal)))
{
BaseItem? channel = LibraryManager.GetItemById(eventArgs.Item.ParentId);
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)
{
@@ -173,28 +194,54 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata
private async void OnWatchedStatusChange(object? sender, UserDataSaveEventArgs eventArgs)
{
var user = _userManager.GetUserById(eventArgs.UserId);
if (user != null && Configuration.GetJFUsernamesToArray().Contains(user!.Username))
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;
if (eventArgs.Item is Series)
try
{
itemYTId = Utils.GetChannelNameFromPath(eventArgs.Item.Path);
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;
}
}
else if (eventArgs.Item is Episode)
{
itemYTId = Utils.GetVideoNameFromPath(eventArgs.Item.Path);
}
else
catch (Exception ex)
{
Logger.LogError(ex, "Error while processing item path: {ItemPath}", eventArgs.Item.Path ?? "null");
return;
}
var statusCode = await TubeArchivistApi.GetInstance().SetWatchedStatus(itemYTId, isPlayed).ConfigureAwait(true);
if (statusCode != System.Net.HttpStatusCode.OK)
try
{
Logger.LogCritical("POST /watched returned {StatusCode} for item {ItemName} ({VideoYTId}) with watched status {IsPlayed}", statusCode, eventArgs.Item.Name, itemYTId, isPlayed);
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);
}
}
}
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Enums;
@@ -45,7 +46,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks
public string Name => "JFToTubeArchivistProgressSyncTask";
/// <inheritdoc/>
public string Description => "This tasks syncs TubeArchivist playback progresses to Jellyfin";
public string Description => "This tasks syncs Jellyfin playback progresses to TubeArchivist";
/// <inheritdoc/>
public string Category => "TubeArchivistMetadata";
@@ -63,54 +64,52 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks
_logger.LogInformation("Starting Jellyfin->TubeArchivist playback progresses synchronization.");
var taApi = TubeArchivistApi.GetInstance();
var videosCount = 0;
foreach (var jfUsername in Plugin.Instance!.Configuration.GetJFUsernamesToArray())
var jfUsername = Plugin.Instance!.Configuration.JFUsernameFrom;
var user = _userManager.GetUserByName(jfUsername);
if (user == null)
{
var user = _userManager.GetUserByName(jfUsername);
if (user == null)
{
_logger.LogInformation("{Message}", $"Jellyfin user with username {jfUsername} not found");
continue;
}
_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();
var collectionItem = _libraryManager.GetItemList(new InternalItemsQuery
{
Name = Plugin.Instance?.Configuration.CollectionTitle,
IncludeItemTypes = new[] { BaseItemKind.CollectionFolder }
}).FirstOrDefault();
if (collectionItem == null)
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
{
var message = $"Collection '{Plugin.Instance?.Configuration.CollectionTitle}' not found.";
_logger.LogCritical("{Message}", message);
}
else
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 collection = (CollectionFolder)collectionItem;
var channels = collection.GetChildren(user, false, new InternalItemsQuery
var channelYTId = Utils.GetChannelNameFromPath(channel.Path);
var years = channel.GetChildren(user, false, new InternalItemsQuery
{
IncludeItemTypes = new[] { BaseItemKind.Series }
IncludeItemTypes = new[] { BaseItemKind.Season }
});
_logger.LogInformation("Analyzing collection {Id} with name {Name}", collectionItem.Id, collectionItem.Name);
_logger.LogDebug("Found {Message} channels", channels.Count);
_logger.LogDebug("Found {Years} years in channel {ChannelName}", years.Count, channel.Name);
foreach (Series channel in channels)
foreach (Season year in years)
{
var channelYTId = Utils.GetChannelNameFromPath(channel.Path);
var years = channel.GetChildren(user, false, new InternalItemsQuery
var videos = year.GetChildren(user, false, new InternalItemsQuery
{
IncludeItemTypes = new[] { BaseItemKind.Season }
IncludeItemTypes = new[] { BaseItemKind.Episode }
});
_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.LogDebug("Found {Videos} videos in year {YearName} of the channel {ChannelName}", videos.Count, year.Name, channel.Name);
videosCount += videos.Count;
}
}
}
@@ -118,91 +117,82 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.Tasks
_logger.LogInformation("Found a total of {VideosCount} videos", videosCount);
var processedVideosCount = 0;
foreach (var jfUsername in Plugin.Instance!.Configuration.GetJFUsernamesToArray())
if (collectionItem == null)
{
var user = _userManager.GetUserByName(jfUsername);
if (user == 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
{
_logger.LogInformation("{Message}", $"Jellyfin user with username {jfUsername} not found");
continue;
}
IncludeItemTypes = new[] { BaseItemKind.Series }
});
var collectionItem = _libraryManager.GetItemList(new InternalItemsQuery
foreach (Series channel in channels)
{
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
var channelYTId = Utils.GetChannelNameFromPath(channel.Path);
var isChannelWatched = false;
var isChannelCheckedForWatched = false;
var years = channel.GetChildren(user, false, new InternalItemsQuery
{
IncludeItemTypes = new[] { BaseItemKind.Series }
IncludeItemTypes = new[] { BaseItemKind.Season }
});
foreach (Series channel in channels)
foreach (Season year in years)
{
var channelYTId = Utils.GetChannelNameFromPath(channel.Path);
var isChannelWatched = false;
var isChannelCheckedForWatched = false;
var years = channel.GetChildren(user, false, new InternalItemsQuery
var videos = year.GetChildren(user, false, new InternalItemsQuery
{
IncludeItemTypes = new[] { BaseItemKind.Season }
IncludeItemTypes = new[] { BaseItemKind.Episode }
});
videosCount += videos.Count;
foreach (Season year in years)
foreach (Episode video in videos)
{
var videos = year.GetChildren(user, false, new InternalItemsQuery
{
IncludeItemTypes = new[] { BaseItemKind.Episode }
});
videosCount += videos.Count;
var videoYTId = Utils.GetVideoNameFromPath(video.Path);
_logger.LogInformation("{VideoYtId}", videoYTId);
HttpStatusCode statusCode;
foreach (Episode video in videos)
if (!isChannelCheckedForWatched && channel.IsPlayed(user))
{
var videoYTId = Utils.GetVideoNameFromPath(video.Path);
var playbackProgress = _userDataManager.GetUserData(user, video).PlaybackPositionTicks / TimeSpan.TicksPerSecond;
var statusCode = await taApi.SetProgress(videoYTId, playbackProgress).ConfigureAwait(true);
var isChannelPlayed = channel.IsPlayed(user);
statusCode = await taApi.SetWatchedStatus(channelYTId, isChannelPlayed).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");
_logger.LogCritical("{Message}", $"POST /watched returned {statusCode} for channel {channel.Name} ({channelYTId}) with wacthed status {isChannelPlayed}");
}
if (!isChannelCheckedForWatched && channel.IsPlayed(user))
else
{
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;
isChannelWatched = 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}");
}
}
processedVideosCount++;
progress.Report(processedVideosCount * 100 / videosCount);
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);
}
}
}
@@ -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>() :
[]
};
}
}
@@ -65,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));
@@ -82,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>
@@ -95,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));
@@ -112,10 +112,11 @@ 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>
@@ -174,15 +175,11 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
{
Progress? progress = null;
var progressEndpoint = $"/api/video/{videoId}/progress/";
var url = new Uri(Utils.SanitizeUrl(Plugin.Instance!.Configuration.TubeArchivistUrl + progressEndpoint));
var response = await client.GetAsync(url).ConfigureAwait(true);
if (response.IsSuccessStatusCode)
var video = await GetVideo(videoId).ConfigureAwait(true);
if (video != null)
{
string rawData = await response.Content.ReadAsStringAsync().ConfigureAwait(true);
progress = JsonConvert.DeserializeObject<Progress>(rawData);
progress = new Progress((long)video.Player.Position);
_logger.LogInformation("{Message}", $"Retrieved progress {video.Player.Position}");
}
return progress;
@@ -1,4 +1,3 @@
using System;
using Newtonsoft.Json;
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
@@ -13,12 +12,12 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
/// </summary>
/// <param name="duration">Duration of the video.</param>
/// <param name="isWatched">Whether the video is marked as watched.</param>
/// <param name="watchedUnixTime">Unix time of when the video has been marked watched.</param>
public Player(long duration, bool isWatched, long watchedUnixTime)
/// <param name="position">Video watched seconds.</param>
public Player(long duration, bool isWatched, double position)
{
Duration = duration;
IsWatched = isWatched;
WatchedUnixTime = watchedUnixTime;
Position = position;
}
/// <summary>
@@ -34,18 +33,9 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
public bool IsWatched { get; }
/// <summary>
/// Gets the Unix date and time when the video has been marked as watched.
/// Gets the video watched seconds.
/// </summary>
[JsonProperty(PropertyName = "watched_date")]
public long WatchedUnixTime { get; }
/// <summary>
/// Gets the date and time when the video has been marked as watched.
/// </summary>
[JsonIgnore]
public DateTime WatchedTime
{
get => DateTimeOffset.FromUnixTimeSeconds(WatchedUnixTime).DateTime;
}
[JsonProperty(PropertyName = "position")]
public double Position { get; }
}
}
+6 -1
View File
@@ -6,7 +6,12 @@
</p>
> [!IMPORTANT]
> Jellyfin 10.9.1 has been finally released and since starting with the version 1.3.0 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.
> 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
+2 -2
View File
@@ -2,7 +2,7 @@
name: "TubeArchivistMetadata"
guid: "dc97d0c6-28b0-4242-afb4-5833ae1b3715"
imageUrl: https://raw.githubusercontent.com/tubearchivist/tubearchivist-jf-plugin/master/images/logo.png
version: "1.3.3.0"
version: "1.3.7.0"
targetAbi: "10.10.0.0"
framework: "net8.0"
overview: "Metadata for your TubeArchivist library on Jellyfin"
@@ -14,4 +14,4 @@ owner: "DarkFighterLuke"
artifacts:
- "Jellyfin.Plugin.TubeArchivistMetadata.dll"
changelog: >
Add compatibility with Jellyfin 10.10
Fix JF->TA Sync
+48 -8
View File
@@ -8,6 +8,46 @@
"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",
@@ -46,7 +86,7 @@
"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-09 15:41:00"
"timestamp": "2024-05-09T15:41:00Z"
},
{
"version": "1.2.3.0",
@@ -54,7 +94,7 @@
"targetAbi": "10.8.0.0",
"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",
@@ -62,7 +102,7 @@
"targetAbi": "10.8.0.0",
"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",
@@ -70,7 +110,7 @@
"targetAbi": "10.8.0.0",
"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",
@@ -78,7 +118,7 @@
"targetAbi": "10.8.0.0",
"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",
@@ -86,7 +126,7 @@
"targetAbi": "10.8.0.0",
"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",
@@ -94,7 +134,7 @@
"targetAbi": "10.8.0.0",
"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",
@@ -102,7 +142,7 @@
"targetAbi": "10.8.0.0",
"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"
}
]
}