mirror of
				https://github.com/Mastermindzh/tidal-hifi.git
				synced 2025-11-04 10:49:26 +01:00 
			
		
		
		
	Add ListenBrainz implementation
This commit is contained in:
		@@ -25,7 +25,11 @@ let adBlock: HTMLInputElement,
 | 
			
		||||
  skippedArtists: HTMLInputElement,
 | 
			
		||||
  theme: HTMLSelectElement,
 | 
			
		||||
  trayIcon: HTMLInputElement,
 | 
			
		||||
  updateFrequency: HTMLInputElement;
 | 
			
		||||
  updateFrequency: HTMLInputElement,
 | 
			
		||||
  enableListenBrainz: HTMLInputElement,
 | 
			
		||||
  ListenBrainzAPI: HTMLInputElement,
 | 
			
		||||
  ListenBrainzToken: HTMLInputElement;
 | 
			
		||||
 | 
			
		||||
function getThemeFiles() {
 | 
			
		||||
  const selectElement = document.getElementById("themesList") as HTMLSelectElement;
 | 
			
		||||
  const builtInThemes = getThemeListFromDirectory(process.resourcesPath);
 | 
			
		||||
@@ -87,6 +91,9 @@ function refreshSettings() {
 | 
			
		||||
  skippedArtists.value = settingsStore.get<string, string[]>(settings.skippedArtists).join("\n");
 | 
			
		||||
  trayIcon.checked = settingsStore.get(settings.trayIcon);
 | 
			
		||||
  updateFrequency.value = settingsStore.get(settings.updateFrequency);
 | 
			
		||||
  enableListenBrainz.checked = settingsStore.get(settings.ListenBrainz.enabled);
 | 
			
		||||
  ListenBrainzAPI.value = settingsStore.get(settings.ListenBrainz.api);
 | 
			
		||||
  ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -183,6 +190,9 @@ window.addEventListener("DOMContentLoaded", () => {
 | 
			
		||||
  skippedArtists = get("skippedArtists");
 | 
			
		||||
  singleInstance = get("singleInstance");
 | 
			
		||||
  updateFrequency = get("updateFrequency");
 | 
			
		||||
  enableListenBrainz = get("enableListenBrainz");
 | 
			
		||||
  ListenBrainzAPI = get("ListenBrainzAPI");
 | 
			
		||||
  ListenBrainzToken = get("ListenBrainzToken");
 | 
			
		||||
 | 
			
		||||
  refreshSettings();
 | 
			
		||||
 | 
			
		||||
@@ -206,4 +216,7 @@ window.addEventListener("DOMContentLoaded", () => {
 | 
			
		||||
  addSelectListener(theme, settings.theme);
 | 
			
		||||
  addInputListener(trayIcon, settings.trayIcon);
 | 
			
		||||
  addInputListener(updateFrequency, settings.updateFrequency);
 | 
			
		||||
  addInputListener(enableListenBrainz, settings.ListenBrainz.enabled);
 | 
			
		||||
  addTextAreaListener(ListenBrainzAPI, settings.ListenBrainz.api);
 | 
			
		||||
  addTextAreaListener(ListenBrainzToken, settings.ListenBrainz.token);
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -211,6 +211,30 @@
 | 
			
		||||
                <span class="switch__slider"></span>
 | 
			
		||||
              </label>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="group__option">
 | 
			
		||||
              <div class="group__description">
 | 
			
		||||
                <h4>ListenBrainz</h4>
 | 
			
		||||
                <p>Scrobble your listens directly to ListenBrainz.</p>
 | 
			
		||||
              </div>
 | 
			
		||||
              <label class="switch">
 | 
			
		||||
                <input id="enableListenBrainz" type="checkbox" />
 | 
			
		||||
                <span class="switch__slider"></span>
 | 
			
		||||
              </label>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="group__option">
 | 
			
		||||
              <div class="group__description">
 | 
			
		||||
                <h4>ListenBrainz API Url</h4>
 | 
			
		||||
                <p>There are multiple instances for ListenBrainz you can set the corresponding API url below.</p>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <textarea id="ListenBrainzAPI" class="textarea" cols="1" rows="1" spellcheck="false"></textarea>
 | 
			
		||||
            <div class="group__option">
 | 
			
		||||
              <div class="group__description">
 | 
			
		||||
                <h4>ListenBrainz User Token</h4>
 | 
			
		||||
                <p>Provide the user token you can get from the settings page.</p>
 | 
			
		||||
              </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <textarea id="ListenBrainzToken" class="textarea" cols="1" rows="1" spellcheck="false"></textarea>
 | 
			
		||||
          </div>
 | 
			
		||||
        </section>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user