forum

[Question] App like Osu!Rank for Rainmeter?

posted
Total Posts
35
Topic Starter
Xyrax Alaria
Looking for a rainmeter skin that acts like Osu!Rank on Android devices.

Osu!Rank is an app you can use to have a widget on your phone that has a live update of your Osu! rank in any game-mode you want, and I was wondering if anyone had a skin element like this for rainmeter. Thankyou in advance~

If this is in the wrong place I am sorry :c
Primula_old
Request api key from here: https://osu.ppy.sh/p/api
Return user data like: https://osu.ppy.sh/api/get_user?k=ApiKey&u=Primula

Using Rainmeter's WebParser plugin to parse the data to regular expression.

Below is a complete example, which outputs~

It's not difficult to customize to your own personal preference.
You'll need to change URL to whatever osu gives you from the above api key request.

Code
SPOILER
[Rainmeter]
Update=1000

[MeasureParse]
Measure=Plugin
Plugin=WebParser.dll
URL=https://osu.ppy.sh/api/get_user?k=ApiKey&u=Primula
RegExp=(?siU)user_id":"(.*)".*username":"(.*)".*count300":"(.*)".*count100":"(.*)".*count50":"(.*)".*playcount":"(.*)".*ranked_score":"(.*)".*total_score":"(.*)".*pp_rank":"(.*)".*level":"(.*)".*pp_raw":"(.*)".*accuracy":"(.*)".*count_rank_ss":"(.*)".*count_rank_s":"(.*)".*count_rank_a":"(.*)".*country":"(.*)"
UpdateRate=60

[MeasureData1]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureParse]
StringIndex=1

[MeterData1]
Meter=String
MeasureName=MeasureData1
X=0
Y=0
W=100
H=16
StringStyle=NORMAL
FontSize=12
FontColor=222,255,225,255
AntiAlias=1
Prefix="ID: "

[MeasureData2]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureParse]
StringIndex=2

[MeterData2]
Meter=String
MeasureName=MeasureData2
X=0
Y=16
W=100
H=16
StringStyle=NORMAL
FontSize=12
FontColor=222,255,225,255
AntiAlias=1
Prefix="User: "

[MeasureData9]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureParse]
StringIndex=9

[MeterData9]
Meter=String
MeasureName=MeasureData9
X=0
Y=32
W=100
H=16
StringStyle=NORMAL
FontSize=12
FontColor=222,255,225,255
AntiAlias=1
Prefix="Rank: "

[MeasureData11]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureParse]
StringIndex=11
RegExpSubstitute=1
Substitute="(\d+).?(\d?)+":"\1"

[MeterData11]
Meter=String
MeasureName=MeasureData11
X=0
Y=48
W=100
H=16
StringStyle=NORMAL
FontSize=12
FontColor=222,255,225,255
AntiAlias=1
Prefix="PP: "

[MeasureData12]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureParse]
StringIndex=12
RegExpSubstitute=1
Substitute="(\d+).(\d{1,2})?(\d?)+$":"\1.\2"

[MeterData12]
Meter=String
MeasureName=MeasureData12
X=0
Y=64
W=1000
H=16
StringStyle=NORMAL
FontSize=12
FontColor=222,255,225,255
AntiAlias=1
Prefix="ACC: "
Postfix="%"

I hope you know at least a little about Rainmeter so I won't explain too much.
Each 'MeasureData#' refers to each item in the RegExp (defined by StringIndex value).
Each 'MeterData#' refers to each MeasureData (with MeasureName=)

The 'Measures' hold data, the 'Meters' output data.

'UpdateRate' specifies how often the specified user will be queried for their data, I'm not sure of the minimal time Peppy would be happy with but I think 1min is a safe bet (It's sort of like ticks depending on what 'Update' is set as.. Eg. I've set Update to 1000ms and UpdateRate is set as 60, so the user's data will be queried every 60sec ~ 60*1000), you can also add in manual updating if you add something like this to one of the meters:
LeftMouseUpAction=[!CommandMeasure MeasureParse Update]

StringIndex List
SPOILER
1 user_id
2 username
3 count300
4 count100
5 count50
6 playcount
7 ranked_score
8 total_score
9 pp_rank
10 level
11 pp_raw
12 accuracy
13 count_rank_ss
14 count_rank_s
15 count_rank_a
16 country

One more thing to note: For things like PP and Accuracy that show decimals, you can set the amount of decimals to display with 'NumOfDecimals'.. though I'm not sure if this will work for string measures, if that's the case you could just reduce the width to hide them. >w< (ignore this, updated in post below with better method)
Topic Starter
Xyrax Alaria
Holy crap! Thankyou SO much! This is amazing, and I got it to work just fine. Your projects are always amazing, thankyou for giving me something like this!
Topic Starter
Xyrax Alaria
Actually I am having one problem, I cannot seem to get NumOfDecimals to work :/ I can put it either under MeterData or MeasureData but neither seems to work.
Primula_old
You're welcome ^w^

