Skip to content

Commit d83d36d

Browse files
authored
Merge pull request #3 from JustCoderdev/Development
1.0.3 - 2022.07.14 | Visual improvement and fixed start crash
2 parents c6e35a3 + 79fe641 commit d83d36d

18 files changed

Lines changed: 556 additions & 520 deletions

Changelog.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ All of the basic features on the plugin
3939
- Data in title of previous version now is the correct one
4040
- API requests should now no longer crash the plugin
4141

42+
## [1.0.3] - 2022.07.14 | Visual improvement and fixed start crash
43+
44+
### Added
45+
- When the settings are updating the counter is set to `x`
46+
- Added a blank icon to help TP to 'refresh' the visual
47+
48+
### Fixed
49+
- On startup, if offline, the plugin should no longer crash and will set up channels once it is online
50+
- In the helpers the icon didn't update because the default one wasn't nothing and it covered the plug-in icon being on a higher level
51+
52+
4253
<!-- ## [Unreleased] -->
4354
<!--
4455
### Added
@@ -54,4 +65,5 @@ All of the basic features on the plugin
5465

5566
[1.0.0]: https://github.com/JustCoderdev/TwitchActivity/tree/d5b02548cd3f141b0994c05cfed2e136c222fb90
5667
[1.0.1]: https://github.com/JustCoderdev/TwitchActivity/tree/d4de7b5ebb64ea9d45755294f22e8d6bb2cf3b4a
57-
[1.0.2]: https://github.com/JustCoderdev/TwitchActivity/tree/
68+
[1.0.2]: https://github.com/JustCoderdev/TwitchActivity/tree/63585f733113ce215415e845e96538d5620764fa
69+
[1.0.3]: https://github.com/JustCoderdev/TwitchActivity/tree/

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ This documentation is partially generated with [Python TouchPortal SDK](https://
2525

2626
### States
2727

28-
| Id | Description | DefaultValue | parentGroup |
29-
| ------------------------- | ------------------ | ------------ | ----------- |
30-
| .state.refresh_state | Refresh state | idle | |
31-
| .state.time_until_refresh | Time until refresh | 600 | |
28+
| Id | Description | DefaultValue | parentGroup |
29+
| ------------------------- | ------------------ | ----------------- | --------------- |
30+
| .state.refresh_state | Refresh state | idle | Twitch Activity |
31+
| .state.time_until_refresh | Time until refresh | 600 | Twitch Activity |
32+
| .state.blank_icon | Blank icon | _b64 blank Image_ | Twitch Activity |
3233

3334
### Events
3435

TwitchActivity/entry.tp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": 6,
3-
"version": 3,
3+
"version": 4,
44
"name": "Twitch Activity",
55
"id": "com.github.justcoderdev.twitchactivity",
66
"configuration": {
@@ -74,6 +74,13 @@
7474
"desc": "Time until refresh",
7575
"default": "600",
7676
"parentGroup": "Twitch Activity"
77+
},
78+
{
79+
"id": "com.github.justcoderdev.twitchactivity.state.blank_icon",
80+
"type": "text",
81+
"desc": "Blank icon",
82+
"default": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TpVIqDmYQcchQnSxKFXGUKhbBQmkrtOpgcv2EJg1Jiouj4Fpw8GOx6uDirKuDqyAIfoA4OjkpukiJ/0sKLWI8OO7Hu3uPu3eA0Kwy1eyZBFTNMlLxmJTNrUqBVwQgIogoJmRm6on0Ygae4+sePr7eRXiW97k/R3++YDLAJxHPMd2wiDeIZzYtnfM+scjKcp74nHjcoAsSP3JdcfmNc8lhgWeKRiY1TywSS6UuVrqYlQ2VeJo4nFc1yheyLuc5b3FWq3XWvid/YaigraS5TnMEcSwhgSQkKKijgiosRGjVSDGRov2Yh3/Y8SfJpZCrAkaOBdSgQnb84H/wu1uzOBV1k0IxoPfFtj9GgcAu0GrY9vexbbdOAP8zcKV1/LUmMPtJeqOjhY+AgW3g4rqjKXvA5Q4w9KTLhuxIfppCsQi8n9E35YDBWyC45vbW3sfpA5ChrpZvgINDYKxE2ese7+7r7u3fM+3+fgDd6HLSn1KYCQAAAAZiS0dEANkAzwDX/+IwXQAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+YHFAo1GapfoUcAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAABdElEQVR42u3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+Bn+3AAHo8fTrAAAAAElFTkSuQmCC",
83+
"parentGroup": "Twitch Activity"
7784
}
7885
]
7986
}

