Skip to content

Commit a22a641

Browse files
committed
latest Artemis update + report explicitly focused session
1 parent cd7c95e commit a22a641

6 files changed

Lines changed: 193 additions & 156 deletions

File tree

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
4-
<Platforms>x64</Platforms>
5-
<PlatformTarget>x64</PlatformTarget>
6-
</PropertyGroup>
2+
<PropertyGroup>
3+
<TargetFramework>net6.0-windows10.0.17763.0</TargetFramework>
4+
<Platforms>x64</Platforms>
5+
<PlatformTarget>x64</PlatformTarget>
6+
<IncludeBuildOutput>false</IncludeBuildOutput>
7+
</PropertyGroup>
78

8-
<ItemGroup>
9-
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
10-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
11-
<PackageReference Include="Serilog" Version="2.12.0" />
12-
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.1" />
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0">
11+
</PackageReference>
12+
<PackageReference Include="ArtemisRGB.UI.Shared" IncludeAssets="compile;build;buildTransitive" Version="1.2023.111.4"/>
13+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1"/>
14+
<PackageReference Include="Serilog" Version="2.12.0"/>
15+
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108"/>
1316

14-
<PackageReference Update="@(PackageReference)" IncludeAssets="compile;build" />
15-
</ItemGroup>
17+
<PackageReference Update="@(PackageReference)" IncludeAssets="compile;build"/>
1618

17-
<ItemGroup>
18-
<Reference Include="Dubya.WindowsMediaController" Version="2.1.0">
19-
<HintPath>.\WindowsMediaController.dll</HintPath>
20-
<Private>true</Private>
21-
</Reference>
22-
<Reference Include="Artemis.Core">
23-
<HintPath>..\..\Artemis\src\Artemis.Core\bin\net6.0\Artemis.Core.dll</HintPath>
24-
<Private>false</Private>
25-
</Reference>
26-
</ItemGroup>
19+
<PackageReference Include="Dubya.WindowsMediaController" Version="2.4.0" IncludeAssets="compile;lib:runtime"/>
2720

28-
<ItemGroup>
29-
<Content Include="plugin.json" CopyToOutputDirectory="PreserveNewest" />
30-
<PackageReference Include="ArtemisRGB.Plugins.BuildTask" Version="1.1.0" />
31-
</ItemGroup>
21+
22+
<Reference Include="Artemis.Core">
23+
<HintPath>..\..\Artemis\src\Artemis.Core\bin\net6.0\Artemis.Core.dll</HintPath>
24+
<Private>false</Private>
25+
</Reference>
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<Content Include="plugin.json" CopyToOutputDirectory="PreserveNewest"/>
30+
<PackageReference Include="ArtemisRGB.Plugins.BuildTask" Version="1.1.0"/>
31+
</ItemGroup>
3232
</Project>

Artemis.MediaInfo/DataModels/MediaInfoDataModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
using Windows.Media;
33
using Windows.Media.Control;
44
using Artemis.Core;
5+
using Artemis.Core.ColorScience;
56
using Artemis.Core.Modules;
6-
using Artemis.Core.Services;
77
using WindowsMediaController;
88

99
namespace Artemis.MediaInfo.DataModels
@@ -33,6 +33,8 @@ public class MediaInfoDataModel : DataModel
3333
public bool HasArt { get; set; }
3434

3535
public ColorSwatch ArtColors { get; set; }
36+
37+
public string SessionName { get; set; }
3638

3739
public DataModelEvent<MediaChangedEventArgs> MediaChanged { get; } = new();
3840
public HashSet<MediaManager.MediaSession> MediaSessions { get; set; }
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Windows.Media.Control;
4+
using Windows.Storage.Streams;
5+
using Artemis.Core.ColorScience;
6+
using SkiaSharp;
7+
8+
namespace Artemis.MediaInfo;
9+
10+
public static class MediaInfoHelper
11+
{
12+
internal static async Task<ColorSwatch> ReadMediaColors(GlobalSystemMediaTransportControlsSessionMediaProperties mediaProperties)
13+
{
14+
var imageStream = await mediaProperties.Thumbnail.OpenReadAsync();
15+
var fileBytes = new byte[imageStream.Size];
16+
17+
using (var reader = new DataReader(imageStream))
18+
{
19+
await reader.LoadAsync((uint)imageStream.Size);
20+
reader.ReadBytes(fileBytes);
21+
}
22+
23+
using SKBitmap bitmap = SKBitmap.Decode(fileBytes);
24+
SKColor[] skClrs = ColorQuantizer.Quantize(bitmap.Pixels, 256);
25+
return ColorQuantizer.FindAllColorVariations(skClrs, true);
26+
}
27+
}

0 commit comments

Comments
 (0)