Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoC]Added very basic support of theme Pause/Resume music and Music name #57, #63 #78

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: ''
assignees: ashpynov

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[REQUEST]"
labels: ''
assignees: ashpynov

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,5 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/playnite
.vscode/

61 changes: 26 additions & 35 deletions Properties/AssemblyInfo.cs → AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,26 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PlayniteSounds")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlayniteSounds")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9c960604-b8bc-4407-a4e4-e291c6097c7d")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
// associated with an assembly.

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9c960604-b8bc-4407-a4e4-e291c6097c7d")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
1 change: 1 addition & 0 deletions Contributors.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
| **NAME** | **USERNAME** | **STATUS** |
| --- | --- | --- |
| Artem Shpynov | @ashpynov | Active |
| Willems Davy | @joyrider3774 | Active |
| Cameron Napolitano | @cnapolit | Active |
| Daniel Firsht | @dfirsht | - |
Expand Down
14 changes: 14 additions & 0 deletions Controls/MusicControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<PluginUserControl x:Class="PlayniteSounds.Controls.MusicControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PlayniteSounds.Controls"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:MusicControl}"

Tag="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Control, AncestorLevel=1}, Path=Tag}"
>


</PluginUserControl>
66 changes: 66 additions & 0 deletions Controls/MusicControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Playnite.SDK;
using Playnite.SDK.Controls;
using PlayniteSounds.Models;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;

namespace PlayniteSounds.Controls
{
public partial class MusicControl : PluginUserControl, INotifyPropertyChanged
{
private PlayniteSoundsSettings _settings;

static MusicControl()
{
TagProperty.OverrideMetadata(typeof(MusicControl), new FrameworkPropertyMetadata(-1, OnTagChanged));
}

public MusicControl(PlayniteSoundsSettings settings)
{
InitializeComponent();
DataContext = this;
_settings = settings;
_settings.PropertyChanged += OnSettingsChanged;
}
private static void OnTagChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as MusicControl).VideoIsPlaying = Convert.ToBoolean(e.NewValue);
}

public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}

public RelayCommand<bool> VideoPlayingCommand
=> new RelayCommand<bool>(videoIsPlaying => VideoIsPlaying = videoIsPlaying);

public string CurrentMusicName
{
get => _settings.CurrentMusicName;
set => _settings.CurrentMusicName = value;
}

public bool VideoIsPlaying
{
get => _settings.VideoIsPlaying;
set => _settings.VideoIsPlaying = value;
}

public void OnSettingsChanged( object sender, PropertyChangedEventArgs args)
{
if (args.PropertyName == nameof(_settings.VideoIsPlaying))
{
OnPropertyChanged(nameof(VideoPlayingCommand));
OnPropertyChanged(nameof(VideoIsPlaying));
}
else if (args.PropertyName == nameof(_settings.CurrentMusicName))
{
OnPropertyChanged(nameof(CurrentMusicName));
}
}
}
}
5 changes: 3 additions & 2 deletions Downloaders/DownloadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ public DownloadManager(PlayniteSoundsSettings settings)

public IEnumerable<Album> GetAlbumsForGame(string gameName, Source source, bool auto = false)
{
if ((source is Source.All || source is Source.Youtube) && string.IsNullOrWhiteSpace(_settings.FFmpegPath))
if ((source is Source.All || source is Source.Youtube)
&& (string.IsNullOrWhiteSpace(_settings.FFmpegPath) || string.IsNullOrWhiteSpace(_settings.YtDlpPath)))
{
throw new Exception("Cannot download from Youtube without the FFmpeg Path specified in settings.");
throw new Exception("Cannot download from Youtube without the FFmpeg and YT-DLP Paths specified in settings.");
}

if (source is Source.All)
Expand Down
Loading