-
Notifications
You must be signed in to change notification settings - Fork 0
/
Qzone.bas
111 lines (90 loc) · 2.43 KB
/
Qzone.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
B4J=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=7.51
@EndOfDesignText@
Sub Class_Globals
Dim App As AWTRIX
'declare needed variables
Dim viewer As String
End Sub
' ignore
Public Sub Initialize() As String
App.Initialize(Me,"App")
'change plugin name (must be unique, avoid spaces)
App.AppName="Qzone"
'Version of the App
App.AppVersion="2.1"
'Description of the App. You can use HTML to format it
App.AppDescription=$"
Demostrate the number of viewer of ur Qzone<br />
<small>Created by Monsterlady</small>
"$
'SetupInstructions. You can use HTML to format it
App.SetupInfos= $"
<b>QQ:</b> As the name implies, your QQ number.
"$
'How many downloadhandlers should be generated
App.NeedDownloads=1
'IconIDs from AWTRIXER.
App.Icons=Array As Int(58)
'Tickinterval in ms (should be 65 by default)
App.TickInterval=65
'If set to true AWTRIX will wait for the "finish" command before switch to the next app.
App.LockApp=False
'needed Settings for this App (Wich can be configurate from user via webinterface)
App.appSettings=CreateMap("QQ":"")
App.MakeSettings
Return "AWTRIX20"
End Sub
' ignore
public Sub GetNiceName() As String
Return App.AppName
End Sub
' ignore
public Sub Run(Tag As String, Params As Map) As Object
Return App.AppControl(Tag,Params)
End Sub
Public Sub AppStarted
End Sub
'Called with every update from Awtrix
'return one URL for each downloadhandler
Sub App_startDownload(jobNr As Int)
Select jobNr
Case 1
App.DownloadURL= "https://user.qzone.qq.com/"&App.get("QQ")&"/"
End Select
End Sub
'process the response from each download handler
'if youre working with JSONs you can use this online parser
'to generate the code automaticly
'https://json.blueforcer.de/
Sub App_evalJobResponse(Resp As JobResponse)
Try
If Resp.success Then
Select Resp.jobNr
Case 1
Dim Reader As TextReader
Reader.Initialize(Resp.Stream)
Dim line As String
line = Reader.ReadLine
Do While line <> Null
If line.Contains("总浏览量") Then
viewer=line.SubString2(line.IndexOf("""")+1,line.IndexOf("viewer")-1)
Exit
End If
line = Reader.ReadLine
Loop
Reader.Close
End Select
End If
Catch
Log("Error in: "& App.AppName & CRLF & LastException)
Log("API response: " & CRLF & Resp.ResponseString)
End Try
End Sub
Sub App_genFrame
App.genText(viewer,True,1,Null)
App.drawBMP(0,0,App.getIcon(58),8,8)
End Sub