# Path: pytrainer/lib/date.py
# def second2time(seconds):
#     if not seconds:
#         return 0,0,0
#     hours = seconds // (60*60)
#     seconds %= (60*60)
#     minutes = seconds // 60
#     seconds %= 60
#     return hours,minutes,seconds


import xmlrpclib
import SOAPpy
import os
from pytrainer.lib.date import second2time
from pytrainer.lib.soapUtils import *
from optparse import OptionParser
        self.xmlrpcserver = options.xmlrpcserver
        self.blogid = options.blogid
        self.user = options.bloguser
        self.password = options.blogpass
        self.category_nbr = options.blogcategory
        #if you want accept comment, replace False by True
        self.comment = False
        #or ping
        self.ping = False


        self.category = [{'isPrimary': True, "categoryId" : self.category_nbr}]

        self.error = ""
        self.log =""
        self.idrecord = options.idrecord
        self.webserviceserver = SOAPpy.SOAPProxy("http://localhost:8081/")

        #we try the connection to the xml/rpc server
        try :
            self.connect = xmlrpclib.Server(self.xmlrpcserver)
            self.error = False
        except :
            print("can't connect the server")

    def loadRecordInfo(self):
        record = self.webserviceserver.getRecordInfo(self.idrecord)
        self.sport = record["sport"]
        self.date = record["date"]
        self.distance = record["distance"]

# Path: pytrainer/lib/date.py
# def second2time(seconds):
#     if not seconds:
#         return 0,0,0
#     hours = seconds // (60*60)
#     seconds %= (60*60)
#     minutes = seconds // 60
#     seconds %= 60
#     return hours,minutes,seconds


# Path: extensions/dotclear/main.py
import xmlrpclib
import SOAPpy
import os
from pytrainer.lib.date import second2time
from pytrainer.lib.soapUtils import *
from optparse import OptionParser

        self.xmlrpcserver = options.xmlrpcserver
        self.blogid = options.blogid
        self.user = options.bloguser
        self.password = options.blogpass
        self.category_nbr = options.blogcategory
        #if you want accept comment, replace False by True
        self.comment = False
        #or ping
        self.ping = False


        self.category = [{'isPrimary': True, "categoryId" : self.category_nbr}]

        self.error = ""
        self.log =""
        self.idrecord = options.idrecord
        self.webserviceserver = SOAPpy.SOAPProxy("http://localhost:8081/")

        #we try the connection to the xml/rpc server
        try :
            self.connect = xmlrpclib.Server(self.xmlrpcserver)
            self.error = False
        except :
            print("can't connect the server")

    def loadRecordInfo(self):
        record = self.webserviceserver.getRecordInfo(self.idrecord)
        self.sport = record["sport"]
        self.date = record["date"]
        self.distance = record["distance"]

        self.time = second2time(float(record["time"]))