mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-10-21 11:05:05 +00:00
Extract cover art will not cause the title to be lost #1759
This commit is contained in:
@@ -69,7 +69,7 @@ public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChan
|
|||||||
_context = context;
|
_context = context;
|
||||||
|
|
||||||
mediaElement.MediaUriPlayer.LAVFilterDirectory =
|
mediaElement.MediaUriPlayer.LAVFilterDirectory =
|
||||||
IntPtr.Size == 8 ? "LAVFilters-x64\\" : "LAVFilters-x86\\";
|
IntPtr.Size == 8 ? @"LAVFilters-x64\" : @"LAVFilters-x86\";
|
||||||
|
|
||||||
//ShowViedoControlContainer(null, null);
|
//ShowViedoControlContainer(null, null);
|
||||||
viewerPanel.PreviewMouseMove += ShowViedoControlContainer;
|
viewerPanel.PreviewMouseMove += ShowViedoControlContainer;
|
||||||
@@ -83,21 +83,21 @@ public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChan
|
|||||||
|
|
||||||
buttonPlayPause.Click += TogglePlayPause;
|
buttonPlayPause.Click += TogglePlayPause;
|
||||||
buttonLoop.Click += ToggleShouldLoop;
|
buttonLoop.Click += ToggleShouldLoop;
|
||||||
buttonTime.Click += (sender, e) => buttonTime.Tag = (string)buttonTime.Tag == "Time" ? "Length" : "Time";
|
buttonTime.Click += (_, _) => buttonTime.Tag = (string)buttonTime.Tag == "Time" ? "Length" : "Time";
|
||||||
buttonMute.Click += (sender, e) => volumeSliderLayer.Visibility = Visibility.Visible;
|
buttonMute.Click += (_, _) => volumeSliderLayer.Visibility = Visibility.Visible;
|
||||||
volumeSliderLayer.MouseDown += (sender, e) => volumeSliderLayer.Visibility = Visibility.Collapsed;
|
volumeSliderLayer.MouseDown += (_, _) => volumeSliderLayer.Visibility = Visibility.Collapsed;
|
||||||
|
|
||||||
sliderProgress.PreviewMouseDown += (sender, e) =>
|
sliderProgress.PreviewMouseDown += (_, e) =>
|
||||||
{
|
{
|
||||||
_wasPlaying = mediaElement.IsPlaying;
|
_wasPlaying = mediaElement.IsPlaying;
|
||||||
mediaElement.Pause();
|
mediaElement.Pause();
|
||||||
};
|
};
|
||||||
sliderProgress.PreviewMouseUp += (sender, e) =>
|
sliderProgress.PreviewMouseUp += (_, _) =>
|
||||||
{
|
{
|
||||||
if (_wasPlaying) mediaElement.Play();
|
if (_wasPlaying) mediaElement.Play();
|
||||||
};
|
};
|
||||||
|
|
||||||
PreviewMouseWheel += (sender, e) => ChangeVolume((double)e.Delta / 120 * 0.04);
|
PreviewMouseWheel += (_, e) => ChangeVolume(e.Delta / 120d * 0.04d);
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial void LoadAndInsertGlassLayer();
|
private partial void LoadAndInsertGlassLayer();
|
||||||
@@ -285,22 +285,30 @@ public partial class ViewerPanel : UserControl, IDisposable, INotifyPropertyChan
|
|||||||
metaArtists.Text = artist;
|
metaArtists.Text = artist;
|
||||||
metaAlbum.Text = album;
|
metaAlbum.Text = album;
|
||||||
|
|
||||||
var coverData = info.Get(StreamKind.General, 0, "Cover_Data");
|
// Extract cover art
|
||||||
if (!string.IsNullOrEmpty(coverData))
|
try
|
||||||
{
|
{
|
||||||
var coverBytes = Convert.FromBase64String
|
var coverData = info.Get(StreamKind.General, 0, "Cover_Data").Trim();
|
||||||
(
|
if (!string.IsNullOrEmpty(coverData))
|
||||||
coverData.Contains(' ') // MediaInfo may will return multiple covers
|
{
|
||||||
? coverData.Split(" / ")[0] // Get the first cover only
|
var coverBytes = Convert.FromBase64String
|
||||||
: coverData
|
(
|
||||||
);
|
coverData.Contains(' ') // MediaInfo may will return multiple covers
|
||||||
using var ms = new MemoryStream(coverBytes);
|
? coverData.Split(" / ")[0] // Get the first cover only
|
||||||
|
: coverData
|
||||||
CoverArt = BitmapFrame.Create(ms, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
);
|
||||||
|
using var ms = new MemoryStream(coverBytes);
|
||||||
|
CoverArt = BitmapFrame.Create(ms, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.WriteLine(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine(e);
|
||||||
metaTitle.Text = Path.GetFileName(path);
|
metaTitle.Text = Path.GetFileName(path);
|
||||||
metaArtists.Text = metaAlbum.Text = string.Empty;
|
metaArtists.Text = metaAlbum.Text = string.Empty;
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ internal class PluginManager
|
|||||||
private PluginManager()
|
private PluginManager()
|
||||||
{
|
{
|
||||||
LoadPlugins(App.UserPluginPath);
|
LoadPlugins(App.UserPluginPath);
|
||||||
LoadPlugins(Path.Combine(App.AppPath, "QuickLook.Plugin\\"));
|
LoadPlugins(Path.Combine(App.AppPath, @"QuickLook.Plugin\"));
|
||||||
InitLoadedPlugins();
|
InitLoadedPlugins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user