Skip to content

Commit

Permalink
Merge pull request #414 from Mastermindzh/version/next
Browse files Browse the repository at this point in the history
fix: Fixed  not finding album name whilst on queue page
  • Loading branch information
Mastermindzh authored Jun 9, 2024
2 parents 3641f07 + 54316d3 commit dd6f813
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.14.1]

- Fixed `getAlbumName` not finding album name whilst on queue page
- Added all mediaInfo to mpris interface using the `custom:` prefix

## [5.14]

- Simplified `MediaInfo` & `Options` types
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tidal-hifi",
"version": "5.14.0",
"version": "5.14.1",
"description": "Tidal on Electron with widevine(hifi) support",
"main": "ts-dist/main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/features/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "TIDAL Hi-Fi API",
"version": "5.14.0",
"version": "5.14.1",
"description": "",
"license": {
"name": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ <h4>Upload new themes</h4>
<h4>TIDAL Hi-Fi</h4>
<div class="about-section__version">
<a target="_blank" rel="noopener"
href="https://github.com/Mastermindzh/tidal-hifi/releases/tag/5.14.0">5.14.0</a>
href="https://github.com/Mastermindzh/tidal-hifi/releases/tag/5.14.1">5.14.1</a>
</div>
<div class="about-section__links">
<a target="_blank" rel="noopener" href="https://github.com/mastermindzh/tidal-hifi/"
Expand Down
9 changes: 9 additions & 0 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { MediaStatus } from "./models/mediaStatus";
import { RepeatState } from "./models/repeatState";
import { downloadFile } from "./scripts/download";
import { addHotkey } from "./scripts/hotkeys";
import { ObjectToDotNotation } from "./scripts/objectUtilities";
import { settingsStore } from "./scripts/settings";
import { setTitle } from "./scripts/window-functions";

Expand Down Expand Up @@ -58,6 +59,7 @@ const elements = {
mediaItem: "[data-type='mediaItem']",
album_header_title: '*[class^="playingFrom"] span:nth-child(2)',
playing_from: '*[class^="playingFrom"] span:nth-child(2)',
queue_album: "*[class^=playQueueItemsContainer] *[class^=groupTitle] span:nth-child(2)",
currentlyPlaying: "[class^='isPlayingIcon'], [data-test-is-playing='true']",
album_name_cell: '[class^="album"]',
tracklist_row: '[data-test="tracklist-row"]',
Expand Down Expand Up @@ -133,6 +135,12 @@ const elements = {
}
}

// see whether we're on the queue page and get it from there
const queueAlbumName = elements.getText("queue_album");
if (queueAlbumName) {
return queueAlbumName;
}

return "";
},

Expand Down Expand Up @@ -467,6 +475,7 @@ function updateMpris(mediaInfo: MediaInfo) {
"mpris:length": convertDuration(mediaInfo.duration) * 1000 * 1000,
"mpris:trackid": "/org/mpris/MediaPlayer2/track/" + getTrackID(),
},
...ObjectToDotNotation(mediaInfo, "custom:"),
};
player.playbackStatus = mediaInfo.status === MediaStatus.paused ? "Paused" : "Playing";
}
Expand Down
13 changes: 13 additions & 0 deletions src/scripts/objectUtilities.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const ObjectToDotNotation = (obj: any, prefix: string = "", target: any = {}) => {
Object.keys(obj).forEach((key: string) => {
if (typeof obj[key] === "object" && obj[key] !== null) {
ObjectToDotNotation(obj[key], prefix + key + ".", target);
} else {
const dotLocation = prefix + key;
target[dotLocation] = obj[key];
return target;
}
});
return target;
};

0 comments on commit dd6f813

Please sign in to comment.