コード例 #1
0
    def parse_recipe(self, recipe: Recipe, json_data: JsonParser):
        recipe.name = json_data.string_or_none('Name')
        recipe.author = json_data.string_or_none('Autor')
        date_created = json_data.string_or_none('Datum')
        if date_created is not None:
            recipe.created = datetime.strptime(date_created, '%d.%m.%Y')

        # Characteristics
        recipe.style_raw = json_data.string_or_none('Sorte')
        recipe.extract_efficiency = json_data.float_or_none('Sudhausausbeute')
        recipe.abv = json_data.float_or_none('Alkohol')
        recipe.ebc = json_data.int_or_none('Farbe')
        recipe.ibu = json_data.int_or_none('Bittere')
        recipe.original_plato = json_data.float_or_none('Stammwuerze')
        recipe.final_plato = self.get_final_plato(json_data, recipe)

        # Mashing
        recipe.mash_water = json_data.float_or_none('Infusion_Hauptguss')
        recipe.sparge_water = json_data.float_or_none('Nachguss')

        # Boiling
        recipe.cast_out_wort = json_data.int_or_none('Ausschlagswuerze')
        recipe.boiling_time = json_data.int_or_none('Kochzeit_Wuerze')

        return recipe
コード例 #2
0
    def parse_recipe(self, recipe: Recipe, beerxml: BeerXMLRecipe) -> None:
        recipe.name = str(beerxml.name)
        recipe.author = str(beerxml.brewer)

        # Characteristics
        recipe.style_raw = str(beerxml.style.name)
        recipe.extract_efficiency = beerxml.efficiency
        recipe.og = beerxml.og
        recipe.fg = beerxml.fg
        recipe.abv = self.get_abv(beerxml)
        recipe.ibu = beerxml.ibu
        (recipe.srm, recipe.ebc) = self.get_srm_ebc(beerxml)

        # Mashing
        (recipe.mash_water, recipe.sparge_water) = self.get_mash_water(beerxml)

        # Boiling
        recipe.cast_out_wort = beerxml.batch_size
        recipe.boiling_time = beerxml.boil_time