Skip to content

Instantly share code, notes, and snippets.

@jwshields
Created September 16, 2023 03:23
Show Gist options
  • Save jwshields/84a37ea576bc188b73884005556ee021 to your computer and use it in GitHub Desktop.
Save jwshields/84a37ea576bc188b73884005556ee021 to your computer and use it in GitHub Desktop.
Discord Rich Presence Integration - Album Artwork Uploader - Windows + Sharex + SFTP
$upload_fn=Resolve-Path -LiteralPath $input | Select-Object -ExpandProperty Path
Start-Process -WindowStyle Hidden -Wait -File "C:\Program Files\ShareX\ShareX.exe" -ArgumentList @("""$($upload_fn)"" -autoclose -m -nohotkeys") ; $UPLOAD_URL=Get-Clipboard
$UPLOAD_URL=Get-Clipboard
echo "$UPLOAD_URL"

Requirements: you must have at least Powershell 7. Configure the component in Foobar2000; in the advanced tab, enter pwsh C:\path\to\the\powershell\script\fb2k_discord_rich.ps1

Configure ShareX to utilize the FTP uploader for images, files, and text; preferrably, set it up so that you are using SCP/SFTP/SSH to upload the files to your server.
Prepare to have a web server already configured, and a location that you can write to easily.
In Sharex, also, configure your "Task Settings" -> Upload -> File Naming - I personally have all my files named with this pattern: `%pn_%ra{25}`
```
"FTPAccountList": [
{
"Name": "my_server_lol",
"Protocol": "SFTP",
"Host": "999.999.999.99",
"Port": 65539,
"Username": "root",
"Password": "toor,
"IsActive": true,
"SubFolderPath": "/some/path/to/my/webserver/html/some_subdir",
"BrowserProtocol": "https",
"HttpHomePath": "example.com/some_subdir",
"HttpHomePathAutoAddSubFolderPath": false,
"HttpHomePathNoExtension": false,
"FTPSEncryption": "Explicit",
"FTPSCertificateLocation": "",
"Keypath": "/not/a/real/path/to/my/ssh/private/key/dot.pem",
"Passphrase": null
}
],
"FTPSelectedImage": 1,
"FTPSelectedText": 1,
"FTPSelectedFile": 1,
```
I use this configuration with Foobar and Discord for displaying my media, and I find it works very well to convey a large amount of information about the music that is currently playing.
Top Field: `[%artist%] - [%album%] [$if($greater(%discnumber%,0), ' - Disc '%discnumber%$ifgreater(%totaldiscs%,0,'/'%totaldiscs%,),)] ['['%year%']']`
Bottom Field: `[%title%] '- ['[$if($greater(%totaltracks%,0),%tracknumber%/%totaltracks%,%tracknumber%)']']`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment