Пример #1
0
 def create_recording_item_(self, recording):
     program = recording.program
     channel = common.search_channel(self.channel_list_,
                                     recording.channel_id)
     title = helper.create_recording_title(program, program.is_record,
                                           program.is_repeat_record,
                                           recording.is_conflicting)
     return TVShowObject(
         key=Callback(
             self.create_recording_actions,
             title=program.name,
             program_id=program.program_id,
             channel_id=recording.channel_id,
             channel_name=channel.channel_name if channel else IDS_UNKNOWN,
             is_series=program.is_series),
         rating_key=program.program_id,
         title=title,
         summary=helper.create_program_summary(program),
         source_title=channel.channel_name if channel else IDS_UNKNOWN,
         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_list_(self, programs_dict, title_1, title_2):
     oc = ObjectContainer(no_history=True,
                          no_cache=True,
                          title1=title_1,
                          title2=title_2,
                          art=R(helper.ART_SEARCH))
     time_now = common.datetime_to_ctime(datetime.datetime.now())
     channels = data_provider.get_channels()
     #stream_info_dict = data_provider.get_stream_info()
     self.recording_list_ = data_provider.get_recordings(False)
     if len(programs_dict) and len(channels):
         program_list = self.get_programs_(programs_dict)
         for list_item in program_list:
             channel = common.search_channel(channels, list_item[0])
             if channel:
                 program = list_item[1]
                 if time_now < program.start_time + program.duration:
                     program_object = self.create_program_item_(
                         program, channel)
                     oc.add(program_object)
     return oc
Пример #3
0
	def create_program_list_(self, programs_dict, title_1, title_2):
		oc = ObjectContainer(
			no_history = True,
			no_cache = True,
			title1 = title_1,
			title2 = title_2,
			art = R(helper.ART_SEARCH))
		time_now = common.datetime_to_ctime(datetime.datetime.now())
		channels = data_provider.get_channels()
		#stream_info_dict = data_provider.get_stream_info()
		self.recording_list_ = data_provider.get_recordings(False)
		if len(programs_dict) and len(channels):
			program_list = self.get_programs_(programs_dict)
			for list_item in program_list:
				channel = common.search_channel(channels, list_item[0])
				if channel:
					program = list_item[1]
					if time_now < program.start_time + program.duration:
						program_object = self.create_program_item_(program, channel)
						oc.add(program_object)
		return oc
Пример #4
0
	def create_recording_item_(self, recording):
		program = recording.program
		channel = common.search_channel(self.channel_list_, recording.channel_id)
		title = helper.create_recording_title(program, program.is_record, program.is_repeat_record, recording.is_conflicting)
		return TVShowObject(
			key = Callback(
				self.create_recording_actions, 
				title = program.name,
				program_id = program.program_id,
				channel_id = recording.channel_id,
				channel_name = channel.channel_name if channel else IDS_UNKNOWN,
				is_series = program.is_series),
			rating_key = program.program_id,
			title = title,
			summary = helper.create_program_summary(program),
			source_title = channel.channel_name if channel else IDS_UNKNOWN,
			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))