Skip to content

Commit

Permalink
Merge pull request #3 from JustCoderdev/Development
Browse files Browse the repository at this point in the history
1.0.3 - 2022.07.14 | Visual improvement and fixed start crash
  • Loading branch information
JustCoderdev authored Jul 24, 2022
2 parents c6e35a3 + 79fe641 commit d83d36d
Show file tree
Hide file tree
Showing 18 changed files with 556 additions and 520 deletions.
14 changes: 13 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ All of the basic features on the plugin
- Data in title of previous version now is the correct one
- API requests should now no longer crash the plugin

## [1.0.3] - 2022.07.14 | Visual improvement and fixed start crash

### Added
- When the settings are updating the counter is set to `x`
- Added a blank icon to help TP to 'refresh' the visual

### Fixed
- On startup, if offline, the plugin should no longer crash and will set up channels once it is online
- 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


<!-- ## [Unreleased] -->
<!--
### Added
Expand All @@ -54,4 +65,5 @@ All of the basic features on the plugin

[1.0.0]: https://github.com/JustCoderdev/TwitchActivity/tree/d5b02548cd3f141b0994c05cfed2e136c222fb90
[1.0.1]: https://github.com/JustCoderdev/TwitchActivity/tree/d4de7b5ebb64ea9d45755294f22e8d6bb2cf3b4a
[1.0.2]: https://github.com/JustCoderdev/TwitchActivity/tree/
[1.0.2]: https://github.com/JustCoderdev/TwitchActivity/tree/63585f733113ce215415e845e96538d5620764fa
[1.0.3]: https://github.com/JustCoderdev/TwitchActivity/tree/
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ This documentation is partially generated with [Python TouchPortal SDK](https://

### States

| Id | Description | DefaultValue | parentGroup |
| ------------------------- | ------------------ | ------------ | ----------- |
| .state.refresh_state | Refresh state | idle | |
| .state.time_until_refresh | Time until refresh | 600 | |
| Id | Description | DefaultValue | parentGroup |
| ------------------------- | ------------------ | ----------------- | --------------- |
| .state.refresh_state | Refresh state | idle | Twitch Activity |
| .state.time_until_refresh | Time until refresh | 600 | Twitch Activity |
| .state.blank_icon | Blank icon | _b64 blank Image_ | Twitch Activity |

### Events

Expand Down
9 changes: 8 additions & 1 deletion TwitchActivity/entry.tp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": 6,
"version": 3,
"version": 4,
"name": "Twitch Activity",
"id": "com.github.justcoderdev.twitchactivity",
"configuration": {
Expand Down Expand Up @@ -74,6 +74,13 @@
"desc": "Time until refresh",
"default": "600",
"parentGroup": "Twitch Activity"
},
{
"id": "com.github.justcoderdev.twitchactivity.state.blank_icon",
"type": "text",
"desc": "Blank icon",
"default": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TpVIqDmYQcchQnSxKFXGUKhbBQmkrtOpgcv2EJg1Jiouj4Fpw8GOx6uDirKuDqyAIfoA4OjkpukiJ/0sKLWI8OO7Hu3uPu3eA0Kwy1eyZBFTNMlLxmJTNrUqBVwQgIogoJmRm6on0Ygae4+sePr7eRXiW97k/R3++YDLAJxHPMd2wiDeIZzYtnfM+scjKcp74nHjcoAsSP3JdcfmNc8lhgWeKRiY1TywSS6UuVrqYlQ2VeJo4nFc1yheyLuc5b3FWq3XWvid/YaigraS5TnMEcSwhgSQkKKijgiosRGjVSDGRov2Yh3/Y8SfJpZCrAkaOBdSgQnb84H/wu1uzOBV1k0IxoPfFtj9GgcAu0GrY9vexbbdOAP8zcKV1/LUmMPtJeqOjhY+AgW3g4rqjKXvA5Q4w9KTLhuxIfppCsQi8n9E35YDBWyC45vbW3sfpA5ChrpZvgINDYKxE2ese7+7r7u3fM+3+fgDd6HLSn1KYCQAAAAZiS0dEANkAzwDX/+IwXQAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+YHFAo1GapfoUcAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAABdElEQVR42u3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD+Bn+3AAHo8fTrAAAAAElFTkSuQmCC",
"parentGroup": "Twitch Activity"
}
]
}
Expand Down
Binary file modified TwitchActivity/index.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions b64image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from base64 import b64encode

