So as my title says I want to ideally create a skin that displays who is streaming games of Starcraft 2. I do not really know where to begin though.
Here is the team liquid website
http://www.teamliquid.net/
I want to use the "on air" section and the "Live Steams" section for most likely two skins.
I have a web parser so I was thinking I could use that or an RSS feed but since I am a noob with these things I do not know which to use or how to go about starting this.
Has anyone done anything similar to this that I could reference? Or can some one point me in the right starting direction?
It is currently April 28th, 2024, 8:00 am
Creating skin for SC2 streams off Team liquid
-
- Posts: 7
- Joined: April 15th, 2012, 5:27 pm
-
- Posts: 7
- Joined: April 15th, 2012, 5:27 pm
Re: Creating skin for SC2 streams off Team liquid
So I know this is a bump but I started working on my skin and I still trying to learn this as I go by reading the tutorial and trying to reverse engineering the illustru reader skin and the tutorial find IP skin.
I have found the xml feed for the team liquid site http://www.teamliquid.net/video/streams/?filter=live&xml=1
They seem to use the format like this for their code:
So From that I am trying to capturing just the important parts (owner of the stream, the link and the race they play) but what I am ending up seems a little messy to me.
This is the skin I have built so far but I am not getting any information displayed. Am I moving in the right direction?
I have found the xml feed for the team liquid site http://www.teamliquid.net/video/streams/?filter=live&xml=1
They seem to use the format like this for their code:
Code: Select all
<stream type="SC2" status="online" owner="biGs." featured="1" viewers="196" race="Z" rating="Everyone">
<channel type="Justin" title="biGs.">chohansang</channel>
<link type="embed">http://www.teamliquid.net/video/streams/biGs.</link>
</stream>
This is the skin I have built so far but I am not getting any information displayed. Am I moving in the right direction?
-
- Posts: 1173
- Joined: January 22nd, 2011, 4:23 pm
- Location: GMT +8
Re: Creating skin for SC2 streams off Team liquid
You are certainly heading in the right direction, but you have to download http://www.teamliquid.net/video/streams/?filter=live&xml=1 as a text file before using a RegExp because of the gzip encoding. The following skin uses [MeasureWebsite] to download the file to TeamLiquid.txt which is then read by [MeasureTextFile].waldm63 wrote:This is the skin I have built so far but I am not getting any information displayed. Am I moving in the right direction?
Code: Select all
[Variables]
UpdateFeeds=1200
GetGame=(?(?=.*type="SC2").*<stream type="SC2" status="online".*owner="(.*)".* viewers="(.*)" race="(.*)" rating.*<link type="embed">(.*)</link>)
;--- [ style ]
[StyleText]
StringAlign=LEFT
FontFace=Calibri
FontSize=10
StringStyle=BOLD
FontColor=FFFFFF
Y=r
AntiAlias=1
;--- [ measures ]
[MeasureWebsite]
Measure=Plugin
Plugin=WebParser
Url="http://www.teamliquid.net/video/streams/?filter=live&xml=1"
CodePage=65001
Download=1
DownloadFile=TeamLiquid.txt
FinishAction=!EnableMeasure MeasureTextFile
UpdateRate=#UpdateFeeds#
[MeasureTextFile]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=file://#CURRENTPATH#DownloadFile\TeamLiquid.txt
RegExp="(?siU)#GetGame##GetGame##GetGame#"
FinishAction=!DisableMeasure MeasureTextFile
Disabled=1
;--- [ 1st game ]
[ReadOwner1]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=1
[ReadViewers1]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=2
[ReadRaces1]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=3
[ReadLink1]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=4
;--- [ 2nd game ]
[ReadOwner2]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=5
[ReadViewers2]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=6
[ReadRaces2]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=7
[ReadLink2]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureTextFile]
StringIndex=8
;--- [ meters ]
[BackGround]
Meter=IMAGE
W=240
H=80
SolidColor=0,0,0,88
Update=-1
[Header]
Meter=String
MeterStyle=StyleText
Text="Owner Viewers Races"
[Owner1]
Meter=String
MeterStyle=StyleText
MeasureName=ReadOwner1
LeftMouseDownAction=["[ReadLink1]"]
Y=22r
[ViewersRaces1]
Meter=String
MeterStyle=StyleText
MeasureName=ReadViewers1
MeasureName2=ReadRaces1
X=150
Text=%1 %2
[Owner2]
Meter=String
MeterStyle=StyleText
MeasureName=ReadOwner2
LeftMouseDownAction=["[ReadLink2]"]
Y=18r
[ViewersRaces2]
Meter=String
MeterStyle=StyleText
MeasureName=ReadViewers2
MeasureName2=ReadRaces2
X=150
Text=%1 %2
-
- Posts: 7
- Joined: April 15th, 2012, 5:27 pm
Re: Creating skin for SC2 streams off Team liquid
Awesome that works, thank you so much. I am now going to pretty this guy up and get it to be maybe the top 10 streams. Thank you for help getting it functional.
I just want to make sure I understand what is going on with this part though.
So the first chunk is basically saying look for the type ="SC2" on the xml page. From there it captures from the starting points of .* with the variable being a (.*) and then ends the capture at the next .*. All the other stuff on there is just points of reference for the web parser so that it knows where to go.
I just want to make sure I understand what is going on with this part though.
Code: Select all
(?(?=.*type="SC2").*<stream type="SC2" status="online".*owner="(.*)".* viewers="(.*)" race="(.*)" rating.*<link type="embed">(.*)</link>)
-
- Posts: 1173
- Joined: January 22nd, 2011, 4:23 pm
- Location: GMT +8
Re: Creating skin for SC2 streams off Team liquid
The (?(?=.*type="SC2") bit is a Lookahead Assertion which you can read about here. It's not strictly required in this case because there are always plenty of streams online, but I just stuck it there to be sure the RegExp wouldn't pick up any of the Dota streams. The rest of it is much as you thought. However, going ahead with a RegExp to get the information for twelve streams is going to mean 48 Measures with a StringIndex and up to 48 Meters to handle the output. So here is a little skin with only 3 measures, 15 meters and a LUA script that does the same sort of job.waldm63 wrote:I just want to make sure I understand what is going on with this part though.
TeamLiquid.ini
Code: Select all
[Variables]
StreamsToDisplay=12
TextColor=82cafa
PanelColor=293c5cee
ColorHighlight=ffffffee
ColorBackLight=77b5dfee
GetGame=(?(?=.*type="SC2").*<stream type="SC2" status="online".*owner="(.*)".* viewers="(.*)" race="(.*)" rating.*<link type="embed">(.*)</link>)
;- WARNING Do NOT set UpdateFeeds anything below 300 (5 minutes) or you are likely to have your IP Banned!
UpdateFeeds=900
PanelHeight=0
;--- [ style ]
[StyleText]
StringAlign=LEFT
FontFace=Courier New
FontSize=9
StringStyle=BOLD
W=280
H=15
FontColor=#TextColor#
MouseOverAction=[!SetOption "#CURRENTSECTION#" FontColor #ColorHighlight#] [!SetOption "#CURRENTSECTION#" SolidColor #ColorBacklight#] [!Update]
MouseLeaveAction=[!SetOption "#CURRENTSECTION#" FontColor ""] [!SetOption "#CURRENTSECTION#" SolidColor ""][!Update]
X=5
Y=18r
AntiAlias=1
;--- [ measures ]
[MeasureWebsite]
Measure=Plugin
Plugin=WebParser
Url="http://www.teamliquid.net/video/streams/?filter=live&xml=1"
CodePage=65001
Download=1
DownloadFile=TeamLiquid.txt
FinishAction=!EnableMeasure MeasureTextFile
UpdateRate=#UpdateFeeds#
[MeasureTextFile]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=file://#CURRENTPATH#DownloadFile\TeamLiquid.txt
RegExp="(?siU)^(.*)$"
FinishAction=[!DisableMeasure MeasureTextFile] [!EnableMeasure MeasureLuaScript]
Disabled=1
[MeasureLuaScript]
Measure=Script
ScriptFile="#CURRENTPATH#TeamLiquid.lua"
Disabled=1
;--- [ meters ]
[TeamLiquidBanner]
Meter=IMAGE
ImageName=TeamLiquidBanner.jpg
LeftMouseUpAction=http://www.teamliquid.net/video/streams/
UpdateDivider=-1
[StreamsBackGround]
Meter=IMAGE
Y=50
W=290
H=#PanelHeight#
SolidColor=#PanelColor#
DynamicVariables=1
[Header]
Meter=String
MeterStyle=StyleText
FontColor=d2e3ee
Y=33
Text="Owner Viewers Races"
UpdateDivider=-1
[MtStream1]
Meter=String
MeterStyle=StyleText
Y=23r
[MtStream2]
Meter=String
MeterStyle=StyleText
[MtStream3]
Meter=String
MeterStyle=StyleText
[MtStream4]
Meter=String
MeterStyle=StyleText
[MtStream5]
Meter=String
MeterStyle=StyleText
[MtStream6]
Meter=String
MeterStyle=StyleText
[MtStream7]
Meter=String
MeterStyle=StyleText
[MtStream8]
Meter=String
MeterStyle=StyleText
[MtStream9]
Meter=String
MeterStyle=StyleText
[MtStream10]
Meter=String
MeterStyle=StyleText
[MtStream11]
Meter=String
MeterStyle=StyleText
[MtStream12]
Meter=String
MeterStyle=StyleText
Code: Select all
function Initialize()
iMaxStreams = SKIN:GetVariable("StreamsToDisplay")
sPatternStream='.-<stream type="SC2"(.-)</stream>'
msTextFile = SKIN:GetMeasure("MeasureTextFile")
iPanelHeight = SKIN:GetVariable("PanelHeight")
end -- of Initialize
function Update()
SKIN:Bang("!DisableMeasure MeasureLuaScript")
-- INPUT ALL STREAMS
sRaw = msTextFile:GetStringValue()
-- FILL TABLES WITH SC2 STREAMS
tOwners,tViewers,tRaces,tRating,tLinks,tStreams,StreamsByViewer ={},{},{},{},{},{},{}
iCount=0
for sItem in string.gmatch(sRaw,sPatternStream) do
iCount = iCount + 1
table.insert(tOwners,string.match(sItem,'.-owner="(.-)"'))
table.insert(tViewers,string.match(sItem,'.-viewers="(.-)"'))
if tViewers[iCount] == nil then tViewers[iCount] = 0 else
tViewers[iCount] = tonumber(tViewers[iCount]) end
table.insert(tRaces,string.match(sItem,'.-race="(.-)"'))
if tRaces[iCount] == nil then tRaces[iCount] = "?" end
table.insert(tLinks,string.match(sItem,'.-<link type="embed">(.-)</link>'))
table.insert(tStreams, { Owner = tOwners[iCount], Viewers = tViewers[iCount], Races = tRaces[iCount], Link = tLinks[iCount] } )
end
-- SORT TABLES by number of viewers
for k,v in pairs( tStreams ) do table.insert( StreamsByViewer, {key=k, stream=v} ) end
table.sort(StreamsByViewer, function(a,b) return a.stream.Viewers > b.stream.Viewers end)
-- OUTPUT
SKIN:Bang('!SetVariable', 'PanelHeight', (32+(iMaxStreams*18) ) )
for n, s in ipairs(StreamsByViewer) do
if n < (iMaxStreams+1) then
local sMtText = string.format("%-20s %5d %9s",s.stream.Owner, s.stream.Viewers,s.stream.Races)
SKIN:Bang('!SetOption','MtStream'..n..'','Text',sMtText)
SKIN:Bang('!SetOption','MtStream'..n..'','LeftMouseUpAction',s.stream.Link)
end
end
return 'Streams displayed'
end -- of Update
Enjoy
You do not have the required permissions to view the files attached to this post.
-
- Posts: 7
- Joined: April 15th, 2012, 5:27 pm
Re: Creating skin for SC2 streams off Team liquid
Okay so with the code you posted on the last one I only see the top block of the skin. The meat and potatoes of that skin are not displaying. I have been looking it over but I do not see why they are not displaying. I just copied what you had posted and went with that in a new .ini/.lua to give the skin a fresh start so there is no other code conflicting with it.
I have the .ini and the .lua files in the same folder with a subfolder for the DownloadFile\TeamLiquid.txt so I do not think it is in my organization. I even allowed rainmeter to work through my firewall. (My other skins worked fine without this though)
Any ideas on what I am missing? I am assuming it is probably something really stupid since I am still a novice
I have the .ini and the .lua files in the same folder with a subfolder for the DownloadFile\TeamLiquid.txt so I do not think it is in my organization. I even allowed rainmeter to work through my firewall. (My other skins worked fine without this though)
Any ideas on what I am missing? I am assuming it is probably something really stupid since I am still a novice
-
- Posts: 1173
- Joined: January 22nd, 2011, 4:23 pm
- Location: GMT +8
Re: Creating skin for SC2 streams off Team liquid
Seems to work well enough for me - I assume you also downloaded TeamLiquidBanner.jpg and put that in the same folder as the .ini and .lua files.
Are you running the latest beta version of rainmeter? If not, get it here. If it still doesn't work, I suggest you take a look at the Log to see if there are any error messages there. Right-Click on the Rainmeter Icon in the system tray -> About -> Log.
Are you running the latest beta version of rainmeter? If not, get it here. If it still doesn't work, I suggest you take a look at the Log to see if there are any error messages there. Right-Click on the Rainmeter Icon in the system tray -> About -> Log.
-
- Posts: 7
- Joined: April 15th, 2012, 5:27 pm
Re: Creating skin for SC2 streams off Team liquid
Ah.. I was running the latest non-beta version. I downloaded it and it is now working. Haha I even checked to make sure my rainmeter was up to date but didn't think to instal the beta =0
-
- Posts: 1173
- Joined: January 22nd, 2011, 4:23 pm
- Location: GMT +8
Re: Creating skin for SC2 streams off Team liquid
Good to hear that you got it working and don't forget that a Zerg swarm will take down Protoss or Terrans most days of the week.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 7
- Joined: April 15th, 2012, 5:27 pm
Re: Creating skin for SC2 streams off Team liquid
Haha this is true but I am terran I can just wall, get tanks and turtle till you get bored and leave. =0