fixes improvements stuff

This commit is contained in:
Royce551 2021-05-02 07:17:42 -05:00
parent 518bee5c30
commit 92185100a9
5 changed files with 34 additions and 10 deletions

View file

@ -397,7 +397,7 @@ namespace FRESHMusicPlayer.ViewModels
set => this.RaiseAndSetIfChanged(ref filePathOrURL, value);
}
private List<string> acceptableFilePaths = "*.wav;*.aiff;*.mp3;*.wma;*.3g2;*.3gp;*.3gp2;*.3gpp;*.asf;*.wmv;*.aac;*.adts;*.avi;*.m4a;*.m4a;*.m4v;*.mov;*.mp4;*.sami;*.smi;*.flac".Split(';').ToList();
private List<string> acceptableFilePaths = "wav;aiff;mp3;wma;3g2;3gp;3gp2;3gpp;asf;wmv;aac;adts;avi;m4a;m4a;m4v;mov;mp4;sami;smi;flac".Split(';').ToList();
// ripped directly from fmp-wpf 'cause i'm lazy
public async void BrowseTracksCommand()
{
@ -413,9 +413,10 @@ namespace FRESHMusicPlayer.ViewModels
new FileDialogFilter()
{
Name = "Other",
Extensions = new List<string>(){"*"}
Extensions = new List<string>() { "*" }
}
}
},
AllowMultiple = true
};
if (Avalonia.Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
@ -433,7 +434,7 @@ namespace FRESHMusicPlayer.ViewModels
new FileDialogFilter()
{
Name = "Playlist Files",
Extensions = new(){ "*.xspf", "*.asx", "*.wvx", "*.b4s", "*.m3u", "*.m3u8", "*.pls", "*.smil", "*.smi", "*.zpl"}
Extensions = new(){ "xspf", "asx", "wvx", "b4s", "m3u", "m3u8", "pls", "smil", "smi", "zpl"}
}
}
};

View file

@ -7,7 +7,7 @@
xmlns:local="clr-namespace:FRESHMusicPlayer.Forms"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
WindowStyle="None" Background="Transparent" AllowsTransparency="True" Topmost="True" ResizeMode="CanMinimize"
WindowStyle="None" Background="Transparent" AllowsTransparency="True" Topmost="True" ResizeMode="CanMinimize" LocationChanged="Window_LocationChanged"
Title="MiniPlayer" Height="55" Width="500">
<DockPanel x:Name="BackgroundDockPanel" Background="Transparent" MouseEnter="DockPanel_MouseEnter" MouseLeave="DockPanel_MouseLeave">
<DockPanel x:Name="TitlebarDockPanel" DockPanel.Dock="Top" Background="{StaticResource ForegroundColor}" Height="30" LastChildFill="False" MouseDown="TitlebarDockPanel_MouseDown" Opacity="100">

View file

@ -9,6 +9,7 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
@ -78,6 +79,8 @@ namespace FRESHMusicPlayer.Forms
private void DockPanel_MouseEnter(object sender, MouseEventArgs e)
{
var fadeIn = InterfaceUtils.GetDoubleAnimation(0f, 1f, TimeSpan.FromMilliseconds(500), new PropertyPath("Opacity"));
fadeIn.Begin(TitlebarDockPanel);
var brightener = InterfaceUtils.GetDoubleAnimation(0.8, 1f, TimeSpan.FromMilliseconds(500), new PropertyPath("Opacity"));
@ -148,5 +151,22 @@ namespace FRESHMusicPlayer.Forms
window.Player.Volume = (float)(VolumeSlider.Value / 100);
window.VolumeBar.Value = VolumeSlider.Value;
}
private void Window_LocationChanged(object sender, EventArgs e)
{
var currentScreen = WinForms.Screen.FromHandle(new WindowInteropHelper(this).Handle).Bounds;
var window = new System.Drawing.Rectangle((int)Left, (int)Top, (int)Width, (int)Height);
var topHalf = new System.Drawing.Rectangle(currentScreen.X, currentScreen.Y, currentScreen.Width, currentScreen.Height / 2);
if (topHalf.Contains(window))
{
DockPanel.SetDock(ContentGrid, Dock.Top);
DockPanel.SetDock(TitlebarDockPanel, Dock.Bottom);
}
else
{
DockPanel.SetDock(ContentGrid, Dock.Bottom);
DockPanel.SetDock(TitlebarDockPanel, Dock.Top);
}
}
}
}

View file

@ -47,7 +47,7 @@ namespace FRESHMusicPlayer.Forms.TagEditor.Integrations
{
var releases = new List<(string Name, string Id)>();
string jsonString;
try { jsonString = httpClient.GetStringAsync($"https://api.discogs.com/database/search?q={{{query}}}&{{track}}&per_page=1&key={Key}&secret={Secret}").Result; }
try { jsonString = httpClient.GetStringAsync($"https://api.discogs.com/database/search?release_title={query}&type=release&per_page=100&key={Key}&secret={Secret}").Result; }
catch (AggregateException)
{
Worked = false;

View file

@ -107,16 +107,19 @@ namespace FRESHMusicPlayer
Dispatcher.Invoke(() =>
{
var files = File.ReadAllLines(args.FullPath);
if (files.Length != 0)
if (files.Length != 0) // user wants to play a file
{
player.Queue.Clear();
player.Queue.Add(files);
player.PlayMusic();
}
else // user might've forgotten fmp is open, let's flash
{
Activate();
Topmost = true;
Topmost = false;
}
File.Delete(args.FullPath);
Activate();
Topmost = true;
Topmost = false;
});
};
LoggingHandler.Log("Ready to go!");