Yeah I didn't think it'd work with string based measures >w<

I suggested you could change the width of the measure to hide the decimals, but even better is adding regex substitutes like the following
RegExpSubstitute=1
Substitute="(\d+).?(\d?)+":"\1"

You just add it to the end of any Measure where needed, below is an example I added for accuracy.

[MeasureData12]
Measure=Plugin
Plugin=WebParser.dll
URL=[MeasureParse]
StringIndex=12
RegExpSubstitute=1
Substitute="(\d+).?(\d?)+":"\1"

[MeterData12]
Meter=String
MeasureName=MeasureData12
X=0
Y=64
W=100
H=16
StringStyle=NORMAL
FontSize=12
FontColor=222,255,225,255
AntiAlias=1
Prefix="ACC: "
Postfix="%"

The above example removes any decimals (including '.') if they exist.

You could instead use something like the following expression to have 2 decimal places (change the value in bold to the amount of decimal places you want)
Substitute="(\d+).(\d{1,2})?(\d?)+$":"\1.\2"
There could be a better way of doing this, but this seems to work nicely. (Only issue is that this 2nd expression will cause rainmeter to crash if it's done on a value that doesn't have decimals.. though I'm pretty sure the osu api always returns acc with decimals even when whole number.. like 100.00%)
I'm not perfect when it comes to regex, it hurts my head :3

Oh and also for accuracy, I've added 'Postfix' to append a '%' symbol onto the end.

End result, using first expression for PP (to make whole number) and second expression for accuracy:


I'll update the script in my first post.
Topic Starter
Xyrax Alaria
Thankyou so much for your detailed response! This has helped me so much! You are amazing! I will look into making it have a nicer UI maybe at some point, although I just started using rainmeter the other day, and my desktop is all minimalist text anyway. But anyways: Thanks again! I don't deserve this ;; You should make another thread that has this, others may want it, if you haven't already!
Pipotchi
Thanks for the code :) Was just wondering how to do this for other modes besides standard?
XPJ38
You would add &m=X in the URL field, X being the mode (0 = std, 1 = taiko, 2 = ctb, 3 = mania)

Like:
URL=https://osu.ppy.sh/api/get_user?k=ApiKey&u=sexyBEACH&m=2 (for CtB)
More information here.
Dragomegak
what do u request for the api?
Topic Starter
Xyrax Alaria

Dragomegak wrote:

what do u request for the api?
Just put in anything. It gives you what you need right away. I linked to the forum post as the app URL and then the name was just like "Osu!Rank Rainmeter Skin"
Dragomegak
I'm still really lost about making skins, is there anyway for you to post a download link for me to just plug into rainmeter?
Primula_old
Toy
It looks like the brackets in my name break the code. Is there a way around this?

Edit: u=%5BToy%5D makes the brackets work.
FrzR

[Toy] wrote:

It looks like the brackets in my name break the code. Is there a way around this?
Try using quotes (") and see if it works.
Dolgy
This worked fine for me until today, now when I use rainmeter and the osu!rank app is selected my Rainmeter crashes. :/

Never mind I restarted my computer and it worked again.
Primula_old

[Toy] wrote:

It looks like the brackets in my name break the code. Is there a way around this?
Late reply but, you can just use your user id instead (2757689)
Dexus
I did an example that uses the default theme for rainmeter.
Simply save as "Rank.ini" in "%Userprofile%\My Documents\Rainmeter\Skins\illustro\Rank"
You can click the title to update the results

Code
[Rainmeter]
Update=1000
Background=#@#Background.png
BackgroundMode=3
BackgroundMargins=0,34,0,14

[Variables]
fontName=Trebucht MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205

; =====================================
;
; MEASUREMENTS
;
; =====================================

[MeasureParse]
Measure=Plugin
Plugin=WebParser

; Be sure to replace the api key with your own, and the username with the one you want to get data on
; The api key can be accessed here https://osu.ppy.sh/p/api

URL=https://osu.ppy.sh/api/get_user?k=api_key&u=username

RegExp=(?siU)user_id":"(.*)".*username":"(.*)".*count300":"(.*)".*count100":"(.*)".*count50":"(.*)".*playcount":"(.*)".*ranked_score":"(.*)".*total_score":"(.*)".*pp_rank":"(.*)".*level":"(.*)".*pp_raw":"(.*)".*accuracy":"(.*)".*count_rank_ss":"(.*)".*count_rank_s":"(.*)".*count_rank_a":"(.*)".*country":"(.*)"
UpdateRate=60

; String index list
; This Uses the large Regular Expression above, each number retrieves the value it relates to.
;1 user_id
;2 username
;3 count300
;4 count100
;5 count50
;6 playcount
;7 ranked_score
;8 total_score
;9 pp_rank
;10 level
;11 pp_raw
;12 accuracy
;13 count_rank_ss
;14 count_rank_s
;15 count_rank_a
;16 country

[MeasureRank]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParse]
StringIndex=9

