示例#1
0
    def setChannelsList(self):
        root = self.getChannelsList()
        t = int(root.findtext("servertime"))
        self.trace("server time %s" % datetime.datetime.fromtimestamp(t))
        setSyncTime(datetime.datetime.fromtimestamp(t))

        groups = root.find("groups")
        for group in groups.findall("item"):
            gid = int(group.findtext("id").encode("utf-8"))
            groupname = group.findtext("name").encode("utf-8")
            channels = group.find("channels")
            for channel in channels.findall("item"):
                id = int(channel.findtext("id").encode("utf-8"))
                name = channel.findtext("name").encode("utf-8")
                num = int(channel.findtext("number").encode("utf-8"))
                archive = int(channel.findtext("has_archive").encode("utf-8"))
                self.channels[id] = Channel(name, groupname, num, gid, archive)
                self.channels[id].is_protected = int(channel.findtext("protected"))
                if channel.findtext("epg_current_title") and channel.findtext("epg_current_start"):
                    prog = channel.findtext("epg_current_title").encode("utf-8") + "\n"
                    prog += channel.findtext("epg_current_info").encode("utf-8")
                    t_start = datetime.datetime.fromtimestamp(int(channel.findtext("epg_current_start")))
                    t_end = datetime.datetime.fromtimestamp(int(channel.findtext("epg_current_end").encode("utf-8")))
                    self.channels[id].epg = EpgEntry(prog, t_start, t_end)
                if channel.findtext("epg_next_title") and channel.findtext("epg_next_start"):
                    prog = channel.findtext("epg_next_title").encode("utf-8") + "\n"
                    prog += channel.findtext("epg_next_info").encode("utf-8")
                    t_start = datetime.datetime.fromtimestamp(int(channel.findtext("epg_next_start").encode("utf-8")))
                    t_end = datetime.datetime.fromtimestamp(int(channel.findtext("epg_next_end").encode("utf-8")))
                    self.channels[id].nepg = EpgEntry(prog, t_start, t_end)
                else:
                    # print "[RodnoeTV] there is no epg for id=%d on rtv-server" % id
                    pass
示例#2
0
 def setChannelsList(self):
     root = self.getChannelsList()
     lst = []
     t_str = root.findtext("servertime").encode("utf-8")
     t_cur = datetime.datetime.fromtimestamp(int(t_str))
     setSyncTime(t_cur)
     num = -1
     for group in root.find("groups"):
         title = group.findtext("name").encode("utf-8")
         gid = int(group.findtext("id"))
         for channel in group.find("channels"):
             num += 1
             name = channel.findtext("name").encode("utf-8")
             id = int(channel.findtext("id").encode("utf-8"))
             archive = channel.findtext("have_archive") or 0
             self.channels[id] = Channel(name, title, num, gid, archive)
             if channel.findtext("epg_progname") and channel.findtext(
                     "epg_end"):
                 prog = channel.findtext("epg_progname").encode("utf-8")
                 t_str = channel.findtext("epg_start").encode("utf-8")
                 t_start = datetime.datetime.fromtimestamp(int(t_str))
                 t_str = channel.findtext("epg_end").encode("utf-8")
                 t_end = datetime.datetime.fromtimestamp(int(t_str))
                 #print "[KartinaTV] updating epg for cid = ", id
                 self.channels[id].epg = EpgEntry(prog, t_start, t_end)
             else:
                 #print "[KartinaTV] there is no epg for id=%d on ktv-server" % id
                 pass
示例#3
0
	def setChannelsList(self):
		root = self.getChannelsList()
		lst = []
		t_str = root.findtext("servertime").encode("utf-8")
		t_cur = datetime.datetime.fromtimestamp(int(t_str))
		setSyncTime(t_cur)
		num = -1
		for group in root.find("groups"):
			title = group.findtext("name").encode("utf-8")
			gid = int(group.findtext("id"))
			for channel in group.find("channels"):
				num += 1
				name = channel.findtext("name").encode("utf-8")
				id = int(channel.findtext("id").encode("utf-8"))
				archive = channel.findtext("have_archive") or 0
				self.channels[id] = Channel(name, title, num, gid, archive)
				if channel.findtext("epg_progname") and channel.findtext("epg_end"):
					prog = channel.findtext("epg_progname").encode("utf-8")
					t_str = channel.findtext("epg_start").encode("utf-8")
					t_start = datetime.datetime.fromtimestamp(int(t_str))
					t_str = channel.findtext("epg_end").encode("utf-8")
					t_end = datetime.datetime.fromtimestamp(int(t_str))
					#print "[KartinaTV] updating epg for cid = ", id
					self.channels[id].epg = EpgEntry(prog, t_start, t_end)
				else:
					#print "[KartinaTV] there is no epg for id=%d on ktv-server" % id
					pass
