def from_xml_(self, xml_string): program = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.program_id_ = str( program.getElementsByTagName(PROGRAM_ID_NODE) [0].firstChild.data) except: self.program_id_ = None try: self.is_series_ = string_to_bool( program.getElementsByTagName(PROGRAM_IS_SERIES_NODE) [0].firstChild.data) except: self.is_series_ = False try: self.is_record_ = string_to_bool( program.getElementsByTagName(PROGRAM_IS_RECORD_NODE) [0].firstChild.data) except: self.is_record_ = False try: self.is_repeat_record_ = string_to_bool( program.getElementsByTagName(PROGRAM_IS_REPEAT_RECORD_NODE) [0].firstChild.data) except: self.is_repeat_record_ = False return True
def from_xml__(self, xml_string): item = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.object_id_ = str(item.getElementsByTagName(ITEM_OBJECT_ID_NODE)[0].firstChild.data) self.parent_id_ = str(item.getElementsByTagName(ITEM_PARENT_ID_NODE)[0].firstChild.data) except: return False try: self.url_ = str(item.getElementsByTagName(ITEM_URL_NODE)[0].firstChild.data) except: self.url_ = "" try: self.thumbnail_ = str(item.getElementsByTagName(ITEM_THUMBNAIL_NODE)[0].firstChild.data) except: self.thumbnail_ = "" try: self.can_be_deleted_ = string_to_bool(item.getElementsByTagName(ITEM_CAN_BE_DELETED_NODE)[0].firstChild.data) except: self.can_be_deleted_ = False try: self.size_ = int(item.getElementsByTagName(ITEM_SIZE_NODE)[0].firstChild.data) except: self.size_ = 0 try: self.creation_time_ = int(item.getElementsByTagName(ITEM_CREATION_TIME_NODE)[0].firstChild.data) except: self.creation_time_ = 0 return True
def from_xml_(self, xml_string): channel = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.id_ = str(channel.getElementsByTagName(CHANNEL_ID_NODE)[0].firstChild.data) self.dvblink_id_ = long(channel.getElementsByTagName(CHANNEL_DVBLINK_ID_NODE)[0].firstChild.data) self.name_ = channel.getElementsByTagName(CHANNEL_NAME_NODE)[0].firstChild.data except: return False try: self.number_ = int(channel.getElementsByTagName(CHANNEL_NUMBER_NODE)[0].firstChild.data) except: self.number_ = self.NUMBER_INVALID try: self.subnumber_ = int(channel.getElementsByTagName(CHANNEL_SUBNUMBER_NODE)[0].firstChild.data) except: self.subnumber_ = self.SUBNUMBER_INVALID try: self.channel_type_ = int(channel.getElementsByTagName(CHANNEL_TYPE_NODE)[0].firstChild.data) except: self.channel_type_ = ChannelType.CHANNEL_TV try: self.is_child_locked_ = string_to_bool(channel.getElementsByTagName(CHANNEL_CHILD_LOCK_NODE)[0].firstChild.data) except: self.is_child_locked_ = False return True
def from_xml_(self, xml_string): status = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.is_enabled_ = string_to_bool(status.getElementsByTagName(PARENTAL_STATUS_IS_ENABLED_NODE)[0].firstChild.data) except: return False return True
def from_xml_(self, xml_string): schedule = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.schedule_id_ = str( schedule.getElementsByTagName(SCHEDULE_ID_NODE) [0].firstChild.data) except: return False try: self.user_param_ = str( schedule.getElementsByTagName(SCHEDULE_USER_PARAM_NODE) [0].firstChild.data) except: self.user_param_ = "" try: self.is_force_add_ = string_to_bool( schedule.getElementsByTagName(SCHEDULE_FORCE_ADD_NODE) [0].firstChild.data) except: self.is_force_add_ = False try: self.by_epg_ = ByEpgSchedule() self.by_epg_.init_from_xml( schedule.getElementsByTagName(SCHEDULE_BY_EPG_ROOT_NODE) [0].toxml()) except: self.by_epg_ = None try: self.manual_ = ManualSchedule() self.manual_.init_from_xml( schedule.getElementsByTagName(SCHEDULE_MANUAL_ROOT_NODE) [0].toxml()) except: self.manual_ = None return True
def from_xml_(self, xml_string): status = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.is_enabled_ = string_to_bool( status.getElementsByTagName(PARENTAL_STATUS_IS_ENABLED_NODE) [0].firstChild.data) except: return False return True
def from_xml_(self, xml_string): recording = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.id_ = str(recording.getElementsByTagName(RECORDING_ID_NODE)[0].firstChild.data) self.schedule_id_ = str(recording.getElementsByTagName(RECORDING_SCHEDULE_ID_NODE)[0].firstChild.data) self.channel_id_ = str(recording.getElementsByTagName(RECORDING_CHANNEL_ID_NODE)[0].firstChild.data) except: return False try: self.is_active_ = string_to_bool(recording.getElementsByTagName(RECORDING_IS_ACTIVE_NODE)[0].firstChild.data) except: self.is_active_ = False try: self.is_conflicting_ = string_to_bool(recording.getElementsByTagName(RECORDING_IS_CONFLICT_NODE)[0].firstChild.data) except: self.is_conflicting_ = False try: self.program_ = Program(recording.toxml()) except: self.program_ = None return True
def from_xml_(self, xml_string): program = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.program_id_ = str(program.getElementsByTagName(PROGRAM_ID_NODE)[0].firstChild.data) except: self.program_id_ = None try: self.is_series_ = string_to_bool(program.getElementsByTagName(PROGRAM_IS_SERIES_NODE)[0].firstChild.data) except: self.is_series_ = False try: self.is_record_ = string_to_bool(program.getElementsByTagName(PROGRAM_IS_RECORD_NODE)[0].firstChild.data) except: self.is_record_ = False try: self.is_repeat_record_ = string_to_bool( program.getElementsByTagName(PROGRAM_IS_REPEAT_RECORD_NODE)[0].firstChild.data ) except: self.is_repeat_record_ = False return True
def from_xml_(self, xml_string): schedule = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.channel_id_ = str( schedule.getElementsByTagName(SCHEDULE_CHANNEL_ID_NODE) [0].firstChild.data) self.program_id_ = str( schedule.getElementsByTagName(SCHEDULE_PROGRAM_ID_NODE) [0].firstChild.data) self.program_ = Program( schedule.getElementsByTagName(EPG_PROGRAM)[0].toxml()) except: return False try: self.is_repeat_ = string_to_bool( schedule.getElementsByTagName(SCHEDULE_REPEATE_NODE) [0].firstChild.data) except: self.is_repeat_ = False try: self.is_new_only_ = string_to_bool( schedule.getElementsByTagName(SCHEDULE_NEW_ONLY_NODE) [0].firstChild.data) except: self.is_new_only_ = False try: self.is_record_series_anytime_ = string_to_bool( schedule.getElementsByTagName(SCHEDULE_SERIES_ANYTIME_NODE) [0].firstChild.data) except: self.is_record_series_anytime_ = False try: self.recordings_to_keep_ = int( schedule.getElementsByTagName(SCHEDULE_REC_TO_KEEP_NODE) [0].firstChild.data) except: self.recordings_to_keep_ = 0
def step_impl(context, image, command, ignore_rc="false", bg="true", name="", option=""): '''docker run image with detach mode''' options = "" bg = string_to_bool(context, bg) ignore_rc = string_to_bool(context, ignore_rc) if bg: options += '-d ' if name: options += '--name %s ' % name if option: options += option options += ' ' + image + ' ' + command module_args = 'docker run %s' % options context.docker_run_result = context.remote_cmd('command', ignore_rc=ignore_rc, module_args=module_args) assert context.docker_run_result, "Failed to execute '%s'" % module_args
def from_xml__(self, xml_string): item = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.object_id_ = str( item.getElementsByTagName(ITEM_OBJECT_ID_NODE) [0].firstChild.data) self.parent_id_ = str( item.getElementsByTagName(ITEM_PARENT_ID_NODE) [0].firstChild.data) except: return False try: self.url_ = str( item.getElementsByTagName(ITEM_URL_NODE)[0].firstChild.data) except: self.url_ = "" try: self.thumbnail_ = str( item.getElementsByTagName(ITEM_THUMBNAIL_NODE) [0].firstChild.data) except: self.thumbnail_ = "" try: self.can_be_deleted_ = string_to_bool( item.getElementsByTagName(ITEM_CAN_BE_DELETED_NODE) [0].firstChild.data) except: self.can_be_deleted_ = False try: self.size_ = int( item.getElementsByTagName(ITEM_SIZE_NODE)[0].firstChild.data) except: self.size_ = 0 try: self.creation_time_ = int( item.getElementsByTagName(ITEM_CREATION_TIME_NODE) [0].firstChild.data) except: self.creation_time_ = 0 return True
def from_xml_(self, xml_string): channel = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.id_ = str( channel.getElementsByTagName(CHANNEL_ID_NODE) [0].firstChild.data) self.dvblink_id_ = long( channel.getElementsByTagName(CHANNEL_DVBLINK_ID_NODE) [0].firstChild.data) self.name_ = channel.getElementsByTagName( CHANNEL_NAME_NODE)[0].firstChild.data except: return False try: self.number_ = int( channel.getElementsByTagName(CHANNEL_NUMBER_NODE) [0].firstChild.data) except: self.number_ = self.NUMBER_INVALID try: self.subnumber_ = int( channel.getElementsByTagName(CHANNEL_SUBNUMBER_NODE) [0].firstChild.data) except: self.subnumber_ = self.SUBNUMBER_INVALID try: self.channel_type_ = int( channel.getElementsByTagName(CHANNEL_TYPE_NODE) [0].firstChild.data) except: self.channel_type_ = ChannelType.CHANNEL_TV try: self.is_child_locked_ = string_to_bool( channel.getElementsByTagName(CHANNEL_CHILD_LOCK_NODE) [0].firstChild.data) except: self.is_child_locked_ = False return True
def from_xml__(self, xml_string): video_info = parseString(xml_string.encode(XMLDOC_CODEPAGE)) try: self.name_ = video_info.getElementsByTagName(EPG_PROGRAM_NAME)[0].firstChild.data except: self.name_ = "" try: self.duration_ = int(video_info.getElementsByTagName(EPG_PROGRAM_DURATION)[0].firstChild.data) except: self.duration_ = 0 try: self.start_time_ = long(video_info.getElementsByTagName(EPG_PROGRAM_START_TIME)[0].firstChild.data) except: self.start_time_ = 0 try: self.short_desc_ = video_info.getElementsByTagName(EPG_PROGRAM_SHORT_DESC)[0].firstChild.data except: self.short_desc_ = None try: self.subname_ = video_info.getElementsByTagName(EPG_PROGRAM_SUBNAME)[0].firstChild.data except: self.subname_ = None try: self.language_ = video_info.getElementsByTagName(EPG_PROGRAM_LANGUAGE)[0].firstChild.data except: self.language_ = None try: self.actors_ = video_info.getElementsByTagName(EPG_PROGRAM_ACTORS)[0].firstChild.data except: self.actors_ = None try: self.directors_ = video_info.getElementsByTagName(EPG_PROGRAM_DIRECTORS)[0].firstChild.data except: self.directors_ = None try: self.writers_ = video_info.getElementsByTagName(EPG_PROGRAM_WRITERS)[0].firstChild.data except: self.writers_ = None try: self.producers_ = video_info.getElementsByTagName(EPG_PROGRAM_PRODUCERS)[0].firstChild.data except: self.producers_ = None try: self.guests_ = video_info.getElementsByTagName(EPG_PROGRAM_GUESTS)[0].firstChild.data except: self.guests_ = None try: self.categories_ = video_info.getElementsByTagName(EPG_PROGRAM_CATEGORIES)[0].firstChild.data except: self.categories_ = None try: self.image_ = video_info.getElementsByTagName(EPG_PROGRAM_IMAGE)[0].firstChild.data except: self.image_ = None try: self.year_ = int(video_info.getElementsByTagName(EPG_PROGRAM_YEAR)[0].firstChild.data) except: self.year_ = 0 try: self.episode_num_ = int(video_info.getElementsByTagName(EPG_PROGRAM_EPISODE_NUM)[0].firstChild.data) except: self.episode_num_ = 0 try: self.season_num_ = int(video_info.getElementsByTagName(EPG_PROGRAM_SEASON_NUM)[0].firstChild.data) except: self.season_num_ = 0 try: self.stars_num_ = int(video_info.getElementsByTagName(EPG_PROGRAM_STARS_NUM)[0].firstChild.data) except: self.stars_num_ = 0 try: self.starsmax_num_ = int(video_info.getElementsByTagName(EPG_PROGRAM_STARSMAX_NUM)[0].firstChild.data) except: self.starsmax_num_ = 0 try: self.is_hdtv_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_HDTV)[0].firstChild.data) except: self.is_hdtv_ = False try: self.is_premiere_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_PREMIERE)[0].firstChild.data) except: self.is_premiere_ = False try: self.is_repeat_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_REPEAT)[0].firstChild.data) except: self.is_repeat_ = False try: self.is_action_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_ACTION)[0].firstChild.data) except: self.is_action_ = False try: self.is_comedy_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_COMEDY)[0].firstChild.data) except: self.is_comedy_ = False try: self.is_documentary_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_DOCUMENTARY)[0].firstChild.data) except: self.is_documentary_ = False try: self.is_drama_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_DRAMA)[0].firstChild.data) except: self.is_drama_ = False try: self.is_educational_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_EDUCATIONAL)[0].firstChild.data) except: self.is_educational_ = False try: self.is_horror_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_HORROR)[0].firstChild.data) except: self.is_horror_ = False try: self.is_kids_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_KIDS)[0].firstChild.data) except: self.is_kids_ = False try: self.is_movie_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_MOVIE)[0].firstChild.data) except: self.is_movie_ = False try: self.is_music_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_MUSIC)[0].firstChild.data) except: self.is_music_ = False try: self.is_news_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_NEWS)[0].firstChild.data) except: self.is_news_ = False try: self.is_reality_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_REALITY)[0].firstChild.data) except: self.is_reality_ = False try: self.is_romance_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_ROMANCE)[0].firstChild.data) except: self.is_romance_ = False try: self.is_scifi_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_SCIFI)[0].firstChild.data) except: self.is_scifi_ = False try: self.is_serial_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_SERIAL)[0].firstChild.data) except: self.is_serial_ = False try: self.is_soap_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_SOAP)[0].firstChild.data) except: self.is_soap_ = False try: self.is_special_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_SPECIAL)[0].firstChild.data) except: self.is_special_ = False try: self.is_sports_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_SPORTS)[0].firstChild.data) except: self.is_sports_ = False try: self.is_thriller_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_THRILLER)[0].firstChild.data) except: self.is_thriller_ = False try: self.is_adult_ = string_to_bool(video_info.getElementsByTagName(EPG_PROGRAM_CAT_ADULT)[0].firstChild.data) except: self.is_adult_ = False return True