It is currently April 27th, 2024, 7:43 pm

Next and Previous Track's Names

General topics related to Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 16179
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next and Previous Track's Names

Post by balala »

Aryx wrote: January 4th, 2024, 6:02 pm I yet have nothing to glue the puzzle pieces - if you get what I mean..
I got.
Aryx wrote: January 4th, 2024, 6:02 pm I have yet to learn the basics to Rainmeter.
This is / was the basic idea to each of us, who have started using Rainmeter and coding into it. If you keep working, you can get the ideas very quickly.
Aryx wrote: January 4th, 2024, 6:02 pm Don't mean to bother, if I get it all working, then I'll post it here if no one would..
Please do so. We'll take a look, I think...
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Next and Previous Track's Names

Post by Yincognito »

Aryx wrote: January 4th, 2024, 6:02 pmIt would be a little better if I had some foundation-code or something to go on - even if the fragments are understood, I yet have nothing to glue the puzzle pieces - if you get what I mean..
Well, if you had the code then we'd be doing it all for you, now wouldn't we? This is not what this forum is about... :???:

Tell you what, how about putting together a very simple skin right now, with just the NowPlaying's State, Repeat, Shuffle, Artist and Title measures and some dummy String meter, so we can have something to start with? Not because we can't do it ourselves, but because it shows that you at least did something (which should be within your abilities already) to achieve the objective. I don't know about the repeating and shuffle stuff since Rainmeter can't differentiate between the types of repeat or shuffle, but if you post such a sample, I'm sure we can work something out of it (hint: your 2 steps forward and 1 step back idea - and viceversa - is actually excellent). ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Aryx
Posts: 34
Joined: December 20th, 2023, 9:18 am

Re: Next and Previous Track's Names

Post by Aryx »

Well, since I have not been making a skin as of now, so, I'll just give links to top-most 2 that do just that:

1. VC Player by Eclectic-Tech: https://forum.rainmeter.net/viewtopic.php?t=42849
2. Neo Music Player by Zxcvbot: https://forum.rainmeter.net/viewtopic.php?t=43139

My preference would be 2nd one since I use AIMP too and it is arranged to make it understandable, except the weirdly glitched next button (no offence). But either one is fine and do the said work and I do not understand the tiny progress-bar in the 1st one, else all is good (with added feature to change to WebNowPlaying)!

Now, if you still want me to create a skin, I'll just use either one and use the build something.

Question: Does WebNowPlaying plugin provide the names for next/previous tracks? Also, why does the 1st one show WinAmp when I use any player Windows Media Player/VLC/AIMP? :???:

Edit:
Next:
LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "Next"][!CommandMeasure "MeasureNowPlaying" "Next"] WritetovariableNext [!CommandMeasure "MeasureNowPlaying" "Previous"]

I think that would do the trick. But how to write the name? And checking for Shuffle? :confused:
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Next and Previous Track's Names

Post by Yincognito »

Aryx wrote: January 5th, 2024, 2:39 pm Edit:
Next:
LeftMouseUpAction=[!CommandMeasure "MeasureNowPlaying" "Next"][!CommandMeasure "MeasureNowPlaying" "Next"] WritetovariableNext [!CommandMeasure "MeasureNowPlaying" "Previous"]

I think that would do the trick. But how to write the name? And checking for Shuffle? :confused:
Something like that, yes - very good, you're starting to get it. :thumbup:
Aryx wrote: January 5th, 2024, 2:39 pm Well, since I have not been making a skin as of now [...]
Now, if you still want me to create a skin, I'll just use either one and use the build something.
Everything has a starting point, you know - there is always a first time for everything. Just because it's the first time doesn't mean you shouldn't at least try. Anyway, forget about those 2 skins for a moment - better to try this on a very basic skin of your own to understand how it works (once you do, you'll probably have a better idea on how to add these things to any of those 2 skins). Here is an extremely simple sample that I think does what you want. To use it, just create a new skin (follow the images 1,3,5 and 6 from this page), then copy paste the below in that file, replacing the earlier contents:

Code: Select all

[Variables]
PlayerName=Winamp
Prev=
Curr=
Next=

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,255,0,255
OnRefreshAction=[!SetVariable Curr "[Artist] - [Title]"][!UpdateMeasure *][!UpdateMeter *][!Redraw]

---Measures---

[Player]
Measure=NowPlaying
PlayerName=#PlayerName#
PlayerType=State

[Repeat]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=Repeat

[Shuffle]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=Shuffle

[Artist]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=Artist

[Title]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=Title

---Meters---

