Skip to content
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
11 changes: 0 additions & 11 deletions DiscordPresenceConfig.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
music.ui=true=807774172574253056
spotify=true=802222525110812725
musicbee=true=820837854385012766
microsoft.media.player=true=807774172574253056
wmplayer=true=807774172574253056
wavelink=true=927328178618376212
tidal=true=922625678271197215
amazon music=true=808571949227049000
mediamonkeyengine=true=1096929771511873587
foobar2000=true=1009193842211299428

verbose=false
debug missing player=false
#spotify-style-rp:
Expand Down
207 changes: 91 additions & 116 deletions MDRP/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace MDRP
internal partial class Program
{
public static LangHelper langHelper = new LangHelper();
public const string Version = "1.7.3";
public const string Version = "1.8.0";
public const string Github = "https://github.com/jojo2357/Music-Discord-Rich-Presence";
public static readonly string Title = langHelper.get(LocalizableStrings.MDRP_FULL);
private const int titleLength = 64;
Expand All @@ -34,20 +34,9 @@ internal partial class Program
new Uri("https://api.github.com/repos/jojo2357/Music-Discord-Rich-Presence/releases/latest");

//Player Name, client
private static readonly Dictionary<string, DiscordRpcClient> DefaultClients =
private static Dictionary<string, DiscordRpcClient> DefaultClients =
new Dictionary<string, DiscordRpcClient>
{
{ "music.ui", new DiscordRpcClient("807774172574253056", autoEvents: false) },
{ "microsoft.media.player", new DiscordRpcClient("807774172574253056", autoEvents: false) },
{ "wmplayer", new DiscordRpcClient("807774172574253056", autoEvents: false) },
{ "musicbee", new DiscordRpcClient("820837854385012766", autoEvents: false) },
{ "spotify", new DiscordRpcClient("802222525110812725", autoEvents: false) },
{ "tidal", new DiscordRpcClient("922625678271197215", autoEvents: false) },
{ "tidalplayer", new DiscordRpcClient("922625678271197215", autoEvents: false) },
{ "wavelink", new DiscordRpcClient("927328178618376212", autoEvents: false) },
{ "amazon music", new DiscordRpcClient("807774172574253056", autoEvents: false) },
{ "mediamonkeyengine", new DiscordRpcClient("1096929771511873587", autoEvents: false) },
{ "foobar2000", new DiscordRpcClient("1009193842211299428", autoEvents: false) },
{ "", new DiscordRpcClient("821398156905283585", autoEvents: false) }
};

Expand All @@ -69,115 +58,26 @@ internal partial class Program

//ID, process name
//process name, enabled y/n
private static readonly Dictionary<string, bool> EnabledClients = new Dictionary<string, bool>
{
{ "music.ui", true }
};
private static readonly Dictionary<string, bool> EnabledClients = new Dictionary<string, bool>();

private static readonly Dictionary<string, ConsoleColor> PlayerColors = new Dictionary<string, ConsoleColor>
{
{ "music.ui", ConsoleColor.Blue },
{ "microsoft.media.player", ConsoleColor.Blue },
{ "wmplayer", ConsoleColor.Blue },
{ "spotify", ConsoleColor.DarkGreen },
{ "musicbee", ConsoleColor.Yellow },
{ "tidal", ConsoleColor.Gray },
{ "tidalplayer", ConsoleColor.Gray },
{ "wavelink", ConsoleColor.DarkBlue },
{ "amazon music", ConsoleColor.Gray },
{ "foobar2000", ConsoleColor.DarkCyan},
{"mediamonkeyengine", ConsoleColor.Yellow}
};
private static Dictionary<string, ConsoleColor> PlayerColors = new Dictionary<string, ConsoleColor>();

private static string _presenceDetails = string.Empty;

private static readonly string[] ValidPlayers =
{
"music.ui", "spotify", "musicbee", "microsoft.media.player", "wmplayer", "tidal", "tidalplayer", "wavelink", "amazon music", "foobar2000", "mediamonkeyengine"
};
private static List<string> ValidPlayers = new List<string>();

private static readonly string[] RequiresPipeline = { "musicbee" };

//For use in settings
private static readonly Dictionary<string, string> Aliases = new Dictionary<string, string>
{
{ "musicbee", "Music Bee" },
{ "spotify", "Spotify Music" },
{ "groove", "Groove Music Player" },
{ "microsoft.media.player", "Windows Media Player" },
{ "wmplayer", "Windows Media Player" },
{ "music.ui", "Groove Music Player" },
{ "tidal", "Tidal Music" },
{ "tidalplayer", "Tidal Music" },
{ "wavelink", "Wave Link" },
{ "amazon music", "Amazon Music" },
{ "foobar2000", "FooBar2000"},
{ "mediamonkeyengine", "MediaMonkey5"}
};

private static readonly Dictionary<string, string> BigAssets = new Dictionary<string, string>
{
{ "musicbee", "https://cdn.discordapp.com/app-assets/820837854385012766/820838584617009222.png" },
{ "music.ui", "https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png" },
{ "amazon music", "https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png" },
{
"microsoft.media.player",
"https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png"
},
{ "spotify", "https://cdn.discordapp.com/app-assets/802222525110812725/802222954821582869.png" },
{ "tidal", "https://cdn.discordapp.com/app-assets/922625678271197215/978018192393920562.png" },
{ "tidalplayer", "https://cdn.discordapp.com/app-assets/922625678271197215/978018192393920562.png" },
{ "wavelink", "https://cdn.discordapp.com/app-assets/927328178618376212/927329727180574760.png" },
{ "foobar2000", "https://cdn.discordapp.com/app-assets/1009193842211299428/1009196080853950464.png" },
{"mediamonkeyengine", "https://cdn.discordapp.com/app-assets/1096929771511873587/1096930933325713519.png"}
};

//might just combine these later
private static readonly Dictionary<string, string> LittleAssets = new Dictionary<string, string>
{
{ "musicbee", "https://cdn.discordapp.com/app-assets/820837854385012766/820838635703500810.png" },
{ "music.ui", "https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png" },
{ "amazon music", "https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png" },
{
"microsoft.media.player",
"https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png"
},
{ "spotify", "https://cdn.discordapp.com/app-assets/802222525110812725/802222992683827200.png" },
{ "tidal", "https://cdn.discordapp.com/app-assets/922625678271197215/978018192637198406.png" },
{ "tidalplayer", "https://cdn.discordapp.com/app-assets/922625678271197215/978018192637198406.png" },
{ "wavelink", "https://cdn.discordapp.com/app-assets/927328178618376212/927329727218319410.png" },
{ "foobar2000", "https://cdn.discordapp.com/app-assets/1009193842211299428/1009196080950423563.png" },
{"mediamonkeyengine", "https://cdn.discordapp.com/app-assets/1096929771511873587/1096930933325713519.png"}
};

private static readonly Dictionary<string, string> Whatpeoplecallthisplayer = new Dictionary<string, string>
{
{ "musicbee", "Music Bee" },
{ "music.ui", "Groove Music" },
{ "microsoft.media.player", "Windows Media Player" },
{ "wmplayer", "Windows Media Player" },
{ "spotify", "Spotify" },
{ "tidal", "Tidal Music" },
{ "tidalplayer", "Tidal Music" },
{ "wavelink", "Wave Link" },
{ "amazon music", "Amazon Music" },
{ "foobar2000", "FooBar2000"},
{"mediamonkeyengine", "MediaMonkey5"}
};

private static readonly Dictionary<string, string> InverseWhatpeoplecallthisplayer =
new Dictionary<string, string>
{
{ "musicbee", "musicbee" },
{ "groove", "music.ui" },
{ "Microsoft.Media.Player", "microsoft.media.player" },
{ "spotify", "spotify" },
{ "Tidal Music", "tidal" },
{ "Wave Link", "wavelink" },
{ "Amazon Music", "anazon music" },
{ "FooBar2000", "foobar2000"},
{"MediaMonkey5", "mediamonkeyengine"}
};
private static Dictionary<string, string> Aliases = new Dictionary<string, string> ();

private static Dictionary<string, string> BigAssets = new Dictionary<string, string>();

private static Dictionary<string, string> LittleAssets = new Dictionary<string, string>();

private static Dictionary<string, string> Whatpeoplecallthisplayer = new Dictionary<string, string>();

private static Dictionary<string, string> InverseWhatpeoplecallthisplayer = new Dictionary<string, string>();

private static readonly string defaultPlayer = "groove";
private static readonly int timeout_seconds = 60;
Expand Down Expand Up @@ -1266,6 +1166,80 @@ private static bool IsUsingAudio()

private static void LoadSettings()
{
try
{
string[] lines = File.ReadAllLines("../../../SupportedPlayers.dat");
int iterator = 0;
foreach (string line in lines)
{
iterator++;
if (!line.StartsWith("#") && !string.IsNullOrWhiteSpace(line))
{
string[] explodedLine = Regex.Split(line, @"==");
if (explodedLine.Length != 6)
{
Functions.SendToDebugServer("Invalid formatting on line " + iterator + ". Please follow the format 'executable name==display name==enabled==discord application id==console color==asset link'");
}
else
{
try
{
if (bool.Parse(explodedLine[2]))
{
//Format: executable name==display name==enabled==discord application id==console color==asset link
string execName = explodedLine[0];
if (!EnabledClients.ContainsKey(execName))
{
string displayName = explodedLine[1];
string appid = explodedLine[3];
ConsoleColor color;
if (Enum.IsDefined(typeof(ConsoleColor), explodedLine[4]))
{
color =
(ConsoleColor)Enum.Parse(typeof(ConsoleColor), explodedLine[4], true);
}
else
{
Functions.SendToDebugServer("The color '" + explodedLine[4] +
"' is not a valid ConsoleColor in C#. Defaulting to ConsoleColor.Gray");
color = ConsoleColor.Gray;
}

string assetLink = explodedLine[5];

EnabledClients.Add(execName, explodedLine[2].ToLower() == "true");
DefaultClients.Add(execName, new DiscordRpcClient(appid, autoEvents: false));
PlayerColors.Add(execName, color);
Aliases.Add(execName, displayName);
BigAssets.Add(execName, assetLink);
LittleAssets.Add(execName, assetLink);
Whatpeoplecallthisplayer.Add(execName, displayName);
if (!InverseWhatpeoplecallthisplayer.ContainsKey(displayName))
InverseWhatpeoplecallthisplayer.Add(displayName, execName);
ValidPlayers.Add(execName);
}
else
{
Functions.SendToDebugServer("Duplicated executable on line " + iterator + ", skipping");
}
}
}

catch (Exception e)
{
Functions.SendToDebugServer(e);
Functions.SendToDebugServer("Invalid formatting on line " + iterator +
". Please follow the format 'executable name==display name==enabled==discord application id==console color==asset link'");
}
}
}
}
}
catch (Exception e)
{
Functions.SendToDebugServer("SupportedPlayers.dat could not be found");
Functions.SendToDebugServer(e);
}
try
{
string[] lines = File.ReadAllLines("../../../DiscordPresenceConfig.ini");
Expand All @@ -1276,6 +1250,7 @@ private static void LoadSettings()
string firstPortion = firstPortionRaw.Trim().ToLower();
string secondPortionRaw = explodedLine.Length > 1 ? explodedLine[1] : "";
string secondPortion = secondPortionRaw.Trim().ToLower();
/*
if (ValidPlayers.Contains(firstPortion))
{
EnabledClients[firstPortionRaw] = secondPortion == "true";
Expand All @@ -1292,7 +1267,7 @@ private static void LoadSettings()
DefaultClients[InverseWhatpeoplecallthisplayer[firstPortionRaw]] =
new DiscordRpcClient(explodedLine[2], autoEvents: false);
}
else if (firstPortion == "verbose" && explodedLine.Length > 1)
else */if (firstPortion == "verbose" && explodedLine.Length > 1)
{
ScreamAtUser = secondPortion == "true";
}
Expand Down Expand Up @@ -1506,7 +1481,7 @@ private static void parseWildcardKeying(string[] lines)
}

foreach (string playerCandidate in lines[0].Split('=')[1] == "*"
? ValidPlayers
? ValidPlayers.ToArray()
: lines[0].Split('=')[1].ToLower().Split(','))
{
if (useDefaults)
Expand Down
Binary file modified MDRP/bin/Release/MDRP.exe
Binary file not shown.
27 changes: 25 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ There may be more to come, time will tell.

\* Note for Tidal, may not work for some users. Has been successfully tested on windows 10 and 11, on the free version on computers that MDRP works with either Groove or WMP. Paid versions of Tidal may experience issues, and older versions of Tidal will not work because they changed the exe name.

\*\* Very unreliable due to Amazon Music not reporting its media to WMC properly, so there is nothing that MDRP can to
\*\* Very unreliable due to Amazon Music not reporting its media to Windows Media Controls (referred to as WMC) properly, so there is nothing that MDRP can do

### If you have a version below 1.7, please refer to the [old readme](https://github.com/jojo2357/Music-Discord-Rich-Presence/blob/1.6.4/README.MD) or update your entire MDRP installation from scratch

Expand All @@ -29,6 +29,7 @@ There may be more to come, time will tell.
- Includes batch scripts to run MDRP when your music player is started, and will close MDRP when your player closes
- Can toggle on or off certain music players
- Can change the default name of the application in Discord, so you could have `Playing Music` instead of `Playing Groove Music`
- Ability to add your own music player support, assuming the player outputs to WMC properly

## Setup
0. Download the [latest release](https://github.com/jojo2357/Music-Discord-Rich-Presence/releases/latest)
Expand Down Expand Up @@ -68,12 +69,34 @@ You can set in the settings file `get remote artwork` and `create cache file`. T
Right now you can only use the old library, so don't use this for now.

### The Spotify Way
If you would like to key all of your Spotify playlists, go to the [MDRP website](https://mdrp.tech/fetchalbumart) (under construction, please be patient) and click `Regenerate Token`, then select either `Include Artists` (recommended) or `Exclude Artists` and then download the dat (may take up to 5 minutes if you have a ton of songs) and place it in your clientdata folder.
If you would like to key all of your Spotify playlists, go to the [MDRP website](https://smaltin.dev/fetchalbumart) (under construction, please be patient) and click `Regenerate Token`, then select either `Include Artists` (recommended) or `Exclude Artists` and then download the dat (may take up to 5 minutes if you have a ton of songs) and place it in your clientdata folder.

## Changing MDRP Settings
To change any MDRP settings, they will all be located in your `DiscordPresenceConfig.ini` file.\
Data in this file is in `key=value` pairs so any line that does not have a `=` will be ignored.

### Adding a custom player
*Assuming the player outputs properly to WMC*, it can be added as a new player. Open `SupportedPlayers.dat` and following the schema below, fill out the information.

`executable name==display name==enabled==discord application id==console color==asset link`

Discord application id can be created by navigating to the [Discord developer dashboard](https://discord.com/developers/applications) and creating an application. The asset link should be a link to the player's icon, this is what you'll see as both the small icon and the large one if no album art is keyed.

The console color should be a valid [ConsoleColor](https://learn.microsoft.com/en-us/dotnet/api/system.consolecolor?view=net-8.0#fields), as seen in the image below:

![ConsoleColors](assets/consolecolors.png)

To complete the process, open `DiscordPresenceConfig.ini` and follow the format `executable name=enabled=discord application id` in a similar style to the above.

If this doesn't work, either the formatting is not correct or the application does not output to WMC and will not work with MDRP.

#### How do I know if my media player inputs to WMC properly?
This depends on what version of Windows you are running.

On Windows 11, you can press the volume icon on your taskbar and if the song information is displayed in the media section it should work properly.

On Windows 10, you can use the media keys to change the volume, the information should be displayed in the volume control. If this is the case, it should work properly.

### Changing default background
In the ini config file, there is the option to change the default background on a per-player setting. The schema is `large <player> asset=url/application asset`. For example, to change the default background of MusicBee to the album cover of "My Head is an Animal", you would put:

Expand Down
15 changes: 15 additions & 0 deletions SupportedPlayers.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#Format: executable name==display name==enabled==discord application id==console color==asset link
musicbee==Music Bee==true==820837854385012766==Yellow==https://cdn.discordapp.com/app-assets/820837854385012766/820838584617009222.png
groove==Groove Music==true==807774172574253056==Blue==https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png
music.ui==Groove Music==true==807774172574253056==Blue==https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png
microsoft.media.player==Windows Media Player==true==807774172574253056==Blue==https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png
wmplayer==Windows Media Player==true==807774172574253056==Blue==https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png
spotify==Spotify==true==802222525110812725==DarkGreen==https://cdn.discordapp.com/app-assets/802222525110812725/802222954821582869.png
tidal==Tidal Music==true==922625678271197215==Gray==https://cdn.discordapp.com/app-assets/922625678271197215/978018192393920562.png
tidalplayer==Tidal Music==true==922625678271197215==Gray==https://cdn.discordapp.com/app-assets/922625678271197215/978018192393920562.png
wavelink==Wave Link==true==927328178618376212==DarkBlue==https://cdn.discordapp.com/app-assets/927328178618376212/927329727180574760.png
amazon music==Amazon Music==true==807774172574253056==Gray==https://cdn.discordapp.com/app-assets/801209905020272681/801224923547959376.png
foobar2000==FooBar2000==true==1009193842211299428==DarkCyan==https://cdn.discordapp.com/app-assets/1009193842211299428/1009196080853950464.png
mediamonkeyengine==MediaMonkey5==true==1096929771511873587==Yellow==https://cdn.discordapp.com/app-assets/1096929771511873587/1096930933325713519.png
msedge==Soundcloud==false==1223074808540037310==Red==https://cdn.discordapp.com/app-assets/1223074808540037310/1223076877313376346.png
amplibraryagent==Apple Music==true==868974911178285056==Red==https://cdn.discordapp.com/app-assets/868974911178285056/868975029411545128.png
Binary file added assets/consolecolors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading