Exemplo n.º 1
0
 def open_search_dialog(self):
     modeselect = [("googlemaps", ADDON_LANGUAGE(32024)),
                   ("foursquareplaces", ADDON_LANGUAGE(32004)),
                   ("lastfmconcerts", ADDON_LANGUAGE(32023)),
                   ("lastfmvenues", ADDON_LANGUAGE(32033)),
                   ("reset", ADDON_LANGUAGE(32019))]
     KEYS = [item[0] for item in modeselect]
     VALUES = [item[1] for item in modeselect]
     dialog = xbmcgui.Dialog()
     index = dialog.select(ADDON_LANGUAGE(32026), VALUES)
     if index < 0:
         return None
     if KEYS[index] == "googlemaps":
         self.search_location()
         itemlist = []
     elif KEYS[index] == "foursquareplaces":
         query = xbmcgui.Dialog().input(ADDON_LANGUAGE(32022), type=xbmcgui.INPUT_ALPHANUM)
         FS = FourSquare()
         itemlist, self.pin_string = FS.GetPlacesList(self.lat, self.lon, query)
     elif KEYS[index] == "lastfmconcerts":
         artist = xbmcgui.Dialog().input(ADDON_LANGUAGE(32025), type=xbmcgui.INPUT_ALPHANUM)
         LFM = LastFM()
         results = LFM.get_artist_events(artist)
         itemlist, self.pin_string = LFM.create_venue_list(results)
     elif KEYS[index] == "lastfmvenues":
         venue = xbmcgui.Dialog().input(ADDON_LANGUAGE(32025), type=xbmcgui.INPUT_ALPHANUM)
         LFM = LastFM()
         venueid = LFM.get_venue_id(venue)
         results = LFM.get_venue_events(venueid)
         itemlist, self.pin_string = LFM.create_venue_list(results)
     elif KEYS[index] == "reset":
         self.pin_string = ""
         itemlist = []
     fill_list_control(self.venue_list, itemlist)
     self.street_view = False
Exemplo n.º 2
0
 def select_places_provider(self):
     set_window_prop(self.window, 'index', "")
     itemlist = None
     modeselect = [("concerts", ADDON_LANGUAGE(32016)),
                   ("festivals", ADDON_LANGUAGE(32017)),
                   ("geopics", ADDON_LANGUAGE(32027)),
                   ("eventful", ADDON_LANGUAGE(32028)),
                   ("foursquare", ADDON_LANGUAGE(32029)),
                   ("mapquest", ADDON_LANGUAGE(32030)),
                   ("googleplaces", ADDON_LANGUAGE(32031)),
                   ("reset", ADDON_LANGUAGE(32019))]
     listitems = [item[1] for item in modeselect]
     keys = [item[0] for item in modeselect]
     dialog = xbmcgui.Dialog()
     index = dialog.select(ADDON_LANGUAGE(32020), listitems)
     if not index < 0:
         if keys[index] == "googleplaces":
             GP = GooglePlaces()
             category = GP.select_category()
             if category is not None:
                 self.pin_string, itemlist = GP.GetGooglePlacesList(self.lat, self.lon, self.radius * 1000, category)
         elif keys[index] == "foursquare":
             FS = FourSquare()
             section = FS.SelectSection()
             if section is not None:
                 itemlist, self.pin_string = FS.GetPlacesListExplore(self.lat, self.lon, section)
         elif keys[index] == "concerts":
             LFM = LastFM()
             category = LFM.select_category()
             if category is not None:
                 results = LFM.get_near_events(self.lat, self.lon, self.radius, category)
                 itemlist, self.pin_string = LFM.create_venue_list(results)
         elif keys[index] == "mapquest":
             MQ = MapQuest()
             itemlist, self.pin_string = MQ.GetItemList(self.lat, self.lon, self.zoom_level)
         elif keys[index] == "festivals":
             LFM = LastFM()
             category = LFM.select_category()
             if category is not None:
                 results = LFM.get_near_events(self.lat, self.lon, self.radius, category, True)
                 itemlist, self.pin_string = LFM.create_venue_list(results)
         elif keys[index] == "geopics":
             folder_path = xbmcgui.Dialog().browse(0, ADDON_LANGUAGE(32021), 'pictures')
             set_window_prop(self.window, 'imagepath', folder_path)
             itemlist, self.pin_string = get_images(folder_path)
         elif keys[index] == "eventful":
             EF = Eventful()
             category = EF.select_category()
             if category is not None:
                 itemlist, self.pin_string = EF.GetEventfulEventList(self.lat, self.lon, "", category, self.radius)
         elif keys[index] == "reset":
             self.pin_string = ""
             itemlist = []
         if itemlist is not None:
             fill_list_control(self.venue_list, itemlist)
         self.street_view = False
Exemplo n.º 3
0
 def __init__(self, skin_file, ADDON_PATH, *args, **kwargs):
     self.itemlist = []
     self.location = kwargs.get("location", "")
     self.type = kwargs.get("type", "roadmap")
     self.strlat = kwargs.get("lat", "")
     self.strlon = kwargs.get("lon", "")
     self.zoom_level = kwargs.get("zoom_level", 10)
     self.aspect = kwargs.get("aspect", "640x400")
     self.init_vars()
     for arg in sys.argv:
         param = arg.lower()
         log("param = " + param)
         if param.startswith('folder='):
             folder = param[7:]
             self.itemlist, self.pin_string = self.get_images(folder)
         elif param.startswith('artist='):
             artist = param[7:]
             LFM = LastFM()
             results = LFM.get_artist_events(artist)
             self.itemlist, self.pin_string = LFM.create_venue_list(results)
         elif param.startswith('list='):
             listtype = param[5:]
             self.zoom_level = 14
             if listtype == "nearfestivals":
                 LFM = LastFM()
                 results = LFM.get_near_events(self.lat, self.lon, self.radius, "", True)
                 self.itemlist, self.pin_string = LFM.create_venue_list(results)
             elif listtype == "nearconcerts":
                 LFM = LastFM()
                 results = LFM.get_near_events(self.lat, self.lon, self.radius)
                 self.itemlist, self.pin_string = LFM.create_venue_list(results)
         elif param.startswith('direction='):
             self.direction = param[10:]
         elif param.startswith('prefix='):
             self.prefix = param[7:]
             if not self.prefix.endswith('.') and self.prefix != "":
                 self.prefix = self.prefix + '.'
         # get lat / lon values
     if self.location == "geocode":
         self.lat, self.lon = parse_geotags(self.strlat, self.strlon)
     elif (self.location == "") and (self.strlat == ""):  # both empty
         self.lat, self.lon = get_location_coords()
         self.zoom_level = 2
     elif (not self.location == "") and (self.strlat == ""):  # latlon empty
         self.lat, self.lon = self.get_geocodes(False, self.location)
     else:
         self.lat = float(self.strlat)
         self.lon = float(self.strlon)