[Prev]
Meter=String
Y=10R
AntiAlias=1
Text=Prev: #Prev#
LeftMouseUpAction=[!SetVariable Next "#Curr#"][!CommandMeasure Player "Previous"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!SetVariable Prev "[Artist] - [Title]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!SetVariable Curr "[Artist] - [Title]"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Curr]
Meter=String
Y=10R
AntiAlias=1
Text=Curr: #Curr#
LeftMouseUpAction=[!CommandMeasure Player "PlayPause"][!UpdateMeasure *][!SetVariable Curr "[Artist] - [Title]"][!UpdateMeter *][!Redraw]
MiddleMouseUpAction=[!CommandMeasure Player "Stop"]
DynamicVariables=1

[Next]
Meter=String
Y=10R
AntiAlias=1
Text=Next: #Next#
LeftMouseUpAction=[!SetVariable Prev "#Curr#"][!CommandMeasure Player "Next"][!CommandMeasure Player "Next"][!UpdateMeasure *][!SetVariable Next "[Artist] - [Title]"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!SetVariable Curr "[Artist] - [Title]"][!UpdateMeter *][!Redraw]
DynamicVariables=1
Save the file, then either load the skin (if it's not loaded yet), or refresh it (if it's already loaded) from the same Manage Rainmeter window or from the Rainmeter's right click context menu.

Note: The above skin is just a basic version of what you could do, and you can improve it. It uses 3 properly named variables defined in [Variables], as you mentioned in the first post (things can be done using measures instead of variables as well, if desired). You can set the player by changing the PlayerName variable at the top of the code, saving the file and refreshing the skin. Feel free to ask if you don't understand something, but better have the process clearly understood before attempting to add it to one of the 2 skins you mentioned, otherwise it will be more difficult to achieve the latter. By the way, another reason why it was preferable to start fresh with just the above is because the skins you mentioned do not (yet) have all the measures ([sections] that get data) or the meters ([sections] that display data) needed to display these things, while here only what's needed for what you said is present, making things clearer in that regard. Obviously, you can add them once you understand how this works (don't expect us to do it for you, be brave and give it a try, we'd be glad to help if you stumble in the process). ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Aryx
Posts: 34
Joined: December 20th, 2023, 9:18 am

Re: Next and Previous Track's Names

Post by Aryx »

Wow! Simple and to the point! I even got it - LeftMouseUpAction, MiddleMouseUpAction!
SetVariable thing is so simple too! I had it all wrong i my head!
I read how to pause and change tracks when I posted the initial thing, so, I need not refer how they work..

Before I attempt any edits, can I change this:
[!SetVariable Next "[Artist] - [Title]"] to [!SetVariable Next "[Title] - [Artist]"] ?
Would it affect the skin? (Not the ones I referred to earlier - The skin/code you gave)

Also, just to be clear, does "*" mean "all" and not "multiply/multiplication"?
Previously unanswered question: Does WebNowPlaying plugin provide the names for next/previous tracks?

Can I just pat my back too? I just wanted to know if this was possible - you made it so! Also, with hidden features - play/pause next and previous!

I may just use this skin forever (except the green screen :D )!!! I have seen several skins, but none with this - put it up in Tips and Tricks Section for folks!
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Next and Previous Track's Names

Post by Yincognito »

Aryx wrote: January 5th, 2024, 6:25 pm Wow! Simple and to the point! I even got it - LeftMouseUpAction, MiddleMouseUpAction!
SetVariable thing is so simple too! I had it all wrong i my head!
I read how to pause and change tracks when I posted the initial thing, so, I need not refer how they work..

Before I attempt any edits, can I change this:
[!SetVariable Next "[Artist] - [Title]"] to [!SetVariable Next "[Title] - [Artist]"] ?
Would it affect the skin? (Not the ones I referred to earlier - The skin/code you gave)

Also, just to be clear, does "*" mean "all" and not "multiply/multiplication"?
Previously unanswered question: Does WebNowPlaying plugin provide the names for next/previous tracks?

Can I just pat my back too? I just wanted to know if this was possible - you made it so! Also, with hidden features - play/pause next and previous!

I may just use this skin forever (except the green screen :D )!!! I have seen several skins, but none with this - put it up in Tips and Tricks Section for folks!
Glad you're happy with it! As I said, it can be improved if desired - this will be your job now that you seem to understand most of how it works. And yes, it was simple, that's what I've been telling you all along. You could have done it too, with a bit of effort. :sly:

As for your questions:
- Yes, you can reverse the [Title] and [Artist] measure references in any way you like (in this context, such references are called "section variables"). The value of that Next variable is just a string, so it won't break anything.
- Yes, in this context, "*" is just a (string) parameter of a bang meaning "all stuff of the same type" (in this case, measures or meters, see the note at the start of that page), it has no mathematical meaning, since it's not part of a formula (which must be enclosed within round brackets to be considered a formula by Rainmeter, by the way)
- No, WebNowPlaying doesn't provide the previous and next tracks in advance either (see its possible options here), but given its similarity with the built-in NowPlaying, I suppose you could apply a similar method to get them (not sure if it'll work for internet based playing tracks that are not part of a list, but you can try and see for yourself)

