mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 13:32:42 +01:00
Allow listenbrainz to be triggered on every play
This commit is contained in:
parent
ed6f04b6d4
commit
38c1f05c35
@ -81,3 +81,5 @@ export class ListenBrainz {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export { ListenBrainzStore };
|
@ -6,7 +6,7 @@ import { globalEvents } from "./constants/globalEvents";
|
|||||||
import { settings } from "./constants/settings";
|
import { settings } from "./constants/settings";
|
||||||
import { statuses } from "./constants/statuses";
|
import { statuses } from "./constants/statuses";
|
||||||
import { Songwhip } from "./features/songwhip/songwhip";
|
import { Songwhip } from "./features/songwhip/songwhip";
|
||||||
import { ListenBrainz } from "./features/listenbrainz/listenbrainz";
|
import { ListenBrainz, ListenBrainzStore } from "./features/listenbrainz/listenbrainz";
|
||||||
import { Options } from "./models/options";
|
import { Options } from "./models/options";
|
||||||
import { downloadFile } from "./scripts/download";
|
import { downloadFile } from "./scripts/download";
|
||||||
import { addHotkey } from "./scripts/hotkeys";
|
import { addHotkey } from "./scripts/hotkeys";
|
||||||
@ -202,6 +202,11 @@ function playPause() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the old listenbrainz data on launch
|
||||||
|
*/
|
||||||
|
ListenBrainzStore.clear();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add hotkeys for when tidal is focused
|
* Add hotkeys for when tidal is focused
|
||||||
* Reflects the desktop hotkeys found on:
|
* Reflects the desktop hotkeys found on:
|
||||||
@ -372,6 +377,9 @@ function updateMediaInfo(options: Options, notify: boolean) {
|
|||||||
};
|
};
|
||||||
player.playbackStatus = options.status == statuses.paused ? "Paused" : "Playing";
|
player.playbackStatus = options.status == statuses.paused ? "Paused" : "Playing";
|
||||||
}
|
}
|
||||||
|
if (settingsStore.get(settings.ListenBrainz.enabled) && (ListenBrainzStore.get("OldData") as string[][1]) !== options.title) {
|
||||||
|
ListenBrainz.scrobble(options.title, options.artists, options.status, convertDuration(options.duration));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,9 +477,6 @@ setInterval(function () {
|
|||||||
updateMediaInfo(options, titleOrArtistsChanged);
|
updateMediaInfo(options, titleOrArtistsChanged);
|
||||||
if (titleOrArtistsChanged) {
|
if (titleOrArtistsChanged) {
|
||||||
updateMediaSession(options);
|
updateMediaSession(options);
|
||||||
if (settingsStore.get(settings.ListenBrainz.enabled)) {
|
|
||||||
ListenBrainz.scrobble(options.title, options.artists, options.status, convertDuration(options.duration));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user