Remove unnecessary code

This commit is contained in:
Diamond Creeper 2024-11-30 22:07:43 +13:00
parent 3a164c5599
commit 0775ab2a43
6 changed files with 2 additions and 66 deletions

View file

@ -2,10 +2,6 @@
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{06FF6B5D-B070-4DB7-9A87-9B6E280A794D}|JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj|c:\\users\\joshua\\documents\\github\\jellyfin-discord-rpc\\jellyfindiscordrpc\\jellyfindiscordrpc.csproj||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|",
"RelativeMoniker": "D:0:0:{06FF6B5D-B070-4DB7-9A87-9B6E280A794D}|JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj|solutionrelative:jellyfindiscordrpc\\jellyfindiscordrpc.csproj||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|"
},
{
"AbsoluteMoniker": "D:0:0:{06FF6B5D-B070-4DB7-9A87-9B6E280A794D}|JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj|c:\\users\\joshua\\documents\\github\\jellyfin-discord-rpc\\jellyfindiscordrpc\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{06FF6B5D-B070-4DB7-9A87-9B6E280A794D}|JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj|solutionrelative:jellyfindiscordrpc\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
@ -23,24 +19,12 @@
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "JellyfinDiscordRPC",
"DocumentMoniker": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj",
"RelativeDocumentMoniker": "JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj",
"ToolTip": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj",
"RelativeToolTip": "JellyfinDiscordRPC\\JellyfinDiscordRPC.csproj",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|",
"WhenOpened": "2024-11-30T08:49:04.842Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\JellyfinDiscordRPC\\Program.cs",
"RelativeDocumentMoniker": "JellyfinDiscordRPC\\Program.cs",
"ToolTip": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\JellyfinDiscordRPC\\Program.cs",
"RelativeToolTip": "JellyfinDiscordRPC\\Program.cs",
"ViewState": "AgIAANsAAAAAAAAAAAAAwBcBAAAmAAAAAAAAAA==",
"ViewState": "AgIAAAcAAAAAAAAAAAAAABQAAAApAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-30T05:30:39.706Z",
"EditorCaption": ""

View file

@ -24,7 +24,7 @@
"RelativeDocumentMoniker": "JellyfinDiscordRPC\\Program.cs",
"ToolTip": "C:\\Users\\joshua\\Documents\\GitHub\\jellyfin-discord-rpc\\JellyfinDiscordRPC\\Program.cs",
"RelativeToolTip": "JellyfinDiscordRPC\\Program.cs",
"ViewState": "AgIAAA4BAAAAAAAAAAAswBcBAAAmAAAAAAAAAA==",
"ViewState": "AgIAAAcAAAAAAAAAAAAAABQAAAApAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-30T05:30:39.706Z",
"EditorCaption": ""

View file

@ -32,58 +32,10 @@ class Program
// Poll Jellyfin API for currently playing media
var updateTask = UpdateRichPresence(); // Start the rich presence update task
// Command loop for toggling screen sharing
while (true)
{
var command = Console.ReadLine()?.ToLower();
if (command == "toggle")
{
ToggleScreenSharing();
}
else if (command == "exit")
{
break; // Exit the loop and end the program
}
else
{
Console.WriteLine("Invalid command. Type 'toggle' to toggle screen sharing or 'exit' to quit.");
}
}
await updateTask; // Wait for the rich presence update task to finish
}
private static void ToggleScreenSharing()
{
isScreenSharing = !isScreenSharing; // Toggle the screen sharing state
Console.WriteLine(isScreenSharing ? "Screen sharing enabled." : "Screen sharing disabled.");
UpdateDiscordPresence(); // Manually update Discord presence when toggling screen sharing
}
private static void UpdateDiscordPresence()
{
// Log the current status of screen sharing
Console.WriteLine($"Updating Discord Presence. Screen Sharing: {isScreenSharing}");
// Ensure we immediately update the Discord presence when toggling screen sharing
_discordClient.SetPresence(new RichPresence
{
Details = isScreenSharing ? "Sharing screen" : "Watching media",
State = isScreenSharing ? "Screen sharing is active" : "Not sharing screen",
Timestamps = new Timestamps
{
Start = DateTime.UtcNow
},
Assets = new Assets
{
LargeImageKey = isScreenSharing ? "screen_sharing" : "media_playing",
LargeImageText = isScreenSharing ? "Screen sharing on Discord" : "Watching media on Jellyfin"
}
});
Console.WriteLine("Presence updated successfully.");
}
private static async Task UpdateRichPresence()
{
while (true)