mirror of
https://github.com/Royce551/FRESHMusicPlayer.git
synced 2025-01-22 10:51:52 -05:00
update fmpcore, lots of stuff
This commit is contained in:
parent
df8afffdf1
commit
76575664c8
12 changed files with 41 additions and 71 deletions
Binary file not shown.
|
@ -15,7 +15,7 @@
|
|||
<ScrollViewer Grid.Row="0">
|
||||
<StackPanel Background="{StaticResource BackgroundColor}" Grid.Row="1">
|
||||
<TextBlock x:Name="EditingHeader" Margin="10,10,0,0" Grid.Row="1" TextTrimming="WordEllipsis" Text="Which playlist do you want to add this track to?" TextWrapping="Wrap" Foreground="{StaticResource PrimaryTextColor}" FontSize="16"/>
|
||||
<ListBox x:Name="PlaylistBox" Background="{StaticResource SecondaryColor}" Margin="15,10,0,0" MinHeight="250" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}">
|
||||
<ListBox x:Name="PlaylistBox" Background="{StaticResource ForegroundColor}" Margin="15,10,0,0" MinHeight="250" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}">
|
||||
|
||||
</ListBox>
|
||||
<Grid Height="30" Margin="15,10,0,10">
|
||||
|
@ -29,7 +29,7 @@
|
|||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<Grid Grid.Row="2" Background="{StaticResource ForegroundColor}">
|
||||
<Grid Grid.Row="2" Background="{StaticResource SecondaryColor}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
</Grid.RowDefinitions>
|
||||
<StackPanel Background="{StaticResource BackgroundColor}">
|
||||
<TextBlock Margin="10,10,0,0" Grid.Row="1" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_INTEGRATIONDISAMBIGUATION}" TextWrapping="Wrap" Foreground="{StaticResource PrimaryTextColor}" FontSize="16"/>
|
||||
<ListBox x:Name="ReleaseBox" Background="{StaticResource SecondaryColor}" Margin="15,10" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" FontSize="14" Foreground="{StaticResource PrimaryTextColor}" ScrollViewer.VerticalScrollBarVisibility="Auto" Height="265"/>
|
||||
<ListBox x:Name="ReleaseBox" Background="{StaticResource ForegroundColor}" Margin="15,10" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" FontSize="14" Foreground="{StaticResource PrimaryTextColor}" ScrollViewer.VerticalScrollBarVisibility="Auto" Height="265"/>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="2" Background="{StaticResource ForegroundColor}">
|
||||
<Grid Grid.Row="2" Background="{StaticResource SecondaryColor}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<TextBlock x:Name="GenreBox" Grid.Row="4" Grid.Column="2" Background="{x:Null}" Foreground="{StaticResource PrimaryTextColor}" Margin="2,2,10,2" VerticalAlignment="Stretch" FontSize="16" TextWrapping="Wrap"/>
|
||||
<TextBlock x:Name="AlbumBox" Grid.Row="5" Grid.Column="2" Background="{x:Null}" Foreground="{StaticResource PrimaryTextColor}" Margin="2,2,10,2" VerticalAlignment="Stretch" FontSize="16" TextWrapping="Wrap"/>
|
||||
</Grid>
|
||||
<ListBox x:Name="IntegrationItemBox" Grid.Row="2" Grid.ColumnSpan="2" Background="{StaticResource SecondaryColor}" Margin="10" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" FontSize="14" Foreground="{StaticResource PrimaryTextColor}"/>
|
||||
<ListBox x:Name="IntegrationItemBox" Grid.Row="2" Grid.ColumnSpan="2" Background="{StaticResource ForegroundColor}" Margin="10" HorizontalContentAlignment="Stretch" BorderBrush="{x:Null}" FontSize="14" Foreground="{StaticResource PrimaryTextColor}"/>
|
||||
<Grid Grid.Row="3" Grid.ColumnSpan="2" Background="{StaticResource BackgroundColor}" Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
|
@ -56,7 +56,7 @@
|
|||
<TextBlock x:Name="Link" Grid.Column="0" Text="Test" Foreground="#3399FF" FontSize="14" VerticalAlignment="Center" Margin="10,0" MouseLeftButtonDown="Link_MouseLeftButtonDown" Cursor="Hand" TextTrimming="CharacterEllipsis"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2" Background="{StaticResource ForegroundColor}">
|
||||
<Grid Grid.Row="2" Background="{StaticResource SecondaryColor}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<Setter Property="TextTrimming" Value="WordEllipsis"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource PrimaryTextColor}"/>
|
||||
<Setter Property="FontSize" Value="16"/>
|
||||
<Setter Property="TextAlignment" Value="Right"/>
|
||||
<Setter Property="TextAlignment" Value="Left"/>
|
||||
</Style>
|
||||
<Style x:Key="Box" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||
<Setter Property="Background" Value="{x:Null}"/>
|
||||
|
@ -87,10 +87,10 @@
|
|||
<ColumnDefinition SharedSizeGroup="centerColumn" Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="AlbumArtistLabel" Margin="20,2,5,2" Grid.Row="1" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_ALBUMARTIST}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Right" />
|
||||
<TextBlock x:Name="ComposerLabel" Margin="20,2,5,2" Grid.Row="2" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_COMPOSER}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Right" />
|
||||
<TextBlock x:Name="TrackNumLabel" Margin="20,2,5,2" Grid.Row="3" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_TRACKNUM}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Right" />
|
||||
<TextBlock x:Name="DiscNumLabel" Margin="20,2,5,2" Grid.Row="4" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_DISCNUM}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Right" />
|
||||
<TextBlock x:Name="AlbumArtistLabel" Margin="20,2,5,2" Grid.Row="1" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_ALBUMARTIST}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Left" />
|
||||
<TextBlock x:Name="ComposerLabel" Margin="20,2,5,2" Grid.Row="2" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_COMPOSER}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Left" />
|
||||
<TextBlock x:Name="TrackNumLabel" Margin="20,2,5,2" Grid.Row="3" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_TRACKNUM}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Left" />
|
||||
<TextBlock x:Name="DiscNumLabel" Margin="20,2,5,2" Grid.Row="4" TextTrimming="WordEllipsis" Text="{x:Static resx:Resources.TAGEDITOR_DISCNUM}" Foreground="{StaticResource PrimaryTextColor}" FontSize="16" TextAlignment="Left" />
|
||||
|
||||
<TextBox x:Name="AlbumArtistBox" Grid.Row="1" Grid.Column="2" Background="{x:Null}" Foreground="{StaticResource PrimaryTextColor}" CaretBrush="{StaticResource PrimaryTextColor}" Margin="2,2,10,2" VerticalAlignment="Stretch" FontSize="16" TextChanged="TextChanged" TextWrapping="Wrap"/>
|
||||
<TextBox x:Name="ComposerBox" Grid.Row="2" Grid.Column="2" Background="{x:Null}" Foreground="{StaticResource PrimaryTextColor}" CaretBrush="{StaticResource PrimaryTextColor}" Margin="2,2,10,2" VerticalAlignment="Stretch" FontSize="16" TextChanged="TextChanged" TextWrapping="Wrap"/>
|
||||
|
@ -145,7 +145,7 @@
|
|||
</Grid>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<Grid Grid.Row="2" Background="{StaticResource ForegroundColor}">
|
||||
<Grid Grid.Row="2" Background="{StaticResource SecondaryColor}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="250" MaxWidth="250px"/>
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace FRESHMusicPlayer
|
|||
public GUILibrary Library;
|
||||
public IMetadataProvider CurrentTrack;
|
||||
|
||||
public const string WindowName = "FRESHMusicPlayer [Blueprint 11 b.10.24.2021; Not stable!]";
|
||||
public const string WindowName = "FRESHMusicPlayer [Blueprint 11 b.11.14.2021; Not stable!]";
|
||||
|
||||
public PlaytimeTrackingHandler TrackingHandler;
|
||||
public bool PauseAfterCurrentTrack = false;
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace FRESHMusicPlayer
|
|||
{
|
||||
if (isDragging && Player.FileLoaded)
|
||||
{
|
||||
Player.RepositionMusic((int)ProgressBar.Value);
|
||||
Player.CurrentTime = TimeSpan.FromSeconds(ProgressBar.Value);
|
||||
ProgressTick();
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ namespace FRESHMusicPlayer
|
|||
{
|
||||
if (Player.FileLoaded && !isDragging)
|
||||
{
|
||||
Player.RepositionMusic((int)ProgressBar.Value);
|
||||
Player.CurrentTime = TimeSpan.FromSeconds(ProgressBar.Value);
|
||||
ProgressTick();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace FRESHMusicPlayer
|
|||
private void Player_SongChanged(object sender, EventArgs e)
|
||||
{
|
||||
Mouse.OverrideCursor = null;
|
||||
CurrentTrack = Player.CurrentBackend.Metadata;
|
||||
CurrentTrack = Player.Metadata;
|
||||
Title = $"{string.Join(", ", CurrentTrack.Artists)} - {CurrentTrack.Title} | {WindowName}";
|
||||
TitleLabel.Text = CurrentTrack.Title;
|
||||
ArtistLabel.Text = string.Join(", ", CurrentTrack.Artists) == "" ? Properties.Resources.MAINWINDOW_NOARTIST : string.Join(", ", CurrentTrack.Artists);
|
||||
|
@ -150,17 +150,8 @@ namespace FRESHMusicPlayer
|
|||
UpdatePlayButtonState();
|
||||
if (CurrentTrack.CoverArt is null)
|
||||
{
|
||||
var file = GetCoverArtFromDirectory();
|
||||
if (file != null)
|
||||
{
|
||||
CoverArtBox.Source = BitmapFrame.Create(file, BitmapCreateOptions.None, BitmapCacheOption.None);
|
||||
SetCoverArtVisibility(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
CoverArtBox.Source = null;
|
||||
SetCoverArtVisibility(false);
|
||||
}
|
||||
CoverArtBox.Source = null;
|
||||
SetCoverArtVisibility(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -405,7 +396,7 @@ namespace FRESHMusicPlayer
|
|||
if (fields[0] != string.Empty)
|
||||
{
|
||||
await Player.PlayAsync(fields[0]);
|
||||
Player.RepositionMusic(int.Parse(fields[1]));
|
||||
Player.CurrentTime = TimeSpan.FromSeconds(int.Parse(fields[1]));
|
||||
PlayPauseMethod();
|
||||
ProgressTick();
|
||||
}
|
||||
|
@ -424,28 +415,7 @@ namespace FRESHMusicPlayer
|
|||
$";;{Top};{Left};{Height};{Width}");
|
||||
}
|
||||
}
|
||||
public MemoryStream GetCoverArtFromDirectory()
|
||||
{
|
||||
if (File.Exists(Player.FilePath))
|
||||
{
|
||||
var currentDirectory = Path.GetDirectoryName(Player.FilePath);
|
||||
foreach (var file in Directory.EnumerateFiles(currentDirectory))
|
||||
{
|
||||
if (Path.GetFileNameWithoutExtension(file).ToUpper() == "COVER" ||
|
||||
Path.GetFileNameWithoutExtension(file).ToUpper() == "ARTWORK" ||
|
||||
Path.GetFileNameWithoutExtension(file).ToUpper() == "FRONT" ||
|
||||
Path.GetFileNameWithoutExtension(file).ToUpper() == "BACK" ||
|
||||
Path.GetFileNameWithoutExtension(file).ToUpper() == Player.FilePath)
|
||||
{
|
||||
if (Path.GetExtension(file) == ".png" || Path.GetExtension(file) == ".jpg" || Path.GetExtension(file) == ".jpeg")
|
||||
{
|
||||
return new MemoryStream(File.ReadAllBytes(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void UpdateIntegrations()
|
||||
{
|
||||
if (Environment.OSVersion.Version.Major >= 10 && App.Config.IntegrateSMTC)
|
||||
|
|
|
@ -53,29 +53,20 @@ namespace FRESHMusicPlayer.Pages
|
|||
|
||||
private void Player_SongChanged(object sender, EventArgs e)
|
||||
{
|
||||
var CurrentTrack = window.Player.CurrentBackend.Metadata;
|
||||
TitleLabel.Text = CurrentTrack.Title;
|
||||
ArtistLabel.Text = string.Join(", ", CurrentTrack.Artists) == "" ? Properties.Resources.MAINWINDOW_NOARTIST : string.Join(", ", CurrentTrack.Artists);
|
||||
var currentTrack = window.Player.Metadata;
|
||||
TitleLabel.Text = currentTrack.Title;
|
||||
ArtistLabel.Text = string.Join(", ", currentTrack.Artists) == "" ? Properties.Resources.MAINWINDOW_NOARTIST : string.Join(", ", currentTrack.Artists);
|
||||
ProgressBar.Maximum = window.Player.CurrentBackend.TotalTime.TotalSeconds;
|
||||
if (window.Player.CurrentBackend.TotalTime.TotalSeconds != 0) ProgressIndicator2.Text = window.Player.CurrentBackend.TotalTime.ToString(@"mm\:ss");
|
||||
else ProgressIndicator2.Text = "∞";
|
||||
if (CurrentTrack.CoverArt is null)
|
||||
if (currentTrack.CoverArt is null)
|
||||
{
|
||||
var file = window.GetCoverArtFromDirectory();
|
||||
if (file != null)
|
||||
{
|
||||
CoverArtBox.Source = BitmapFrame.Create(file, BitmapCreateOptions.None, BitmapCacheOption.None);
|
||||
SetCoverArtVisibility(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
CoverArtBox.Source = null;
|
||||
SetCoverArtVisibility(false);
|
||||
}
|
||||
CoverArtBox.Source = null;
|
||||
SetCoverArtVisibility(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
CoverArtBox.Source = BackgroundCoverArtBox.Source = BitmapFrame.Create(new MemoryStream(CurrentTrack.CoverArt), BitmapCreateOptions.None, BitmapCacheOption.None);
|
||||
CoverArtBox.Source = BackgroundCoverArtBox.Source = BitmapFrame.Create(new MemoryStream(currentTrack.CoverArt), BitmapCreateOptions.None, BitmapCacheOption.None);
|
||||
SetCoverArtVisibility(true);
|
||||
}
|
||||
|
||||
|
@ -88,7 +79,7 @@ namespace FRESHMusicPlayer.Pages
|
|||
else
|
||||
{
|
||||
var trackInfo = new TrackInfo();
|
||||
trackInfo.Update(CurrentTrack);
|
||||
trackInfo.Update(currentTrack);
|
||||
InfoThing.Content = trackInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Linq;
|
|||
using FRESHMusicPlayer.Handlers.Notifications;
|
||||
using FRESHMusicPlayer.Handlers;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FRESHMusicPlayer.Pages.Library
|
||||
{
|
||||
|
@ -90,13 +91,21 @@ namespace FRESHMusicPlayer.Pages.Library
|
|||
|
||||
}
|
||||
|
||||
private void MainPanel_ContextMenuOpening(object sender, RoutedEventArgs e)
|
||||
private async void MainPanel_ContextMenuOpening(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MiscContext.Items.Clear();
|
||||
var playlists = library.Database.GetCollection<DatabasePlaylist>("playlists").Query().OrderBy("Name").ToEnumerable();
|
||||
foreach (var playlist in playlists)
|
||||
{
|
||||
var tracks = library.ReadTracksForPlaylist(playlist.Name);
|
||||
List<DatabaseTrack> tracks;
|
||||
try
|
||||
{
|
||||
tracks = await Task.Run(() => library.ReadTracksForPlaylist(playlist.Name));
|
||||
}
|
||||
catch
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var trackIsInPlaylist = tracks.Any(x => x.Path == FilePath);
|
||||
var item = new MenuItem
|
||||
{
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
<SolidColorBrush x:Key="ControlBoxColor" Color="#FF2C2F33"/>
|
||||
<SolidColorBrush x:Key="NavBarColor" Color="Black"/>
|
||||
<SolidColorBrush x:Key="ForegroundColor" Color="#FF2C2F33"/>
|
||||
<SolidColorBrush x:Key="SecondaryColor" Color="#FF46494E"/>
|
||||
<SolidColorBrush x:Key="SecondaryColor" Color="#FF3A3C40"/>
|
||||
<SolidColorBrush x:Key="BackgroundColor" Color="Black"/>
|
||||
</ResourceDictionary>
|
|
@ -5,7 +5,7 @@
|
|||
<Style x:Key="{x:Type Button}" TargetType="{x:Type Button}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Background" Value="{StaticResource SecondaryColor}"/>
|
||||
<Setter Property="Background" Value="{StaticResource ForegroundColor}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource PrimaryTextColor}"/>
|
||||
<Setter Property="Padding" Value="20,1"/>
|
||||
<Setter Property="Template">
|
||||
|
|
Loading…
Reference in a new issue