<commit_before>'use strict';

Connector.playerSelector = '#page_sidebar';

Connector.getArtist = () => {
	let artists = $('.player-track-artist').children().toArray();
	return Util.joinArtists(artists);
};

Connector.trackSelector = '.player-track-title';

Connector.currentTimeSelector = '.player-progress .progress-time';

Connector.durationSelector = '.player-progress .progress-length';

Connector.trackArtSelector = '.player-cover img';

Connector.filter = MetadataFilter.getRemasteredFilter().extend(MetadataFilter.getDoubleTitleFilter());

Connector.isPlaying = () => $('#player .svg-icon-pause').length > 0;<commit_msg>additional support for new deezer page layout (#1714)<commit_after>'use strict';

setupConnector();

function setupConnector() {
	if (isNewDeezer()) {
		setupNewDeezer();
	} else {
		setupOldDeezer();
	}
	Connector.filter = MetadataFilter.getRemasteredFilter().extend(MetadataFilter.getDoubleTitleFilter());
}

function isNewDeezer() {
	return $('body').hasClass('electron-ui');
}

function setupNewDeezer() {
	Connector.playerSelector = 'div#page_player';

	Connector.getArtist = () => {
		let artists;
		if ($('div.track-title').length > 0) { // from player
			artists = $('div.track-title a.track-link').toArray();
			artists.shift();
		} else { // from open queuelist
			artists = $('div.queuelist-cover-subtitle a.queuelist-cover-link').toArray();
		}
		return Util.joinArtists(artists);
	};

	Connector.getTrack = () => {
		let track;
		if ($('div.track-title').length > 0) { // from player
			track = $('div.track-title a.track-link:eq(0)').text();
		} else { // from open queuelist
			track = $('div.queuelist-cover-title a.queuelist-cover-link').text();
		}
		return track;
	};

	Connector.currentTimeSelector = '.slider-counter.slider-counter-current';

	Connector.durationSelector = '.slider-counter.slider-counter-max';

	Connector.getTrackArt = () => {
		let trackArtUrl = $('button.queuelist .picture-img.active').attr('src');
		return trackArtUrl.replace('/28x28-', '/264x264-');
	};

	Connector.isPlaying = () => $('.player-controls .svg-icon.svg-icon-pause').length > 0;
}

function setupOldDeezer() {
	Connector.playerSelector = '#page_sidebar';

	Connector.getArtist = () => {
		let artists = $('.player-track-artist').children().toArray();
		return Util.joinArtists(artists);
	};

	Connector.trackSelector = '.player-track-title';

	Connector.currentTimeSelector = '.player-progress .progress-time';

	Connector.durationSelector = '.player-progress .progress-length';

	Connector.trackArtSelector = '.player-cover img';

	Connector.isPlaying = () => $('#player .svg-icon-pause').length > 0;
}
{'fraction_non_alphanumeric': 0.17847669571807503, 'fraction_numerical': 0.007578628268283441, 'mean_word_length': 4.714285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1648506', 'n_tokens_mistral': 890, 'n_tokens_neox': 846, 'n_words': 135}