Various updates.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Harmonia.Core.Caching;
|
||||
|
||||
@@ -27,10 +28,16 @@ public abstract class MemoryCache<TKey, TValue> : Cache<TKey, TValue> where TKey
|
||||
|
||||
var cacheEntryOptions = new MemoryCacheEntryOptions()
|
||||
.SetSize(entrySize)
|
||||
.SetSlidingExpiration(SlidingExpiration);
|
||||
.SetSlidingExpiration(SlidingExpiration)
|
||||
.RegisterPostEvictionCallback(PostEvictionCallback);
|
||||
|
||||
_memoryCache.Set(key, entry, cacheEntryOptions);
|
||||
}
|
||||
|
||||
protected virtual void PostEvictionCallback(object? cacheKey, object? cacheValue, EvictionReason evictionReason, object? state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected abstract long GetEntrySize(TValue entry);
|
||||
}
|
||||
@@ -7,12 +7,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ManagedBass" Version="3.1.1" />
|
||||
<PackageReference Include="ManagedBass.Flac" Version="3.1.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.3" />
|
||||
<PackageReference Include="ManagedBass" Version="4.0.2" />
|
||||
<PackageReference Include="ManagedBass.Flac" Version="4.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.9" />
|
||||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||
<PackageReference Include="TagLibSharp" Version="2.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -23,4 +23,26 @@ public class Song
|
||||
public string? FileDirectory => Directory.GetParent(FileName)?.Name;
|
||||
public string? FileType => Path.GetExtension(FileName)?.Replace(".", "").ToUpper();
|
||||
public string ShortFileName => Path.GetFileNameWithoutExtension(FileName);
|
||||
|
||||
public void Update(Song song)
|
||||
{
|
||||
if (string.Equals(song.FileName, FileName, StringComparison.OrdinalIgnoreCase) == false)
|
||||
return;
|
||||
|
||||
Size = song.Size;
|
||||
LastModified = song.LastModified;
|
||||
Title = song.Title;
|
||||
Album = song.Album;
|
||||
Artists = song.Artists;
|
||||
AlbumArtists = song.AlbumArtists;
|
||||
DiscNumber = song.DiscNumber;
|
||||
TrackNumber = song.TrackNumber;
|
||||
Length = song.Length;
|
||||
Year = song.Year;
|
||||
Genre = song.Genre;
|
||||
BitRate = song.BitRate;
|
||||
SampleRate = song.SampleRate;
|
||||
ImageName = song?.ImageName;
|
||||
ImageHash = song?.ImageHash;
|
||||
}
|
||||
}
|
||||
@@ -172,6 +172,7 @@ public class Playlist
|
||||
foreach (PlaylistSong playlistSong in playlistSongs)
|
||||
{
|
||||
//playlistSong.Song = song;
|
||||
//playlistSong.Song.Update(song);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user