initial commit

This commit is contained in:
Brandon4466
2025-03-31 04:45:14 -07:00
commit ff59c4c0b8
2298 changed files with 478992 additions and 0 deletions

37
get-media.ps1 Normal file
View File

@@ -0,0 +1,37 @@
$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
}