Skip to content

Commit

Permalink
v0.9.1 Playback Location hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsRiprod committed Oct 31, 2024
1 parent 02c653b commit 1da22f4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 19 additions & 2 deletions DeskThingServer/src/main/handlers/musicHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,17 @@ export class MusicHandler {
private handleSettingsUpdate = (settings: Settings): void => {
this.updateRefreshInterval(settings.refreshInterval)

if (settings.playbackLocation && settings.playbackLocation !== this.currentApp) {
dataListener.asyncEmit(
MESSAGE_TYPES.LOGGING,
`[MusicHandler]: Received settings update - checking for changes`
)
if (settings.playbackLocation) {
dataListener.asyncEmit(
MESSAGE_TYPES.LOGGING,
`[MusicHandler]: Setting restarting to use ${settings.playbackLocation}`
)
this.currentApp = settings.playbackLocation
this.refreshMusicData()
}
}

Expand Down Expand Up @@ -80,7 +89,15 @@ export class MusicHandler {
}

public async handleClientRequest(request: SocketData): Promise<void> {
if (!this.currentApp) return
if (!this.currentApp) {
const settings = await settingsStore.getSettings()
if (settings.playbackLocation) {
this.currentApp = settings.playbackLocation
} else {
dataListener.asyncEmit(MESSAGE_TYPES.ERROR, `[MusicHandler]: No playback location set!`)
return
}
}
if (request.app != 'music' && request.app != 'utility') return

if (request.app == 'utility') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const MusicSettings: React.FC = () => {

const handleSettingChange = (key: string, value: string | boolean | number | string[]): void => {
setSettings({ ...settings, [key]: value })
console.log('Settings Updated:', settings)
}

const handleSave = async (): Promise<void> => {
Expand Down Expand Up @@ -79,6 +80,7 @@ const MusicSettings: React.FC = () => {
onChange={(e) => {
handleSettingChange('playbackLocation', e.target.value)
}}
defaultValue={'Unset'}
className="bg-zinc-900 rounded hover:cursor-pointer text-white px-2 py-2"
>
{audioSources.map((app) => (
Expand Down

0 comments on commit 1da22f4

Please sign in to comment.