Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get album name #88

Merged
merged 3 commits into from
Dec 28, 2021
Merged

Get album name #88

merged 3 commits into from
Dec 28, 2021

Conversation

drom98
Copy link
Contributor

@drom98 drom98 commented Dec 21, 2021

Tries to get the album name and display it on the player module and on Discord as "LargeImageText".

  • KDE media player
    Screenshot_20211221_202143

  • Discord
    Screenshot_20211221_202246

Edit: Guess it fixes this issue

Try to get the album name and display it on the player module and on Discord as "LargeImageText"
@@ -32,6 +32,7 @@ const observer = (event, arg) => {
startTimestamp: parseInt(now),
endTimestamp: parseInt(remaining),
largeImageKey: mediaInfoModule.mediaInfo.image,
largeImageText: (mediaInfoModule.mediaInfo.album) ? mediaInfoModule.mediaInfo.album : 'TIDAL HiFi',
Copy link
Contributor

@Mar0xy Mar0xy Dec 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to this line it will fallback to TIDAL HiFi but I think we should keep the original line which is currently used by the app and also used by the idle status still with this change

Tidal HiFi ${app.getVersion()}

@Mar0xy
Copy link
Contributor

Mar0xy commented Dec 25, 2021

On another note I just tested this and noticed that it rarely ever picked up any album in the beginning until a while later where it started to pick up basically every album which is good enough.

@drom98
Copy link
Contributor Author

drom98 commented Dec 26, 2021

On another note I just tested this and noticed that it rarely ever picked up any album in the beginning until a while later where it started to pick up basically every album which is good enough.

Thanks for the input. It's not 100% consistent, sometimes it can't get the album name for some reason, but still I think it works okay. Any idea how to improve this?

@Mar0xy
Copy link
Contributor

Mar0xy commented Dec 27, 2021

Any idea how to improve this?

Sadly no considering how Tidal deals with album names I think this is the best solution possible.

Copy link
Owner

@Mastermindzh Mastermindzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with minor changes requested.

Overall it looks pretty good, as @Mar0xy already mentioned Tidal (and their attributes..) make it hard to perfectly nail down any info.

Please create a version 2.7.0 entry in the Changelog and explain that album artwork is retrieved on a "best-effort" based system (feel free to link this PR). No need to change any other version numbers, that'll be done on release anyway.

Please let me know whether you want to do them yourself or whether you want me to do them.
Thanks for the contribution!

post comment clarity edit: please include a line in the readme for album art:

- album-art in integrations ([best-effort](https://github.com/Mastermindzh/tidal-hifi/pull/88#pullrequestreview-840814847))

//If listening to an album, get its name from the header title
if(window.location.href.includes('/album/')) {
const albumName = window.document.querySelector(this.album_header_title);
if(albumName) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it that the url either includes album or playlist? Never both?
If so, please wrap the second if in an "elseif"

src/preload.js Outdated

//If listening to a playlist or a mix, get album name from the list
if(window.location.href.includes('/playlist/') || window.location.href.includes('/mix/')) {
if(currentPlayStatus === 'playing') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the constants statuses.playing instead of the string 'playing'

@drom98
Copy link
Contributor Author

drom98 commented Dec 28, 2021

Thank you for your review!
Glad I can help!
I'm going to submit another PR related to the notifications. If you find it useful we can include those changes in the 2.7.0 version

@Mastermindzh Mastermindzh changed the base branch from master to develop December 28, 2021 15:41
@Mastermindzh Mastermindzh merged commit 80452bc into Mastermindzh:develop Dec 28, 2021
@Mastermindzh
Copy link
Owner

Available in 2.7.0

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add album to metadata (e.g. for last.fm album art)
3 participants