with open("blank.png", "rb") as img_file:
imgB64 = b64encode(img_file.read())

print(imgB64)
Binary file added blank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 27 additions & 17 deletions build/scripts/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,45 @@

isRunning: bool = True
isOnline: bool = True
hasSetted = False

#!#
TP = Client(ID)


#*#
def updateStates(set: bool = False):
global ID, CHANNELS, DYNAMIC, isOnline
global ID, CHANNELS, DYNAMIC, isOnline, hasSetted

isOnline = checkOnline()

if isOnline:
TP.stateUpdate(f'{ID}.state.refresh_state', 'refresh')
if hasSetted:
TP.stateUpdate(f'{ID}.state.refresh_state', 'refresh')

infos: list = getChannelsInfo(CHANNELS, set)
for info in infos:
icon: str = info['defIcon'] if info['cState'] == 'Online' else getGrayImage(info['defIcon']) if DYNAMIC else info['defIcon']

infos:list = getChannelsInfo(CHANNELS, set)
for info in infos:
icon:str = info['defIcon'] if info['cState'] == 'Online' else getGrayImage(info['defIcon']) if DYNAMIC else info['defIcon']
TP.stateUpdateMany([
{'id': f'{ID}.state.{info["display_name"]}.state', 'value': info['cState']}, # Update state state
{'id': f'{ID}.state.{info["display_name"]}.icon', 'value': icon}, # Update icon state
{'id': f'{ID}.state.{info["display_name"]}.viewers', 'value': info['cViewers']}, # Update viewers state
]) # yapf: disable

TP.stateUpdateMany([
{'id': f'{ID}.state.{info["display_name"]}.state', 'value': info['cState']}, # Update state state
{'id': f'{ID}.state.{info["display_name"]}.icon', 'value': icon}, # Update icon state
{'id': f'{ID}.state.{info["display_name"]}.viewers', 'value': info['cViewers']}, # Update viewers state
]) # yapf: disable
TP.stateUpdate(f'{ID}.state.refresh_state', 'idle')
else:
hasSetted = True
updateSettings([], True)

TP.stateUpdate(f'{ID}.state.refresh_state', 'idle')
else:
TP.stateUpdate(f'{ID}.state.refresh_state', 'connection error')


def updateSettings(data):
global ID, REFRESH, CHANNELS, DYNAMIC
def updateSettings(data:list, noData:bool = False):
global ID, REFRESH, CHANNELS, DYNAMIC, isOnline, hasSetted

TP.stateUpdate(f'{ID}.state.time_until_refresh', 'x')

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

# Update settings
REFRESH['time'] = int(data[1]['Refresh Time (m)'])
CHANNELS = data[0]['Channel names'].replace(' ', '').split(',')[:100]
DYNAMIC = True if data[2]['Dynamic image (bool)'] == '1' else False
if not noData:
REFRESH['time'] = int(data[1]['Refresh Time (m)'])
CHANNELS = data[0]['Channel names'].replace(' ', '').split(',')[:100]
DYNAMIC = True if data[2]['Dynamic image (bool)'] == '1' else False

# Create new states
for channel in CHANNELS:
Expand All @@ -64,7 +74,7 @@ def updateSettings(data):
{'id': f'{ID}.state.{channel}.icon', 'desc': f'{channel} icon', 'value': '', 'parentGroup': channel}, # Create icon state
{'id': f'{ID}.state.{channel}.viewers', 'desc': f'{channel} viewers', 'value': '0', 'parentGroup': channel} # Create viewers state
]) # yapf: disable

updateStates(True)


Expand Down
Loading

0 comments on commit d83d36d

Please sign in to comment.