Skip to content

Commit

Permalink
Fixed info about the device in kino.pub/device
Browse files Browse the repository at this point in the history
  • Loading branch information
quarckster committed Nov 12, 2018
1 parent 3c939c6 commit 2bfc179
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions resources/lib/addonutils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import json
import platform
import re
import sys
import time
Expand Down Expand Up @@ -122,27 +122,16 @@ def update_device_info(force=False):
# Update device info
deviceInfoUpdate = __settings__.getSetting("device_info_update")
if force or not deviceInfoUpdate or int(deviceInfoUpdate) + 1800 < int(time.time()):
infoLabels = [
'"System.BuildVersion"',
'"System.FriendlyName"',
'"System.KernelVersion"'
]
result = "Busy"
payload = {
"jsonrpc": "2.0",
"method": "XBMC.GetInfoLabels",
"id": 1,
"params": {"labels": [",".join(infoLabels)]}
}
while "Busy" in result:
result = xbmc.executeJSONRPC(json.dumps(payload))
result = json.loads(result)["result"]
title = result.get("System.FriendlyName")
hardware = result.get("System.KernelVersion")
software = "Kodi/{}".format(result.get("System.BuildVersion"))
result = {"build_version": "Busy", "friendly_name": "Busy"}
while "Busy" in result.values():
result = {
"build_version": xbmc.getInfoLabel("System.BuildVersion"),
"friendly_name": xbmc.getInfoLabel("System.FriendlyName")
}
software = "Kodi {}".format(result["build_version"].split()[0])
KinoPubClient("device/notify").post(data={
"title": title,
"hardware": hardware,
"title": result["friendly_name"],
"hardware": platform.machine(),
"software": software
})
__settings__.setSetting("device_info_update", str(int(float(time.time()))))
Expand Down

4 comments on commit 2bfc179

@nikolaev-rd
Copy link
Contributor

@nikolaev-rd nikolaev-rd commented on 2bfc179 Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Круто, что все-таки плагин обновляется. Теперь вместо дефолтной иконки появилась иконка Kodi. Но title и подпись все равно None, и понять который это Kodi из 5-ти шт. - невозможно.
kodi--kino pub

kodi--kino pub--1-5

@Kampfader
Copy link

@Kampfader Kampfader commented on 2bfc179 Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

у меня ок (Kodi 17.6)

- https___kino pub_device

@olsamurai
Copy link

@olsamurai olsamurai commented on 2bfc179 Nov 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Наверное надо вначале удалить, а потом добавить, чтобы информация обновилась? Потому как у меня тоже пока в полях стоит none...

@olsamurai
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сейчас дома попробовал удалить и снова добавить. Всё работает! Пишет и версию Kodi, и процессор, и название бокса.
Теперь не только удобно пользоваться, но и приятно! Спасибо большое за работу!

Please sign in to comment.