Exemple #1
0
def create_product_with_event_type(
    event_name: str = "Test event",
    event_type: EventType = EventType.SPECTACLE_VIVANT,
    description: str = None,
    duration_minutes: Optional[int] = 60,
    id_at_providers: str = None,
    is_national: bool = False,
    is_duo: bool = False,
    thumb_count: int = 0,
) -> Product:
    product = Product()
    product.name = event_name
    product.description = description
    product.durationMinutes = duration_minutes
    product.thumbCount = thumb_count
    product.idAtProviders = id_at_providers
    product.isNational = is_national
    product.isDuo = is_duo
    product.type = str(event_type)
    product.description = description

    return product
Exemple #2
0
    def fill_product_attributes(self, allocine_product: Product):
        allocine_product.name = self.movie_information["title"]
        allocine_product.type = str(EventType.CINEMA)
        allocine_product.thumbCount = 0
        if "description" in self.movie_information:
            allocine_product.description = self.movie_information[
                "description"]
        if "duration" in self.movie_information:
            allocine_product.durationMinutes = self.movie_information[
                "duration"]
        if not allocine_product.extraData:
            allocine_product.extraData = {}
        if "visa" in self.movie_information:
            allocine_product.extraData["visa"] = self.movie_information["visa"]
        if "stageDirector" in self.movie_information:
            allocine_product.extraData[
                "stageDirector"] = self.movie_information["stageDirector"]

        is_new_product_to_insert = allocine_product.id is None

        if is_new_product_to_insert:
            allocine_product.id = get_next_product_id_from_database()
        self.last_product_id = allocine_product.id