Well, I included those hidden "features" as a bonus, since you're a beginner and all - next time you'll have to do some work too, haha! The green screen is simply because I didn't want to make the code longer and add other background / font options to the meters, so it works well with the default value of the FontColor option, which is black aka "0,0,0,255" - basically it was just for contrast and being able to distinguish the text on a dark ennvironment (like mine is, for example). As for the Tips & Tricks section, well, it was your (very good) idea with 2 steps forward and 1 back that is the basis for this, the rest is just basic Rainmeter code, don't know if it's worth a topic there for just this - but you can make it look better or polish its reactions a bit and post it yourself, I don't mind. ;-)
Last edited by Yincognito on January 5th, 2024, 7:03 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16179
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next and Previous Track's Names

Post by balala »

Aryx wrote: January 5th, 2024, 2:39 pm Now, if you still want me to create a skin, I'll just use either one and use the build something.
We or me? No way. You are the one who has to want to create a skin. If you do, we can help you to create / improve your skin (as you saw above on Yincognito's reply), but no one on this forum excepting you, will want you to create skin(s).
Aryx wrote: January 5th, 2024, 6:25 pm Previously unanswered question: Does WebNowPlaying plugin provide the names for next/previous tracks?
No. All this kind of plugins / measures are giving the names and artist of the current track.
Aryx
Posts: 34
Joined: December 20th, 2023, 9:18 am

Re: Next and Previous Track's Names

Post by Aryx »

Hello again! I did create a simple skin by modifying the above answer. Now I am unable to do the asked myself - and before anyone asks - yes! I tried doing it myself for almost an hour... I learnt logging (yay) and writing permanently - I can't understand what's going on!
Here's the code - it only writes 1 song.

Code: Select all

...
---added album

[Album]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=Album

[Progress]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=Progress
MinValue=0
MaxValue=100

[ProgressStatus]
Meter=String
FontFace=Segoe UI
FontColor=255,255,255
FontSize=12
Text=Progress: [Progress:%,1]%
AntiAlias=1
DynamicVariables=1
LeftMouseUpAction=[!CommandMeasure Player "Stop"]
MiddleMouseUpAction=[!CommandMeasure Player "Previous"][!Log PRE1][!WriteKeyValue Variables Prev "[Title] - [Artist] - [Album]"][!Log "Written Prev [Title] - [Artist] - [Album]"][!CommandMeasure Player "Next"][!Log NEXT1][!WriteKeyValue Variables Curr "[Title] - [Artist] - [Album]"][!Log "Written Curr [Title] - [Artist] - [Album]"][!CommandMeasure Player "Next"][!Log NEXT2][!WriteKeyValue Variables Next "[Title] - [Artist] - [Album]"][!Log "Written Next [Title] - [Artist] - [Album]"][!CommandMeasure Player "Previous"][!Log PREV2][!Refresh]
MouseScrollUpAction=[!CommandMeasure Progress "SetPosition +5"][!UpdateMeasure Progress][!UpdateMeter ProgressStatus][!Redraw]
MouseScrollDownAction=[!CommandMeasure Progress "SetPosition -5"][!UpdateMeasure Progress][!UpdateMeter ProgressStatus][!Redraw]

; Edit - Same here
;MiddleMouseUpAction=[!WriteKeyValue Variables Curr "[Title] - [Artist] - [Album]"] [!Log "Curr Written: #Curr#"] [!CommandMeasure Player "Previous"] [!WriteKeyValue Variables Prev "[Title] - [Artist] - [Album]"] [!Log "PRE1 & Written: #Prev#"] [!CommandMeasure Player "Next"] [!CommandMeasure Player "Next"] [!WriteKeyValue Variables Next "[Title] - [Artist] - [Album]"] [!Log "NextX2 & Written: #Next#"] [!CommandMeasure Player "Previous"] [!Log "PRE2"] [!Refresh]

Another thing - not polishing anything - when some file whose Title is not there, then, it just is empty and displays " - - ", how can I change that to file's name instead of the empty title? I tried a player type file, but it had full path with the filename. How can I remove the unwanted path to file and keep just the filename? Also, the last written titles are shown in the previous and next tracks, instead of actual current, previous and next tracks - this is a problem even with the original answer.
Aryx
Posts: 34
Joined: December 20th, 2023, 9:18 am

Re: Next and Previous Track's Names

Post by Aryx »

Created a scroll-effect:

Code: Select all

;MouseScrollUpAction=[!WriteKeyValue Variables Next "#Curr#"][!CommandMeasure Player "Previous"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!WriteKeyValue Variables Prev "[Title]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!WriteKeyValue Variables Curr "[Title]"][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!WriteKeyValue Variables Next "#Curr#"][!CommandMeasure Player "Previous"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!WriteKeyValue Variables Prev "[Title] - [Artist]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!WriteKeyValue Variables Curr "[Title] - [Artist]"][!UpdateMeter *][!Redraw]
;MouseScrollUpAction=[!WriteKeyValue Variables Next "#Curr#"][!CommandMeasure Player "Previous"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!WriteKeyValue Variables Prev "[Title] - [Artist] - [Album]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!WriteKeyValue Variables Curr "[Title] - [Artist] - [Album]"][!UpdateMeter *][!Redraw]

;MouseScrollDownAction=[!WriteKeyValue Variables Prev "#Curr#"][!CommandMeasure Player "Next"][!CommandMeasure Player "Next"][!UpdateMeasure *][!WriteKeyValue Variables Next "[Title]"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!WriteKeyValue Variables Curr "[Title]"][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!WriteKeyValue Variables Prev "#Curr#"][!CommandMeasure Player "Next"][!CommandMeasure Player "Next"][!UpdateMeasure *][!WriteKeyValue Variables Next "[Title] - [Artist]"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!WriteKeyValue Variables Curr "[Title] - [Artist]"][!UpdateMeter *][!Redraw]
;MouseScrollDownAction=[!WriteKeyValue Variables Prev "#Curr#"][!CommandMeasure Player "Next"][!CommandMeasure Player "Next"][!UpdateMeasure *][!WriteKeyValue Variables Next "[Title] - [Artist] - [Album]"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!WriteKeyValue Variables Curr "[Title] - [Artist] - [Album]"][!UpdateMeter *][!Redraw]
I know it's nothing new, but works great! :Whistle
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Next and Previous Track's Names

Post by Yincognito »

Aryx wrote: January 6th, 2024, 1:17 pmit only writes 1 song.
Aryx wrote: January 6th, 2024, 1:17 pmAlso, the last written titles are shown in the previous and next tracks, instead of actual current, previous and next tracks - this is a problem even with the original answer.
This is because you need to update the relevant measures after commanding the main measure to jump to another track, just like in the original answer, so that when you reference [Title], [Artist], or [Album] they will provide their changed (i.e. after the jumping) values. For example, your MiddleMouseUpAction from [ProgressStatus] in your code should look like (notice the red parts - I only used "*" instead of the specific measures for simplicity, but you get the idea):
MiddleMouseUpAction=[!CommandMeasure Player "Previous"][!UpdateMeasure *][!Log PRE1][!WriteKeyValue Variables Prev "[Title] - [Artist] - [Album]"][!Log "Written Prev [Title] - [Artist] - [Album]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!Log NEXT1][!WriteKeyValue Variables Curr "[Title] - [Artist] - [Album]"][!Log "Written Curr [Title] - [Artist] - [Album]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!Log NEXT2][!WriteKeyValue Variables Next "[Title] - [Artist] - [Album]"][!Log "Written Next [Title] - [Artist] - [Album]"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!Log PREV2][!Refresh]

By the way, !Refresh is not necessarily needed after using !WriteKeyValue if you !SetVariable stuff too (plus update meters and redraw) so that their changed values would exist in memory as well. Just so you know.

Other than that, I suspect your MiddleMouseUpAction is intented to alleviate the fact that these prev, curr and next tracks aren't available when just loading or refreshing the skin (because nothing has been played or jumped to yet at that point). I actually had a version of the OnRefreshAction doing that in the code of the original answer from my computer:

Code: Select all

OnRefreshAction=[!CommandMeasure Player "Previous"][!UpdateMeasure *][!SetVariable Prev "[Artist] - [Title]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!SetVariable Curr "[Artist] - [Title]"][!CommandMeasure Player "Next"][!UpdateMeasure *][!SetVariable Next "[Artist] - [Title]"][!CommandMeasure Player "Previous"][!UpdateMeasure *][!UpdateMeter *][!Redraw]
which wouldn't need a specific MiddleMouseUpAction doing the same (nor a refresh), but didn't include it in the original code because due to the way these in advance values are retrieved, it leads to either a re - playing the current track from the beginning, or stopping it if the main measure is commanded to stop.
Aryx wrote: January 6th, 2024, 1:17 pmAnother thing - not polishing anything - when some file whose Title is not there, then, it just is empty and displays " - - ", how can I change that to file's name instead of the empty title?
This would need you to use measures instead of variables, since in a measure you have an option called Substitute that can alter that track string the way you want. I only used variables in the earlier answer because that was what your initial question referrred to.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth