Пример #1
0
	def _actView(self):
		self.MainWindow.lon = float(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('lon'))
		self.MainWindow.lat = float(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('lat'))
		googleearth_coordinates = Googleearth_Coordinates()
		coord=googleearth_coordinates.getTileRef(self.MainWindow.lon, self.MainWindow.lat, self.MainWindow.zoom)
		coord_dist = googleearth_coordinates.getLatLong(coord)
		self.MainWindow.lon = self.MainWindow.lon - coord_dist[2]
		self.MainWindow.drawSAT()
		#Panoramio
		if self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('type')  == "Panoramio":
			self.MainWindow.connect()
			current = get_file(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_file_url'), "Panoramio\\medium\\m" + self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id') + ".jpg", referer_url)
			current.start()
			current.join(1000)
			self.pic = TEMPFOLDER + "\\Panoramio\\medium\\m" + self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id') + ".jpg" 
			self.width=int(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('width'))
			self.height=int(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('height'))
		#Flickr
		elif self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('type')  == "flickr":
			self.MainWindow.xbmcearth_communication.connect("farm"+str(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('farm'))+".static.flickr.com")
			current = get_file("http://farm"+str(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('farm'))+".static.flickr.com/"+str(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('server'))+"/"+str(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id'))+"_"+str(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('secret'))+".jpg", "Flickr\\medium\\"+str(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id'))+".jpg", referer_url)
			current.start()
			current.join(1000)
			im = Image.open(TEMPFOLDER + "\\Flickr\\medium\\"+self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id')+".jpg")
			size = im.size			
			self.pic = TEMPFOLDER + "\\Flickr\\medium\\"+self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id')+".jpg"
			self.width=size[0]
			self.height=size[1]
		#locr
		if self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('type')  == "locr":
			self.MainWindow.connect()
			current = get_file(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_file_url'), "Locr\\medium\\" + self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id') + ".jpg", referer_url)
			current.start()
			current.join(1000)
			self.pic = TEMPFOLDER + "\\Locr\\medium\\" + self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('photo_id') + ".jpg" 
			self.width=int(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('width'))
			self.height=int(self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('height'))
		#webcams
		if self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('type')  == "webcams":
			self.MainWindow.connect()
			current = get_file("http://images.webcams.travel/webcam/"+self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('id')+".jpg", "Webcams\\medium\\" +  self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('id') + ".jpg", referer_url,'','','','',0)
			current.start()
			current.join(1000)
			im = Image.open(TEMPFOLDER + "\\Webcams\\medium\\"+self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('id')+".jpg")
			size = im.size			
			self.pic = TEMPFOLDER + "\\Webcams\\medium\\"+self.MainWindow.getListItem(self.MainWindow.getCurrentListPosition()).getProperty('id')+".jpg"
			self.width=size[0]
			self.height=size[1]
		
		
	#list_item.setInfo( 'video', { "Title": photos["photo_title"], "Genre": "Upload Date: " + photos["upload_date"] + " - Owner: " + photos["owner_name"]})
		self._show_Pic()
Пример #2
0
	def run(self):
		googleearth_coordinates = Googleearth_Coordinates()
		Lon = self.window.lon
		Lat = self.window.lat
		Zoom = self.window.zoom
		coord=googleearth_coordinates.getTileRef(Lon, Lat, Zoom)
		coord_dist = googleearth_coordinates.getLatLong(coord)
		self.xbmcearth_communication.connect("wms.jpl.nasa.gov")
		map_center_x = int(self.window.map_size_x / 2)
		map_center_y = int(self.window.map_size_y / 2)
		current = get_file("http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&layers=daily_planet&srs=EPSG:4326&format=image/jpeg&styles=&width="+str(768)+"&height="+str(768)+"&bbox="+str(coord_dist[0]-coord_dist[2])+","+str(coord_dist[1]-coord_dist[3])+","+str(coord_dist[0]+coord_dist[2]*2)+","+str(coord_dist[1]+coord_dist[3]*2),"Nasa\\z"+str(Zoom)+"\\"+coord+".jpg", referer_url,self.image)
		thread_starter=0
		while thread_starter<10:
			try:
				current.start()
				thread_starter=100
			except:
				time.sleep(1)
				thread_starter +=1
Пример #3
0
	def run(self):
		googleearth_coordinates = Googleearth_Coordinates()
		Lon = str(int(self.window.lon*1000000))
		Lat = str(int(self.window.lat*1000000))
		self.xbmcearth_communication.connect("www.google.com")
		result = self.xbmcearth_communication.get_Weather(referer_url,"?weather=,,,"+Lat+","+Lon)
		try:
			if result != '':
				resultcontainer = dict()
				xmldoc = minidom.parseString(result)
				nodelist = xmldoc.getElementsByTagName("current_conditions")
				resultcontainer["current_conditions"] = dict()
				self.window.getControl(951).setLabel("aktuell")
				for node in nodelist:
					sub_nodes = node.getElementsByTagName("condition")
					for sub_node in sub_nodes:
						resultcontainer["current_conditions"]["condition"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						self.window.getControl(953).setLabel(str(resultcontainer["current_conditions"]["condition"]))
					sub_nodes = node.getElementsByTagName("temp_f")
					for sub_node in sub_nodes:
						resultcontainer["current_conditions"]["temp_f"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
					sub_nodes = node.getElementsByTagName("temp_c")
					for sub_node in sub_nodes:
						resultcontainer["current_conditions"]["temp_c"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						self.window.getControl(952).setLabel(str(resultcontainer["current_conditions"]["temp_c"]) + "°C / " + str(resultcontainer["current_conditions"]["temp_f"]) + "°F")
					sub_nodes = node.getElementsByTagName("humidity")
					for sub_node in sub_nodes:	
						resultcontainer["current_conditions"]["humidity"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						self.window.getControl(954).setLabel(str(resultcontainer["current_conditions"]["humidity"]))
					sub_nodes = node.getElementsByTagName("icon")
					for sub_node in sub_nodes:	
						resultcontainer["current_conditions"]["icon"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						filename = resultcontainer["current_conditions"]["icon"][resultcontainer["current_conditions"]["icon"].rfind('/')+1:len(resultcontainer["current_conditions"]["icon"])].replace(' ','')
					current = get_file("http://www.google.com"+resultcontainer["current_conditions"]["icon"],"weather\\icons\\"+str(filename), referer_url,self.window.getControl(950))
					thread_starter=0
					while thread_starter<10:
						try:
							current.start()
							thread_starter=100
						except:
							time.sleep(1)
							thread_starter +=1
					sub_nodes = node.getElementsByTagName("wind_condition")
					for sub_node in sub_nodes:	
						resultcontainer["current_conditions"]["wind_condition"] = sub_node.getAttribute("data")
						self.window.getControl(955).setLabel(str(resultcontainer["current_conditions"]["wind_condition"]))
				nodelist = xmldoc.getElementsByTagName("forecast_conditions")
				resultcontainer["forecast_conditions"] = []
				index = 0
				for node in nodelist:
					resultcontainer["forecast_conditions"].append(dict())
					sub_nodes = node.getElementsByTagName("day_of_week")
					for sub_node in sub_nodes:
						resultcontainer["forecast_conditions"][index]["day_of_week"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						self.window.getControl(961+(index*10)).setLabel(str(resultcontainer["forecast_conditions"][index]["day_of_week"]))
					sub_nodes = node.getElementsByTagName("low")
					for sub_node in sub_nodes:
						resultcontainer["forecast_conditions"][index]["low"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						if xbmc.getLanguage() == 'German':
							self.window.getControl(965+(index*10)).setLabel("min: " +str(resultcontainer["forecast_conditions"][index]["low"]) + "°C")
						else:
							self.window.getControl(965+(index*10)).setLabel("min: " +str(resultcontainer["forecast_conditions"][index]["low"]) + "°F")
					sub_nodes = node.getElementsByTagName("high")
					for sub_node in sub_nodes:	
						resultcontainer["forecast_conditions"][index]["high"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						if xbmc.getLanguage() == 'German':
							self.window.getControl(964+(index*10)).setLabel("max: "+str(resultcontainer["forecast_conditions"][index]["high"]) + "°C")
						else:
							self.window.getControl(964+(index*10)).setLabel("max: "+str(resultcontainer["forecast_conditions"][index]["high"]) + "°F")
					sub_nodes = node.getElementsByTagName("icon")
					for sub_node in sub_nodes:	
						resultcontainer["forecast_conditions"][index]["icon"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						filename = resultcontainer["forecast_conditions"][index]["icon"][resultcontainer["forecast_conditions"][index]["icon"].rfind('/')+1:len(resultcontainer["forecast_conditions"][index]["icon"])].replace(' ','')
					current = get_file("http://www.google.com"+resultcontainer["forecast_conditions"][index]["icon"],"weather\\icons\\"+str(filename), referer_url,self.window.getControl(960+(index*10)))
					thread_starter=0
					while thread_starter<10:
						try:
							current.start()
							thread_starter=100
						except:
							time.sleep(1)
							thread_starter +=1
					sub_nodes = node.getElementsByTagName("condition")
					for sub_node in sub_nodes:	
						resultcontainer["forecast_conditions"][index]["condition"] = sub_node.getAttribute("data").encode('latin-1', 'ignore')
						self.window.getControl(963+(index*10)).setLabel(str(resultcontainer["forecast_conditions"][index]["condition"]))
					index += 1
		except:
			traceback.print_exc()