def create_program_item_(self, program, channel):
     recording = common.search_recording(self.recording_list_,
                                         program.program_id,
                                         channel.channel_id)
     is_record = recording.program.is_record if recording else False
     is_series_record = recording.program.is_repeat_record if recording else False
     is_conflicting = recording.is_conflicting if recording else False
     title = helper.create_program_title(program, is_record,
                                         is_series_record, is_conflicting)
     return TVShowObject(
         key=Callback(self.create_program_search_actions,
                      title=program.name,
                      program_id=program.program_id,
                      channel_id=channel.channel_id,
                      channel_name=channel.channel_name,
                      is_series=program.is_series),
         rating_key=program.program_id,
         title=title,
         summary=helper.create_program_summary(program),
         source_title=channel.channel_name,
         rating=float(
             helper.calculate_rating(program.stars_number,
                                     program.stars_max_number)),
         originally_available_at=Datetime.FromTimestamp(
             program.start_time).date(),
         duration=program.duration * 1000,
         genres=program.keywords.split('/') if program.keywords else [],
         thumb=Resource.ContentsOfURLWithFallback(program.image))
	def create_program_item_(self, program):
		recording = common.search_recording(self.recording_list_, program.program_id, self.channel_id_)
		is_record = recording.program.is_record if recording else False
		is_series_record = recording.program.is_repeat_record if recording else False
		is_conflicting = recording.is_conflicting if recording else False
		title = helper.create_program_title(program, is_record, is_series_record, is_conflicting)
		return TVShowObject(
			key = Callback(
				self.create_program_actions, 
				title = program.name,
				program_id = program.program_id,
				is_series = program.is_series),
			rating_key = program.program_id,
			title = title,
			summary = helper.create_program_summary(program),
			source_title = self.channel_name_,
			rating = float(helper.calculate_rating(program.stars_number, program.stars_max_number)),
			originally_available_at = Datetime.FromTimestamp(program.start_time).date(),
			duration = program.duration * 1000,
			genres = program.keywords.split('/') if program.keywords else [],
			thumb = Resource.ContentsOfURLWithFallback(program.image))
    def create_actions_menu(self, title, program_id, channel_id, channel_name,
                            is_series, art, replace_parent):
        recording = common.search_recording(self.recording_list_, program_id,
                                            channel_id)
        is_record = recording.program.is_record if recording else False
        is_series_record = recording.program.is_repeat_record if recording else False

        oc = ObjectContainer(no_history=True,
                             no_cache=True,
                             replace_parent=replace_parent,
                             title1=channel_name,
                             title2=title,
                             art=art)

        if self.recording_only_ and not recording:
            return oc

        if is_record:
            oc.add(
                DirectoryObject(key=Callback(
                    self.cancel_recording,
                    title=title,
                    program_id=program_id,
                    channel_id=channel_id,
                    channel_name=channel_name,
                    is_series=is_series,
                    recording_id=recording.recording_id),
                                title=IDS_CANCEL_RECORDING,
                                thumb=R(helper.ICON_CANCEL_RECORDING)))
        else:
            oc.add(
                DirectoryObject(key=Callback(self.add_recording,
                                             title=title,
                                             program_id=program_id,
                                             channel_id=channel_id,
                                             channel_name=channel_name,
                                             is_series=is_series),
                                title=IDS_ADD_RECORDING,
                                thumb=R(helper.ICON_ADD_RECORDING)))

        if is_series or is_series_record:
            if is_series_record:
                oc.add(
                    DirectoryObject(key=Callback(
                        self.cancel_series,
                        title=title,
                        program_id=program_id,
                        channel_id=channel_id,
                        channel_name=channel_name,
                        is_series=is_series,
                        schedule_id=recording.schedule_id),
                                    title=IDS_CANCEL_RECORD_SERIES,
                                    thumb=R(helper.ICON_CANCEL_SERIES)))
            else:
                oc.add(
                    DirectoryObject(key=Callback(self.add_series,
                                                 title=title,
                                                 program_id=program_id,
                                                 channel_id=channel_id,
                                                 channel_name=channel_name,
                                                 is_series=is_series),
                                    title=IDS_RECORD_SERIES,
                                    thumb=R(helper.ICON_ADD_SERIES)))

        return oc
	def create_actions_menu(self, title, program_id, channel_id, channel_name, is_series, art, replace_parent):
		recording = common.search_recording(self.recording_list_, program_id, channel_id)
		is_record = recording.program.is_record if recording else False
		is_series_record = recording.program.is_repeat_record if recording else False
		
		oc = ObjectContainer(
			no_history = True,
			no_cache = True,
			replace_parent = replace_parent,
			title1 = channel_name,
			title2 = title,
			art = art)
		
		if self.recording_only_ and not recording:
			return oc
		
		if is_record:
			oc.add(DirectoryObject(
				key = Callback(
					self.cancel_recording,
					title = title,
					program_id = program_id,
					channel_id = channel_id,
					channel_name = channel_name,
					is_series = is_series,
					recording_id = recording.recording_id),
				title = IDS_CANCEL_RECORDING,
				thumb = R(helper.ICON_CANCEL_RECORDING)))
		else:
			oc.add(DirectoryObject(
				key = Callback(
					self.add_recording,
					title = title,
					program_id = program_id,
					channel_id = channel_id,
					channel_name = channel_name,
					is_series = is_series),
				title = IDS_ADD_RECORDING,
				thumb = R(helper.ICON_ADD_RECORDING)))
				
		if is_series or is_series_record:
			if is_series_record:
				oc.add(DirectoryObject(
					key = Callback(
						self.cancel_series,
						title = title,
						program_id = program_id,
						channel_id = channel_id,
						channel_name = channel_name,
						is_series = is_series,
						schedule_id = recording.schedule_id),
					title = IDS_CANCEL_RECORD_SERIES,
					thumb = R(helper.ICON_CANCEL_SERIES)))
			else:
				oc.add(DirectoryObject(
					key = Callback(
						self.add_series, 
						title = title,
						program_id = program_id,
						channel_id = channel_id,
						channel_name = channel_name,
						is_series = is_series),
					title = IDS_RECORD_SERIES,
					thumb = R(helper.ICON_ADD_SERIES)))			
		
		return oc