It is currently April 25th, 2024, 12:24 pm

Track media changes...

Get help with creating, editing & fixing problems with skins
Pokesi
Posts: 14
Joined: August 7th, 2020, 2:43 am

Track media changes...

Post by Pokesi »

I want to make a skin that is like the windows media thing in the top-left corner. So, I need to track media changes, how would I do that? Would I need a Lua script?
Pokesi
Posts: 14
Joined: August 7th, 2020, 2:43 am

Re: Track media changes...

Post by Pokesi »

Media change; pause, play, next, previous
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Track media changes...

Post by balala »

Pokesi wrote: August 12th, 2020, 9:13 am I want to make a skin that is like the windows media thing in the top-left corner. So, I need to track media changes, how would I do that?
Which media player would you like to use? You have to choose from the supported players.
Pokesi wrote: August 12th, 2020, 9:13 am Would I need a Lua script?
No, at all. Native Rainmeter can deal with such a task, no need to involve lua.
Pokesi
Posts: 14
Joined: August 7th, 2020, 2:43 am

Re: Track media changes...

Post by Pokesi »

Spotify
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Track media changes...

Post by CyberTheWorm »

Here is a simple one that works if you have spotify installed on your computer

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=Media Player
Author=CyberTheWorm
Information=Displays Artist and Track
Version=1.0.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
MyPlayer=Spotify

;-------------- Measures -------------------------

[MeasurePlayer]
Measure=NowPlaying
PlayerName=#MyPlayer#
PlayerType=Title
Substitute="":"N\A"

[MeasureArtist]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=Artist
Substitute="":"N\A"

[MeasureState]
Measure=NowPlaying
PlayerName=[MeasurePlayer]
PlayerType=State
Substitute="0":"Play","1":"Pause","2":"Play"

[MeasureAlbum]
Measure=NowPlaying
PlayerName=#MyPlayer#
PlayerType=Album
Substitute="":"N\A"
;--------------------  Meters -------------------------

[MeterShapeRectangle]
Meter=Shape
X=0
Y=0
Shape=Rectangle 3,3,200,100 | Fill Color 32,32,32,255 | StrokeWidth 6 | StrokeColor 0,0,0,220

[MeterArtist]
X=100
Y=8
W=180
MeasureName=MeasureArtist
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text="%1"
ToolTipText=%1

[MeterTitle]
X=100
Y=18r
W=180
MeasureName=MeasurePlayer
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text=%1
ToolTipText=%1

[MeterAlbum]
X=100
Y=18r
W=180
MeasureName=MeasureAlbum
Meter=String
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
CLipString=1
Text=%1
ToolTipText=%1

[MeterPrev]
Meter=String
X=20
Y=18r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
Text="Back"
LeftMouseUpAction=!CommandMeasure "MeasurePlayer" "Previous"
ToolTipText=Left Mouse Click Play/Previous Track

[MeterPlay]
Meter=String
MeasureName=MeasureState
X=100
Y=0r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
Text="%1"
LeftMouseUpAction=[!CommandMeasure "MeasurePlayer" "PlayPause"][!Refresh][!Refresh]
ToolTipText=Left Mouse Click Play/Pause Track

[MeterNext]
Meter=String
X=180
Y=0r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Right
Text="Next"
LeftMouseUpAction=!CommandMeasure "MeasurePlayer" "Next"
ToolTipText=Left Mouse Click Play/Next Track

[MeterPlayer]
Meter=String
X=100
Y=20r
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Center
Text=#MyPlayer#
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
Pokesi
Posts: 14
Joined: August 7th, 2020, 2:43 am

Re: Track media changes...

Post by Pokesi »

oo thanks
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Track media changes...

Post by balala »

CyberTheWorm wrote: August 12th, 2020, 11:43 pm Here is a simple one that works if you have spotify installed on your computer
Are you sure? Because I don't have Spotify installed, so I can't check this, however according to the manual, if you're using Spotify with NowPlaying measures, only Artist and Track Title are supported. Accordingly if the manual is correct (and I doubt it wouldn't be), nor the [MeasureState], nor the [MeasureAlbum] measure shouldn't work.
Another issue with your code: the two [!Refresh] bangs into the LeftMouseUpAction option of the [MeterPlay] meter don't make too much sense. If you're using the [MeterPlay] meter to play or pause the player, there is not needed at all to refresh the skin. It probably does work, but it's simply not needed. Refreshes should be avoided as much as possible.
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Track media changes...

Post by CyberTheWorm »

balala wrote: August 13th, 2020, 11:39 am Are you sure? Because I don't have Spotify installed, so I can't check this, however according to the manual, if you're using Spotify with NowPlaying measures, only Artist and Track Title are supported. Accordingly if the manual is correct (and I doubt it wouldn't be), nor the [MeasureState], nor the [MeasureAlbum] measure shouldn't work.
Another issue with your code: the two [!Refresh] bangs into the LeftMouseUpAction option of the [MeterPlay] meter don't make too much sense. If you're using the [MeterPlay] meter to play or pause the player, there is not needed at all to refresh the skin. It probably does work, but it's simply not needed. Refreshes should be avoided as much as possible.
This only works if you have Spotify on your computer and the reason for the 2 x [!Refresh] is Spotify is buggy and does not seem to update the Play/Pause unless I have them there
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Track media changes...

Post by balala »

CyberTheWorm wrote: August 13th, 2020, 5:01 pm This only works if you have Spotify on your computer
Obviously you have to have Spotify, but do the [MeasureState] and [MeasureAlbum] measures work? I explaind why I suspect they shouldn't work.
CyberTheWorm wrote: August 13th, 2020, 5:01 pm the reason for the 2 x [!Refresh] is Spotify is buggy and does not seem to update the Play/Pause unless I have them there
Alright, but why twice? Doesn't make too much sense.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Track media changes...

Post by Mor3bane »

balala wrote: August 13th, 2020, 5:41 pm Obviously you have to have Spotify, but do the [MeasureState] and [MeasureAlbum] measures work? I explaind why I suspect they shouldn't work.

Alright, but why twice? Doesn't make too much sense.
Error trapping output if i understand Cyber's description correctly.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.