It is currently February 23rd, 2024, 3:27 am

Next and Previous Track's Names

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

Re: Next and Previous Track's Names

Post by balala »

Aryx wrote: January 6th, 2024, 1:17 pm 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?
Add the following options (RegExpSubstitute and Substitute) to the measure with the PlayerType=File option (I named it [MeasureFile], but you probably have used another name - doesn't matter):

Code: Select all

[MeasureFile]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=File
RegExpSubstitute=1
Substitute="^(.*)\\(.*)$":"\2"
If in the Substitute option you're replacing the \2 parameter by \1 (Substitute="^(.*)\\(.*)$":"\1"), you get the path of the file, instead of its name.
Aryx
Posts: 34
Joined: December 20th, 2023, 9:18 am

Re: Next and Previous Track's Names

Post by Aryx »

Mostly completed skin... It needs more "polish", but, I did what I had to.

I know, it has this - flaw - cough, where track name is not changed when progress is 100%. Scrolling Up and Down changes it/resets it.
c.ini
Tell me how did I do?
You do not have the required permissions to view the files attached to this post.
Aryx
Posts: 34
Joined: December 20th, 2023, 9:18 am

Re: Next and Previous Track's Names

Post by Aryx »

@Balala, I saw your reply after posting it, thank you, I'll test it tomorrow!
User avatar
Yincognito
Rainmeter Sage
Posts: 6781
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, 3:12 pm Mostly completed skin... It needs more "polish", but, I did what I had to.

I know, it has this - flaw - cough, where track name is not changed when progress is 100%. Scrolling Up and Down changes it/resets it.

c.ini

Tell me how did I do?
Looks and behaves nicely, from my point of view - good job, you're progressing very well! I'll let balala advise on other details that could be better, if needed, I just want to add something to what he previously said. If you add something like:

Code: Select all

[File]
Measure=NowPlaying
PlayerName=[Player]
PlayerType=File
RegExpSubstitute=1
Substitute="^(.*)\\(.*)\.(.*)$":"\2"

[Track]
Measure=String
String=[Title] - [Artist]
RegExpSubstitute=1
Substitute="(?:^ - .*$|^.* - *- .*$|^.* - $)":"[File]"
DynamicVariables=1
to your measures, where the value of the String option from [Track] can be whatever hyphen separated form of [Title], [Artist], [Album] stuff and you replace the desired "[Title] - [Artist]" or "[Title] - [Artist] - [Album]" occurences in whatever bangs with "[Track]" instead, you could replace a track having a missing title, artist or album with the file name without the extension.
Last edited by Yincognito on January 7th, 2024, 10:45 am, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16007
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Next and Previous Track's Names

Post by balala »

Aryx wrote: January 6th, 2024, 3:13 pm @Balala, I saw your reply after posting it, thank you, I'll test it tomorrow!
Alright. I posted right after Yincognito. However a minor thing was not exactly clear to me when posted my reply, but in meantime I realized it. With my substitution you'll get the name AND the extension of the file. If you need only the name, without the extension, you have to alter little bit the Substitute option, as described by Yincognito above. Use the following option: Substitute="^(.*)\\(.*)\.(.*)$":"\2" (this is the same as Yincognito's option).
Sorry if I confused you.
Aryx
Posts: 34
Joined: December 20th, 2023, 9:18 am

Re: Next and Previous Track's Names

Post by Aryx »

@Balala No, you did not confuse me, since I did not use the answer then.

Now after doing everything I could I have a question:
Can I use the OnChangeAction to write the Title, etc like it is written when changed manually? I had asked a similar question earlier in another post, so, I thought if the Title changed, that should perform the same function as manual changing of track...
User avatar
Yincognito
Rainmeter Sage
Posts: 6781
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Next and Previous Track's Names

Post by Yincognito »

Aryx wrote: January 8th, 2024, 2:48 pm Can I use the OnChangeAction to write the Title, etc like it is written when changed manually? I had asked a similar question earlier in another post, so, I thought if the Title changed, that should perform the same function as manual changing of track...
Normally, you could. Doing it in a [Track] measure that encompases both the Title, Artist, and so on would be better though, than just on the Title change, because if you jump to a song having the same title but performed by a different artist, the latter won't react at all given that the title alone didn't change. In this particular case, however, you can't (easily) identify the "direction" to which the jump went (i.e. previous or next) using only the OnChangeAction, so you wouldn't be able to use the proper bangs or set the right variables when that happens. Doing this directly in the specific click actions for each "direction" solves this potential problem in a simple way.

EDIT: On a second thought, I guess you could do things properly in an OnChangeAction too, if you go back 1 time to save #Prev#, optionally go foward 1 time to save #Curr#, go foward 1 more time to save #Next#, then go back 1 time to return to the current track... :???:
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 »

In the Title measure? and like this?
...
OnChangeAction=<Prev><SavePrev #Prev#>, <Next> <SaveCurr #Curr#> <Next> <SaveNext #Next#> <Prev>
...
User avatar
Yincognito
Rainmeter Sage
Posts: 6781
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Next and Previous Track's Names

Post by Yincognito »

Aryx wrote: January 8th, 2024, 3:42 pm In the Title measure? and like this?
...
OnChangeAction=<Prev><SavePrev #Prev#>, <Next> <SaveCurr #Curr#> <Next> <SaveNext #Next#> <Prev>
...
Yeah, something like that, but in a Track measure where you "merge" the track info into a string (like shown a few replies ago), because of what I mentioned above. You can do it in a Title measure, if you want, but if you have two different tracks with the same title and different artists, it won't react to changing the track because the title itself doesn't change.
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 »

My bad! I did not check the names. No, I don't have 2 different measures for the same purpose. Its [Title] actually.
I wanted to edit the earlier post (Clarification)- instead of writing [Title] , I wrote Title.
Last edited by Aryx on January 8th, 2024, 5:29 pm, edited 1 time in total.