TwitchActivity/index.exe

73 Bytes
Binary file not shown.

b64image.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from base64 import b64encode
2+
3+
with open("blank.png", "rb") as img_file:
4+
imgB64 = b64encode(img_file.read())
5+
6+
print(imgB64)

blank.png

924 Bytes
Loading

build/scripts/index.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,45 @@
1313

1414
isRunning: bool = True
1515
isOnline: bool = True
16+
hasSetted = False
1617

1718
#!#
1819
TP = Client(ID)
1920

21+
2022
#*#
2123
def updateStates(set: bool = False):
22-
global ID, CHANNELS, DYNAMIC, isOnline
24+
global ID, CHANNELS, DYNAMIC, isOnline, hasSetted
2325

2426
isOnline = checkOnline()
2527

2628
if isOnline:
27-
TP.stateUpdate(f'{ID}.state.refresh_state', 'refresh')
29+
if hasSetted:
30+
TP.stateUpdate(f'{ID}.state.refresh_state', 'refresh')
31+
32+
infos: list = getChannelsInfo(CHANNELS, set)
33+
for info in infos:
34+
icon: str = info['defIcon'] if info['cState'] == 'Online' else getGrayImage(info['defIcon']) if DYNAMIC else info['defIcon']
2835

29-
infos:list = getChannelsInfo(CHANNELS, set)
30-
for info in infos:
31-
icon:str = info['defIcon'] if info['cState'] == 'Online' else getGrayImage(info['defIcon']) if DYNAMIC else info['defIcon']
36+
TP.stateUpdateMany([
37+
{'id': f'{ID}.state.{info["display_name"]}.state', 'value': info['cState']}, # Update state state
38+
{'id': f'{ID}.state.{info["display_name"]}.icon', 'value': icon}, # Update icon state
39+
{'id': f'{ID}.state.{info["display_name"]}.viewers', 'value': info['cViewers']}, # Update viewers state
40+
]) # yapf: disable
3241

33-
TP.stateUpdateMany([
34-
{'id': f'{ID}.state.{info["display_name"]}.state', 'value': info['cState']}, # Update state state
35-
{'id': f'{ID}.state.{info["display_name"]}.icon', 'value': icon}, # Update icon state
36-
{'id': f'{ID}.state.{info["display_name"]}.viewers', 'value': info['cViewers']}, # Update viewers state
37-
]) # yapf: disable
42+
TP.stateUpdate(f'{ID}.state.refresh_state', 'idle')
43+
else:
44+
hasSetted = True
45+
updateSettings([], True)
3846

39-
TP.stateUpdate(f'{ID}.state.refresh_state', 'idle')
4047
else:
4148
TP.stateUpdate(f'{ID}.state.refresh_state', 'connection error')
4249

4350

44-
def updateSettings(data):
45-
global ID, REFRESH, CHANNELS, DYNAMIC
51+
def updateSettings(data:list, noData:bool = False):
52+
global ID, REFRESH, CHANNELS, DYNAMIC, isOnline, hasSetted
53+
54+
TP.stateUpdate(f'{ID}.state.time_until_refresh', 'x')
4655

4756
# Remove old states
4857
for channel in CHANNELS:
@@ -53,9 +62,10 @@ def updateSettings(data):
5362
]) # yapf: disable
5463

5564
# Update settings
56-
REFRESH['time'] = int(data[1]['Refresh Time (m)'])
57-
CHANNELS = data[0]['Channel names'].replace(' ', '').split(',')[:100]
58-
DYNAMIC = True if data[2]['Dynamic image (bool)'] == '1' else False
65+
if not noData:
66+
REFRESH['time'] = int(data[1]['Refresh Time (m)'])
67+
CHANNELS = data[0]['Channel names'].replace(' ', '').split(',')[:100]
68+
DYNAMIC = True if data[2]['Dynamic image (bool)'] == '1' else False
5969

6070
# Create new states
6171
for channel in CHANNELS:
@@ -64,7 +74,7 @@ def updateSettings(data):
6474
{'id': f'{ID}.state.{channel}.icon', 'desc': f'{channel} icon', 'value': '', 'parentGroup': channel}, # Create icon state
6575
{'id': f'{ID}.state.{channel}.viewers', 'desc': f'{channel} viewers', 'value': '0', 'parentGroup': channel} # Create viewers state
6676
]) # yapf: disable
67-
77+
6878
updateStates(True)
6979

7080

0 commit comments

Comments
 (0)