Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kookxiang committed Aug 28, 2024
1 parent ddaeadf commit d8b09f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.Bangumi/Providers/MusicSongProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task<HttpResponseMessage> GetImageResponse(string url, Cancellation
if (string.IsNullOrEmpty(fileName))
return null;

var album = libraryManager.FindByPath(info.Path, false).FindParent<MusicAlbum>();
var album = libraryManager.FindByPath(info.Path, false)?.FindParent<MusicAlbum>();
if (album is null)
return null;

Expand Down
1 change: 1 addition & 0 deletions Jellyfin.Plugin.Bangumi/ScheduledTask/RatingRefreshTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public async Task ExecuteAsync(IProgress<double> progress, CancellationToken tok

// obtain library item
var item = library.GetItemById(id);
if (item == null) continue;

// skip item if it was refreshed recently
#if EMBY
Expand Down
18 changes: 8 additions & 10 deletions Jellyfin.Plugin.Bangumi/ScheduledTask/TokenRefreshTask.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@

#if EMBY
using MediaBrowser.Model.Logging;
#else
using Microsoft.Extensions.Logging;
using Jellyfin.Data.Entities;
#endif
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Plugin.Bangumi.OAuth;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Tasks;
#if EMBY
using MediaBrowser.Model.Logging;
#else
using Microsoft.Extensions.Logging;
using Jellyfin.Data.Entities;
#endif

namespace Jellyfin.Plugin.Bangumi.ScheduledTask;

public class TokenRefreshTask(IUserManager userManager, IActivityManager activity, BangumiApi api, OAuthStore store)
public class TokenRefreshTask(IActivityManager activity, BangumiApi api, OAuthStore store)
: IScheduledTask
{
public string Key => "OAuthTokenRefreshTask";
Expand Down Expand Up @@ -55,7 +53,6 @@ public async Task ExecuteAsync(IProgress<double> progress, CancellationToken tok
var total = users.Count;
foreach (var (guid, user) in users)
{
var userId = Guid.Parse(guid);
token.ThrowIfCancellationRequested();
progress.Report(current / total);
current++;
Expand Down Expand Up @@ -83,6 +80,7 @@ public async Task ExecuteAsync(IProgress<double> progress, CancellationToken tok

activity.Create(activityLogEntry);
#else
var userId = Guid.Parse(guid);
var activityLog = new ActivityLog("Bangumi 授权", "Bangumi", userId);
try
{
Expand Down

0 comments on commit d8b09f6

Please sign in to comment.