{"size": 1274, "ext": "js", "max_stars_repo_path": "src/connectors/1001tracklists.js", "max_stars_repo_name": "pascalla/web-scrobbler", "max_stars_repo_stars_event_min_datetime": "2021-11-24T06:01:13.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-24T06:01:15.000Z", "max_issues_repo_path": "src/connectors/1001tracklists.js", "max_issues_repo_name": "pascalla/web-scrobbler", "max_issues_repo_issues_event_min_datetime": "2020-08-04T20:25:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-26T16:03:07.000Z", "max_forks_repo_path": "src/connectors/1001tracklists.js", "max_forks_repo_name": "pascalla/web-scrobbler", "max_forks_repo_forks_event_min_datetime": "2021-03-30T20:23:43.000Z", "max_forks_repo_forks_event_max_datetime": "2021-03-30T20:23:43.000Z"}
{"max_stars_count": 2, "max_issues_count": 71, "max_forks_count": 1, "avg_line_length": 26.0, "max_line_length": 101, "alphanum_fraction": 0.6514913658}
'use strict';

let nextCue;
let cue;
let currentTime;
const mixDuration = Util.stringToSeconds($('.mediaTabItem span').text().split('[')[1].split(']')[0]);

Connector.playerSelector = '#playerWidgetFields';

Connector.trackArtSelector = '#artworkLeft';

Connector.albumSelector = '#pageTitle';

Connector.getUniqueID = () => $('.cPlay:first').attr('id');

Connector.getArtistTrack = () => {
	const text = $('.cPlay:first meta[itemprop="name"]').attr('content');
	return Util.splitArtistTrack(text);
};

Connector.getCurrentTime = () => {
	return currentTime - cue;
};

Connector.getDuration = () => {
	switch (true) {
		case cue && nextCue > 0:
			0 > currentTime - cue && (nextCue += Math.abs(currentTime - cue));
			return nextCue - cue;
		case nextCue > 0:
			return nextCue;
		case cue > 0:
			return mixDuration - cue;
	}
};

Connector.isPlaying = () => {
	return $('#playerWidgetPause').hasClass('fa-pause');
};

Connector.isScrobblingAllowed = () => {
	nextCue = +$('.cPlay:first').nextAll('.topBorder').find('input').eq(0).val();
	cue = +$('.cPlay:first input').val();
	currentTime = Util.stringToSeconds($('#playerWidgetCurrentTime').text());
	const noIDs = $('.cPlay:first').find('.trackFormat .redTxt').length;

	return noIDs <= 0 && (cue > 0 || nextCue > 0);
};
