added image and website urls
This commit is contained in:
		| @@ -15,8 +15,11 @@ class Landmark(BaseModel) : | |||||||
|     attractiveness : int |     attractiveness : int | ||||||
|     n_tags : int |     n_tags : int | ||||||
|     image_url : Optional[str] = None                            # TODO future |     image_url : Optional[str] = None                            # TODO future | ||||||
|  |     website_url : Optional[str] = None | ||||||
|  |     wikipedia_url : Optional[str] = None | ||||||
|     description : Optional[str] = None                          # TODO future |     description : Optional[str] = None                          # TODO future | ||||||
|     duration : Optional[int] = 0                                # TODO future |     duration : Optional[int] = 0                                # TODO future | ||||||
|  |     name_en : Optional[str] = None | ||||||
|  |  | ||||||
|     # Unique ID of a given landmark |     # Unique ID of a given landmark | ||||||
|     uuid: str = Field(default_factory=uuid4)                    # TODO implement this ASAP |     uuid: str = Field(default_factory=uuid4)                    # TODO implement this ASAP | ||||||
|   | |||||||
| @@ -290,7 +290,10 @@ class LandmarkManager: | |||||||
|                 elem_type = landmarktype            # Add the landmark type as 'sightseeing,  |                 elem_type = landmarktype            # Add the landmark type as 'sightseeing,  | ||||||
|                 n_tags = len(elem.tags().keys())    # Add number of tags |                 n_tags = len(elem.tags().keys())    # Add number of tags | ||||||
|                 score = n_tags**self.tag_exponent   # Add score |                 score = n_tags**self.tag_exponent   # Add score | ||||||
|  |                 website_url = None | ||||||
|  |                 wikpedia_url = None | ||||||
|  |                 image_url = None | ||||||
|  |                 name_en = None | ||||||
|  |  | ||||||
|                 # remove specific tags |                 # remove specific tags | ||||||
|                 skip = False |                 skip = False | ||||||
| @@ -331,6 +334,18 @@ class LandmarkManager: | |||||||
|                         if tag == "building" and elem.tag('building') in ['retail', 'supermarket', 'parking']: |                         if tag == "building" and elem.tag('building') in ['retail', 'supermarket', 'parking']: | ||||||
|                             skip = True |                             skip = True | ||||||
|                             break |                             break | ||||||
|  |  | ||||||
|  |                      | ||||||
|  |                     # Get additional information | ||||||
|  |                     # if tag == 'wikipedia' : | ||||||
|  |                     #     wikpedia_url = elem.tag('wikipedia') | ||||||
|  |                     if tag in ['website', 'contact:website'] : | ||||||
|  |                         website_url = elem.tag(tag) | ||||||
|  |                     if tag == 'image' : | ||||||
|  |                         image_url = elem.tag('image') | ||||||
|  |                     if tag =='name:en' : | ||||||
|  |                         name_en = elem.tag('name:en') | ||||||
|  |  | ||||||
|                 if skip: |                 if skip: | ||||||
|                     continue |                     continue | ||||||
|  |  | ||||||
| @@ -356,7 +371,11 @@ class LandmarkManager: | |||||||
|                     attractiveness=score, |                     attractiveness=score, | ||||||
|                     must_do=False, |                     must_do=False, | ||||||
|                     n_tags=int(n_tags), |                     n_tags=int(n_tags), | ||||||
|                     duration = duration |                     duration = duration,  | ||||||
|  |                     name_en=name_en, | ||||||
|  |                     image_url=image_url, | ||||||
|  |                     # wikipedia_url=wikpedia_url, | ||||||
|  |                     website_url=website_url | ||||||
|                 ) |                 ) | ||||||
|                 return_list.append(landmark) |                 return_list.append(landmark) | ||||||
|          |          | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user