// Get main API to decode the file information
Get main API to decode the file information
// Get main API to decode the file information
func (info *FileInfo) Get() {
	log.Info().Msgf("Getting %s", info.URL)
	resp, err := http.Post(info.URL, "application/x-www-form-urlencoded; charset=ISO-8859-1", bytes.NewReader([]byte("")))
	if err != nil {
		log.Error().Msgf("%v, failed to post", err)
	}
	content, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Error().Msgf("%v, failed to load response body", err)
	}
	data := strings.Split(string(content), "|")
	info.Total = data
	if len(data) < 11 {
		log.Warn().Msgf("%v", data)
		log.Error().Msgf("%v less than 11 elements", data)
	}
	info.Collection = data[0]
	info.PatientID = data[1]
	info.StudyUID = data[2]
	info.SeriesUID = data[3]
	if size, err := strconv.ParseInt(data[6], 10, 64); err != nil {
		log.Error().Msgf("%v, failed to convert size to int64", err)
	} else {
		info.Size = int64(size)
	}
	info.Date = data[11]
	log.Printf("%v", info)
}
func ( info * FileInfo ) Get ( ) { log . Info ( ) . Msgf ( " " , info . URL ) resp , err := http . Post ( info . URL , " " , bytes . NewReader ( [ ] byte ( " " ) ) ) if err != nil { log . Error ( ) . Msgf ( " " , err ) } content , err := ioutil . ReadAll ( resp . Body ) if err != nil { log . Error ( ) . Msgf ( " " , err ) } data := strings . Split ( string ( content ) , " " ) info . Total = data if len ( data ) < 11 { log . Warn ( ) . Msgf ( " " , data ) log . Error ( ) . Msgf ( " " , data ) } info . Collection = data [ 0 ] info . PatientID = data [ 1 ] info . StudyUID = data [ 2 ] info . SeriesUID = data [ 3 ] if size , err := strconv . ParseInt ( data [ 6 ] , 10 , 64 ) ; err != nil { log . Error ( ) . Msgf ( " " , err ) } else { info . Size = int64 ( size ) } info . Date = data [ 11 ] log . Printf ( " " , info ) }
Get main API to decode the file information
Get main API to decode the file information