inital commit

This commit is contained in:
Brandon4466
2025-04-08 14:15:57 -07:00
commit 292ae841f6
936 changed files with 361034 additions and 0 deletions

36
get-media.ps1 Normal file
View File

@@ -0,0 +1,36 @@
$processes = Get-Process spotify
$title = (Out-String -InputObject $processes.mainWindowTitle) -replace "`n","" -replace "`r",""
$song = $null
if (-Not $title.Contains('Spotify')) {
$song = $title
}
if ($song) {
# Split the title into artist and song (assuming "Artist - Title" format)
if ($song -match "^(.*) - (.*)$") {
$artist = $Matches[1]
$songTitle = $Matches[2]
$jsonOutput = @{
title = $songTitle
artist = $artist
amUri = "" # Spotify doesn't directly provide an "amUri" equivalent
} | ConvertTo-Json
Write-Output $jsonOutput
} else {
#If it doesn't match the artist - title format, just send the title.
$jsonOutput = @{
title = $song
artist = "Unknown"
amUri = ""
} | ConvertTo-Json
Write-Output $jsonOutput
}
} else {
# Send empty JSON if no song is playing
$jsonOutput = @{
title = ""
artist = ""
amUri = ""
} | ConvertTo-Json
Write-Output $jsonOutput
}