From 926339eb4a3f7a16725e99047f2bc7ca6a1d7f91 Mon Sep 17 00:00:00 2001 From: Omar Saleem Date: Fri, 15 Mar 2024 22:30:24 -0400 Subject: [PATCH] Add AzuraCast connector (#4567) * Adding AzuraCast connector to connectors.ts * Created azuracast.ts * First attempt at azuracast.ts * missed an end ' * fixed lint errors * ran prettierfix * adding wildcard in connectors.ts to pass test * had logic for playing check backwards * adjusting button detection * Update src/core/connectors.ts removing unnecessary url match Co-authored-by: yayuyokitano <69117606+yayuyokitano@users.noreply.github.com> --------- Co-authored-by: yayuyokitano <69117606+yayuyokitano@users.noreply.github.com> --- src/connectors/azuracast.ts | 16 ++++++++++++++++ src/core/connectors.ts | 5 +++++ 2 files changed, 21 insertions(+) create mode 100644 src/connectors/azuracast.ts diff --git a/src/connectors/azuracast.ts b/src/connectors/azuracast.ts new file mode 100644 index 0000000000..0a7101a943 --- /dev/null +++ b/src/connectors/azuracast.ts @@ -0,0 +1,16 @@ +Connector.useMediaSessionApi(); + +Connector.playerSelector = '.radio-player-widget'; + +Connector.artistSelector = + '.now-playing-details .now-playing-main div.now-playing-artist'; + +Connector.trackSelector = '.now-playing-title'; + +Connector.trackArtSelector = '.now-playing-art .album-art .album-art'; + +Connector.isPlaying = () => + Util.getAttrFromSelectors( + '.radio-controls .radio-control-play-button', + 'title', + ) === 'Stop'; diff --git a/src/core/connectors.ts b/src/core/connectors.ts index a1ccf2d316..be7e9ff771 100644 --- a/src/core/connectors.ts +++ b/src/core/connectors.ts @@ -2397,4 +2397,9 @@ export default [ js: 'earth.fm.js', id: 'earthfm', }, + { + label: 'AzuraCast', + js: 'azuracast.js', + id: 'azuracast', + }, ];