Skip to content

Commit

Permalink
Rework localization IDs to have blank entry for TV input
Browse files Browse the repository at this point in the history
  • Loading branch information
casenjo committed Aug 20, 2017
1 parent 8aa0c36 commit b79396c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 42 deletions.
50 changes: 25 additions & 25 deletions resources/Language/English/strings.po
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
# Kodi Media Center language file
# Addon Name: Bravia TV Wakeup
# Addon id: service.tv.wakeup
# Kodi Smart TV Service language file
# Addon Name: Kodi Smart TV Service
# Addon id: service.smarttvservice
# Addon Provider: casenjo
msgid ""
msgstr ""
"Project-Id-Version: Bravia TV Wakeup\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Kodi Translation Team\n"
"Language-Team: English (US) (http://www.transifex.com/projects/p/xbmc-addons/language/en_US/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en_US\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

msgctxt "#31000"
msgctxt "#30000"
msgid "TV Settings"
msgstr "TV Settings"

msgctxt "#31010"
msgctxt "#30001"
msgid "TV IP Address"
msgstr "TV IP Address"

msgctxt "#31020"
msgctxt "#30002"
msgid "TV Mac Address"
msgstr "TV Mac Address"

msgctxt "#31030"
msgctxt "#30003"
msgid "TV Input"
msgstr "TV Input"

msgctxt "#31031"
msgctxt "#30004"
msgid "HDMI 1"
msgstr "HDMI 1"

msgctxt "#31032"
msgctxt "#30005"
msgid "HDMI 2"
msgstr "HDMI 2"

msgctxt "#31033"
msgctxt "#30006"
msgid "HDMI 3"
msgstr "HDMI 3"

msgctxt "#31034"
msgctxt "#30007"
msgid "HDMI 4"
msgstr "HDMI 4"

msgctxt "#31040"
msgctxt "#30008"
msgid ""
msgstr ""

msgctxt "#30009"
msgid "Time to wait until TV will sleep"
msgstr "Time to wait until TV will sleep"

msgctxt "#31050"
msgctxt "#30010"
msgid "TV PIN"
msgstr "TV PIN"

msgctxt "#32000"
msgctxt "#30011"
msgid "Plugin not connected to the TV. Do you want to connect to it?"
msgstr "Plugin not connected to the TV. Do you want to connect to it?"

msgctxt "#32001"
msgctxt "#30012"
msgid "If yes, be aware that the dialog on the TV might be large and will not let you see the interface to input the PIN."
msgstr "If yes, be aware that the dialog on the TV might be large and will not let you see the interface to input the PIN."

msgctxt "#32002"
msgctxt "#30013"
msgid "You can use your keyboard to type the code and then press Enter :)"
msgstr "You can use your keyboard to type the code and then press Enter :)"

msgctxt "#32003"
msgctxt "#30014"
msgid "Enter PIN from TV"
msgstr "Enter PIN from TV"

msgctxt "#32004"
msgctxt "#30015"
msgid "PIN incorrect, unable to connect"
msgstr "PIN incorrect, unable to connect"

msgctxt "#32005"
msgctxt "#30016"
msgid "TV IP address not configured"
msgstr "TV IP address not configured"

msgctxt "#32006"
msgctxt "#30017"
msgid "TV MAC address not configured"
msgstr "TV MAC address not configured"

msgctxt "#32007"
msgctxt "#30018"
msgid "TV Input must be selected"
msgstr "TV Input must be selected"
12 changes: 6 additions & 6 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="31000">
<setting label="31010" type="ipaddress" id="tvIpAddress" default="" />
<setting label="31020" type="text" id="tvMacAddress" default="" />
<setting label="31030" type="select" id="tvInput" lvalues="31031|31032|31033|31034" />
<setting label="31040" type="number" id="timeUntilSleep" default="5" />
<setting label="31050" type="text" id="tvPin" default="0000" />
<category label="30000">
<setting label="30001" type="ipaddress" id="tvIpAddress" default="" />
<setting label="30002" type="text" id="tvMacAddress" default="" />
<setting label="30003" type="select" id="tvInput" lvalues="30008|30004|30005|30006|30007" />
<setting label="30009" type="number" id="timeUntilSleep" default="5" />
<setting label="30010" type="text" id="tvPin" default="0000" />
</category>
</settings>
23 changes: 12 additions & 11 deletions service.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ def __init__(self):
# TODO: This is too specific to Bravia TVs, part of it should be moved to a Bravia specific class and use a generic getTvSource method to get it instead
def getTvInputSetting(self):
input = utils.getSetting('tvInput')
# 0 => HDMI 1, 1 => HDMI 2, etc
# 0 => '', 1 => HDMI 1, etc
return {
'0': 'HDMI 1',
'1': 'HDMI 2',
'2': 'HDMI 3',
'3': 'HDMI 4'
'0': '',
'1': 'HDMI 1',
'2': 'HDMI 2',
'3': 'HDMI 3',
'4': 'HDMI 4'
}.get(input, '') # '' is default if input not found

def connectToTv(self, pin):
Expand All @@ -57,7 +58,7 @@ def connectToTv(self, pin):
# Configure TV connection
def configureTvConnection(self):
utils.log("Default PIN detected, starting configuration flow")
userWantsToConnect = utils.yesNoDialog(utils.getString(32000), utils.getString(32001), utils.getString(32002))
userWantsToConnect = utils.yesNoDialog(utils.getString(30011), utils.getString(30012), utils.getString(30013))

if not userWantsToConnect:
utils.log("User denied prompt, exiting")
Expand All @@ -77,7 +78,7 @@ def configureTvConnection(self):

if not self.braviarc.is_connected():
utils.log("PIN incorrect, exiting")
utils.notificationError(utils.getString(32004))
utils.notificationError(utils.getString(30015))
self.isRunning = False
return
else:
Expand All @@ -97,7 +98,7 @@ def getPinFromUserPrompt(self):
pinFromTv = ''

while not self.validatePin(pinFromTv):
pinFromTv = utils.numberDialog(utils.getString(32003))
pinFromTv = utils.numberDialog(utils.getString(30014))
if not self.validatePin(pinFromTv):
userWantsToTryAgain = utils.yesNoDialog('PIN incorrect, it needs to be exactly 4 digits.', 'Try again?')
if not userWantsToTryAgain:
Expand All @@ -116,15 +117,15 @@ def configIsValid(self):
utils.log("Checking configuration")
if self.tvIp == '':
utils.log("Configuration failed, TV IP is missing")
utils.notificationError(utils.getString(32005))
utils.notificationError(utils.getString(30016))
return False
if self.tvMacAddress == '':
utils.log("Configuration failed, TV MAC is missing")
utils.notificationError(utils.getString(32006))
utils.notificationError(utils.getString(30017))
return False
if self.tvInput == '':
utils.log("Configuration failed, TV Input must be selected")
utils.notificationError(utils.getString(32007))
utils.notificationError(utils.getString(30018))
return False
utils.log("Configuration validated")
return True
Expand Down

0 comments on commit b79396c

Please sign in to comment.