func (repo *RepositoryConfig) Locate(handle string) *Image {
	for _, kind := range AllKinds {
		for _, camera := range System.Cameras() {
			dir := repo.dirFor(camera.ID, kind)
			f, err := os.Open(dir)
			if err != nil {
				panic(err)
			}
			defer f.Close()
			entries, err := f.Readdir(0)
			if err != nil {
				panic(err)
			}
			for _, entry := range entries {
				name := entry.Name()
				if kind == MediaGenerated && strings.Split(name, ".")[1] != "jpg" {
					continue
				}
				if strings.HasPrefix(name, handle) {
					_, err := os.Stat(filepath.Join(dir, fmt.Sprintf("%s.webm", handle)))
					hasVideo := (kind == MediaGenerated || err == nil)
					return &Image{
						Handle:    handle,
						Source:    camera.ID,
						Timestamp: entry.ModTime(),
						HasVideo:  hasVideo,
					}
				}
			}
		}
	}

	return nil
}
// Locate retrieves the bytes for the indicated image.
Locate retrieves the bytes for the indicated image.
// Locate retrieves the bytes for the indicated image .
func (repo *RepositoryConfig) Locate(handle string) *Image {
	for _, kind := range AllKinds {
		for _, camera := range System.Cameras() {
			dir := repo.dirFor(camera.ID, kind)
			f, err := os.Open(dir)
			if err != nil {
				panic(err)
			}
			defer f.Close()
			entries, err := f.Readdir(0)
			if err != nil {
				panic(err)
			}
			for _, entry := range entries {
				name := entry.Name()
				if kind == MediaGenerated && strings.Split(name, ".")[1] != "jpg" {
					continue
				}
				if strings.HasPrefix(name, handle) {
					_, err := os.Stat(filepath.Join(dir, fmt.Sprintf("%s.webm", handle)))
					hasVideo := (kind == MediaGenerated || err == nil)
					return &Image{
						Handle:    handle,
						Source:    camera.ID,
						Timestamp: entry.ModTime(),
						HasVideo:  hasVideo,
					}
				}
			}
		}
	}
	return nil
}
func ( repo * RepositoryConfig ) Locate ( handle string ) * Image { for _ , kind := range AllKinds { for _ , camera := range System . Cameras ( ) { dir := repo . dirFor ( camera . ID , kind ) f , err := os . Open ( dir ) if err != nil { panic ( err ) } defer f . Close ( ) entries , err := f . Readdir ( 0 ) if err != nil { panic ( err ) } for _ , entry := range entries { name := entry . Name ( ) if kind == MediaGenerated && strings . Split ( name , " " ) [ 1 ] != " " { continue } if strings . HasPrefix ( name , handle ) { _ , err := os . Stat ( filepath . Join ( dir , fmt . Sprintf ( " " , handle ) ) ) hasVideo := ( kind == MediaGenerated || err == nil ) return & Image { Handle : handle , Source : camera . ID , Timestamp : entry . ModTime ( ) , HasVideo : hasVideo , } } } } } return nil }
Locate retrieves the bytes for the indicated image.
Locate retrieves the bytes for the indicated image .