Skip to content

Commit

Permalink
Add NTS Shows connector (#4480)
Browse files Browse the repository at this point in the history
* Working connector

* Changing to track the button on the player to allow for scrobbling all over the site, extending list of URLs

* Splitting into separate `getTrack` and `getArtist` functions

* Changing to nullish coalescing to avoid unnecessary checks

* fix title const from let

* Rename NTS to NTS Live for better disambiguation

* Remove trailing slashes from URLs to allow for search results etc.

* Increase spacing around info box
  • Loading branch information
HarrisonWilde committed Feb 8, 2024
1 parent 591734d commit 3992764
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
File renamed without changes.
28 changes: 28 additions & 0 deletions src/connectors/nts-shows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export {};

Connector.playerSelector = '.episode-player-wrapper';

Connector.isPlaying = () => {
const title = document.querySelector('.soundcloud-player__play-icon title');
if (title && title.textContent === 'Play') {
return false;
}
return true;
};

Connector.getTrack = () =>
document.querySelector(
'.episode-player-tracklist__track--is-playing .episode-player-tracklist__title',
)?.textContent;

Connector.getArtist = () =>
document.querySelector(
'.episode-player-tracklist__track--is-playing .episode-player-tracklist__artist',
)?.textContent;

Connector.scrobbleInfoLocationSelector = '.soundcloud-player__content';
Connector.scrobbleInfoStyle = {
...Connector.scrobbleInfoStyle,
fontSize: '0.5em',
marginLeft: '2em',
};
25 changes: 22 additions & 3 deletions src/core/connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2367,9 +2367,28 @@ export default <ConnectorMeta[]>[
id: 'zingmp3',
},
{
label: 'NTS',
label: 'NTS Live',
matches: ['*://*nts.live/live-tracklist/*'],
js: 'nts.js',
id: 'nts',
js: 'nts-live.js',
id: 'nts-live',
},
{
label: 'NTS Shows',
matches: [
'*://*nts.live/',
'*://*nts.live/latest*',
'*://*nts.live/shows*',
'*://*nts.live/explore*',
'*://*nts.live/infinite-mixtapes*',
'*://*nts.live/radio*',
'*://*nts.live/supporters*',
'*://*nts.live/my-nts*',
'*://*nts.live/events*',
'*://*nts.live/videos*',
'*://*nts.live/incoming*',
'*://*nts.live/about*',
],
js: 'nts-shows.js',
id: 'nts-shows',
},
];

0 comments on commit 3992764

Please sign in to comment.