This commit is contained in:
rlauu 2024-11-17 21:43:29 +01:00
parent 78e8943061
commit 7309be0422

View File

@ -3,10 +3,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using IntroSkipper.Data; using IntroSkipper.Data;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Model; using MediaBrowser.Model;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -24,7 +26,9 @@ namespace IntroSkipper.Manager
private readonly IMediaSegmentManager _mediaSegmentManager = mediaSegmentManager; private readonly IMediaSegmentManager _mediaSegmentManager = mediaSegmentManager;
private readonly ILogger<MediaSegmentUpdateManager> _logger = logger; private readonly ILogger<MediaSegmentUpdateManager> _logger = logger;
private readonly IMediaSegmentProvider _segmentProvider = segmentProvider; private readonly IMediaSegmentProvider _segmentProvider = segmentProvider;
private readonly string _name = Plugin.Instance!.Name; private readonly string _id = Plugin.Instance!.Name.ToLowerInvariant()
.GetMD5()
.ToString("N", CultureInfo.InvariantCulture);
/// <summary> /// <summary>
/// Updates all media items in a List. /// Updates all media items in a List.
@ -50,7 +54,7 @@ namespace IntroSkipper.Manager
continue; continue;
} }
await Task.WhenAll(newSegments.Select(s => _mediaSegmentManager.CreateSegmentAsync(s, _name))).ConfigureAwait(false); await Task.WhenAll(newSegments.Select(s => _mediaSegmentManager.CreateSegmentAsync(s, _id))).ConfigureAwait(false);
_logger.LogDebug("Updated {SegmentCount} segments for episode {EpisodeId}", newSegments.Count, episode.EpisodeId); _logger.LogDebug("Updated {SegmentCount} segments for episode {EpisodeId}", newSegments.Count, episode.EpisodeId);
} }