示例#4
0
    def setChannelsList(self):
        root = self.getChannelsList()
        t = int(root.findtext('servertime'))
        self.trace('server time %s' % datetime.datetime.fromtimestamp(t))
        setSyncTime(datetime.datetime.fromtimestamp(t))

        groups = root.find('groups')
        for group in groups.findall('item'):
            gid = int(group.findtext('id').encode('utf-8'))
            groupname = group.findtext('name').encode('utf-8')
            channels = group.find('channels')
            for channel in channels.findall('item'):
                id = int(channel.findtext('id').encode('utf-8'))
                name = channel.findtext('name').encode('utf-8')
                num = int(channel.findtext('number').encode('utf-8'))
                self.channels[id] = Channel(name, groupname, num, gid)
示例#5
0
	def setChannelsList(self):
		root = self.getChannelsList()
		t = int(root.findtext('servertime'))
		self.trace('server time %s' % datetime.datetime.fromtimestamp(t))
		setSyncTime(datetime.datetime.fromtimestamp(t))
		
		groups = root.find('groups')
		for group in groups.findall('item'):
			gid = int(group.findtext('id').encode('utf-8'))
			groupname = group.findtext('name').encode('utf-8')
			channels = group.find('channels')
			for channel in channels.findall('item'): 
				id = int(channel.findtext('id').encode('utf-8'))
				name = channel.findtext('name').encode('utf-8')
				num = int(channel.findtext('number').encode('utf-8')) 
				self.channels[id] = Channel(name, groupname, num, gid)
示例#6
0
    def setChannelsList(self):
        root = self.getChannelsList()
        t = int(root.findtext('servertime'))
        self.trace('server time %s' % datetime.datetime.fromtimestamp(t))
        setSyncTime(datetime.datetime.fromtimestamp(t))

        groups = root.find('groups')
        for group in groups.findall('item'):
            gid = int(group.findtext('id').encode('utf-8'))
            groupname = group.findtext('name').encode('utf-8')
            channels = group.find('channels')
            for channel in channels.findall('item'):
                id = int(channel.findtext('id').encode('utf-8'))
                name = channel.findtext('name').encode('utf-8')
                num = int(channel.findtext('number').encode('utf-8'))
                archive = int(channel.findtext('has_archive').encode('utf-8'))
                self.channels[id] = Channel(name, groupname, num, gid, archive)
                self.channels[id].is_protected = int(
                    channel.findtext('protected'))
                if channel.findtext('epg_current_title') and channel.findtext(
                        'epg_current_start'):
                    prog = channel.findtext('epg_current_title').encode(
                        'utf-8') + '\n'
                    prog += channel.findtext('epg_current_info').encode(
                        'utf-8')
                    t_start = datetime.datetime.fromtimestamp(
                        int(channel.findtext('epg_current_start')))
                    t_end = datetime.datetime.fromtimestamp(
                        int(
                            channel.findtext('epg_current_end').encode(
                                'utf-8')))
                    self.channels[id].epg = EpgEntry(prog, t_start, t_end)
                if channel.findtext('epg_next_title') and channel.findtext(
                        'epg_next_start'):
                    prog = channel.findtext('epg_next_title').encode(
                        'utf-8') + '\n'
                    prog += channel.findtext('epg_next_info').encode('utf-8')
                    t_start = datetime.datetime.fromtimestamp(
                        int(
                            channel.findtext('epg_next_start').encode(
                                'utf-8')))
                    t_end = datetime.datetime.fromtimestamp(
                        int(channel.findtext('epg_next_end').encode('utf-8')))
                    self.channels[id].nepg = EpgEntry(prog, t_start, t_end)
                else:
                    #print "[RodnoeTV] there is no epg for id=%d on rtv-server" % id
                    pass