-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GPMDP and strip default foobar2k suffix
- Loading branch information
Showing
4 changed files
with
67 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Handler from './../Handler'; | ||
import { getProcessByName } from '@pendo324/get-process-by-name'; | ||
|
||
class GpmdpHandler extends Handler { | ||
constructor() { | ||
super({ | ||
os: 'win32', | ||
source: 'Desktop', | ||
id: 'gpmdp', | ||
name: 'Google Play Desktop Player' | ||
}); | ||
} | ||
|
||
async getTrack() { | ||
const processes = ( | ||
await getProcessByName('Google Play Music Desktop Player.exe') | ||
).filter((t) => t.windowTitle && t.windowTitle.length > 0); | ||
|
||
if (!processes.length) { | ||
// TODO: add better check/error handling here | ||
// alert('Tool needs updating.'); | ||
return ''; | ||
} | ||
|
||
const windowTitle = processes[0].windowTitle; | ||
|
||
if (windowTitle.startsWith('(Paused)')) { | ||
return 'Paused.'; | ||
} | ||
|
||
if ( | ||
windowTitle === 'Google Play Music Desktop Player' || | ||
windowTitle === 'crash service' | ||
) { | ||
return ''; | ||
} | ||
|
||
return windowTitle; | ||
} | ||
} | ||
|
||
export default GpmdpHandler; |
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,12 @@ | ||
import { remote } from 'electron'; | ||
const { platform } = remote.require('os'); | ||
|
||
export const supportedPlatforms = ['win32']; | ||
|
||
const platformHandler = supportedPlatforms.find((p) => platform() === p); | ||
|
||
if (typeof platformHandler === 'undefined') { | ||
throw new Error('Platform not supported.'); | ||
} | ||
|
||
export default require(`./gpmdpHandler_${platformHandler}`).default; |
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