Example #1
0
func (r *StaticRepresenter) Reprezent() error {
	log.Trace("in Reprezent", r.galleries)
	for _, gallery := range r.galleries {
		log.Debugf("writing gallery %q", gallery)
		if err := writeGallery(r.targetDir, gallery); err != nil {
			return err
		}
	}
	return nil
}
Example #2
0
File: creator.go Project: afajl/am
func parseGalleries(sourceDir string, pics []*Pic) ([]*Gallery, error) {
	paths, err := filepath.Glob(sourceDir + "/galleries/*.json")
	if err != nil {
		return nil, err
	}
	var galleries = make([]*Gallery, 0, len(paths))

	for _, path := range paths {
		log.Debugf("parsing gallery %v", path)
		gallery, err := NewGallery(path, pics)
		if err != nil {
			return nil, fmt.Errorf("%v: %s", path, err)
		}
		galleries = append(galleries, gallery)
	}
	return galleries, nil
}
Example #3
0
File: creator.go Project: afajl/am
func parsePics(sourceDir string) ([]*Pic, error) {
	paths, err := filepath.Glob(sourceDir + "/pics/*.png")
	if err != nil {
		return nil, err
	}

	var pics = make([]*Pic, 0, len(paths))
	for _, path := range paths {
		log.Debugf("parsing pic %v", path)
		pic, err := NewPic(path)
		if err != nil {
			return nil, err
		}
		pics = append(pics, pic)
	}
	return pics, nil
}
Example #4
0
File: creator.go Project: afajl/am
func parseStories(sourceDir string, pics []*Pic) ([]*Story, error) {
	paths, err := filepath.Glob(sourceDir + "/stories/*.json")
	if err != nil {
		return nil, err
	}
	var stories = make([]*Story, 0, len(paths))

	for _, path := range paths {
		log.Debugf("parsing story %v", path)
		story, err := NewStory(path, pics)
		if err != nil {
			return nil, fmt.Errorf("%v: %s", path, err)
		}
		stories = append(stories, story)
	}
	return stories, nil
}