Ticket #7346: pyth.locale.patch

File pyth.locale.patch, 1.5 KB (added by Raymond Wagner <raymond@…>, 10 years ago)
  • mythtv/bindings/python/MythTV/MythTV.py

     
    1414import socket
    1515import code
    1616import re
     17import locale
    1718from datetime import datetime, tzinfo, timedelta
    1819from time import mktime
    1920
     
    2122from MythLog import *
    2223
    2324log = MythLog(CRITICAL, '#%(levelname)s - %(message)s', 'MythTV')
     25locale.setlocale(locale.LC_ALL, '')
    2426
    2527RECSTATUS = {
    2628                'TunerBusy': -8,
     
    415417                Returns a tuple of the 1, 5, and 15 minute load averages
    416418                """
    417419                res = self.backendCommand('QUERY_LOAD').split(BACKEND_SEP)
    418                 return (float(res[0]),float(res[1]),float(res[2]))
     420                return (locale.atof(res[0]),locale.atof(res[1]),locale.atof(res[2]))
    419421
    420422        def getUptime(self):
    421423                """
     
    909911                self.seriesid = data[33]
    910912                self.programid = data[34]
    911913                self.lastmodified = data[35]
    912                 self.stars = float(data[36])
     914                self.stars = locale.atof(data[36])
    913915                self.airdate = data[37]
    914916                self.hasairdate = int(data[38])
    915917                self.playgroup = data[39]
     
    963965                string += BACKEND_SEP + self.seriesid
    964966                string += BACKEND_SEP + self.programid
    965967                string += BACKEND_SEP + self.lastmodified
    966                 string += BACKEND_SEP + str(self.stars)
     968                string += BACKEND_SEP + locale.format("%0.6f" %self.stars)
    967969                string += BACKEND_SEP + self.airdate
    968970                string += BACKEND_SEP + str(self.hasairdate)
    969971                string += BACKEND_SEP + self.playgroup