-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notably, Radio won't enter an infinite loop if the user closes Discord. It'll still be running, but just sending useless data (since the socket is closed).
- Loading branch information
1 parent
10520e4
commit 1f609dd
Showing
5 changed files
with
86 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// DIscord.swift | ||
// Discord.swift | ||
// Radio | ||
// | ||
// Created by Kyle Erhabor on 5/9/23. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// Discord.swift | ||
// Radio | ||
// | ||
// Created by Kyle Erhabor on 5/9/23. | ||
// | ||
|
||
import Darwin | ||
import DiscordRPC | ||
|
||
struct RequestSetActivity: Encodable { | ||
let cmd: CommandType = .setActivity | ||
let nonce: String | ||
let args: RequestSetActivityArgs | ||
} | ||
|
||
struct RequestSetActivityArgs: Encodable { | ||
let pid = getpid() | ||
let activity: Activity | ||
} | ||
|
||
struct Activity: Encodable { | ||
let details: String? | ||
let state: String? | ||
let assets: ActivityAssets? | ||
} | ||
|
||
struct ActivityAssets: Encodable { | ||
let largeImage: String? | ||
let largeText: String? | ||
let smallImage: String? | ||
let smallText: String? | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case largeImage = "large_image" | ||
case largeText = "large_text" | ||
case smallImage = "small_image" | ||
case smallText = "small_text" | ||
} | ||
} |