[MeasurePP]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParse]
StringIndex=11

[MeasureAccRaw]
Measure=Plugin
Plugin=WebParser
URL=[MeasureParse]
StringIndex=12

; Round this shit because we don't care about anything past the hundredth decimal value
[MeasureAcc]
Measure=Calc
Formula=Round(MeasureAccRaw,2)

; =====================================
;
; STYLES
;
; =====================================

[styleTitle]
StringAlign=CENTER
StringCase=UPPER
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=LEFT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=RIGHT
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleBar]
BarColor=#colorBar#
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

[styleSeperator]
SolidColor=255,255,255,15

; =====================================
;
; Title
;
; =====================================

[meterTitle]
Meter=STRING
MeterStyle=styleTitle
X=100
Y=12
W=190
H=18
Text="osu!"
LeftMouseUpAction=[!CommandMeasure MeasureParse Update]
ToolTipText="Refresh Stats"

; =====================================
;
; Rank
;
; =====================================

[MeterRankLabel]
Meter=STRING
MeterStyle=styleLeftText
X=10
; Because This is the first in the list it has to be 28r (28 pixels relative to the title), the rest are 8r
Y=28r

W=190
H=14
Text="Rank"

[MeterRank]
Meter=STRING
MeterStyle=styleRightText
MeasureName=MeasureRank
X=200
Y=0r
W=190
H=14
Prefix="#"

[meterRankSeperator]
Meter=IMAGE
MeterStyle=styleSeperator
X=10
Y=12r
W=190
H=1

; =====================================
;
; PP
;
; =====================================

[meterPPLabel]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=8r
W=190
H=14
Text="PP"

[meterPP]
Meter=STRING
MeterStyle=styleRightText
MeasureName=MeasurePP
X=200
Y=0r
W=190
H=14

[meterPPSeperator]
Meter=IMAGE
MeterStyle=styleSeperator
X=10
Y=12r
W=190
H=1

; =====================================
;
; Accuracy
;
; =====================================

[meterAccuracyLabel]
Meter=STRING
MeterStyle=styleLeftText
X=10
Y=8r
W=190
H=14
Text="Accuracy"

[meterAccuracy]
Meter=STRING
MeterStyle=styleRightText
MeasureName=MeasureAcc
X=200
Y=0r
W=190
H=14
NumOfDecimals=2
Postfix="%"


[meterAccuracySeperator]
Meter=IMAGE
MeterStyle=styleSeperator
X=10
Y=12r
W=190
H=1
Oinari-sama
^Just tried your template, it worked like a charm! Thanks!
Sonicoa
I really liked the idea of an Osu!Rank for Rainmeter, so I edit the Dexus's exemple to add new functions:
  1. Add a button to change the mode without having to edit the ini file
  2. Add a refresh button
  3. Add a variante of the Dexus's skin with other stats (You can acces to this "expand" version by clicking on the title). It includes avatar, country flag, level, scores...
So how it looks like :

Screenshots

Dexus Version that I didn't much edit



Expand Version

Here's a download link : https://mega.nz/#!MohjXBSJ!LLWmsThnUt_T ... 1lRRKpJhmA (v1.6)

You need to enter your ApiKey and Username and then, after you saved the file, you need to actualize manually the skin (right click on it -> Actualize the skin). It should load your info. Then you need to use the refresh button just one time to transfer your ApiKey and Username to the variante, so you don't need to write them again. All informations and instructions are in both ini files too ;)
Dolgy

Sonicoa wrote:

I really liked the idea of an Osu!Rank for Rainmeter, so I edit the Dexus's exemple to add new functions:
  1. Add a button to change the mode without having to edit the ini file
  2. Add a refresh button
  3. Add a variante of the Dexus's skin with other stats (You can acces to this "expand" version by clicking on the title). It includes avatar, country flag, level, scores...
So how it looks like :

Screenshots

Dexus Version that I didn't much edit



Expand Version

However there are some things to improve but I don't know how to do this on Rainmeter, so if anyone could help me it's would be fine :D :

  1. The scores would be more readable like this : 11 063 192 198 or 11,063,192,198
  2. There is an Autoscale in the ToolTipText of the Level so in my case it shows 1 G instead of 1597539124. (I think it is scales by 1024 but "Autoscale=0" did nothing against that).
Here's a download link : http://puu.sh/9VrIG/e6c0104a4f.rmskin

You just need to put your ApiKey and your username in one of the ini files then refresh two times. All informations and instructions are in both ini files too ;)
For some reason I can't make it work :/
I did everything like you said but it doesn't track my info.
show more
Please sign in to reply.

New reply