| 
									
										
										
										
											2023-09-06 18:46:09 -05:00
										 |  |  | package utils | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"fmt" | 
					
						
							|  |  |  | 	p "path" | 
					
						
							| 
									
										
										
										
											2023-09-07 11:00:16 -05:00
										 |  |  | 	"strings" | 
					
						
							|  |  |  | 	t "time" | 
					
						
							| 
									
										
										
										
											2023-09-06 18:46:09 -05:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func GetShortPath(path string) string { | 
					
						
							|  |  |  | 	base := p.Base(path) | 
					
						
							|  |  |  | 	dir := p.Dir(path) | 
					
						
							|  |  |  | 	dir = p.Base(dir) | 
					
						
							|  |  |  | 	return fmt.Sprintf("%s/%s", dir, base) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2023-09-07 11:00:16 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | func HourMinSecToSeconds(time string) float64 { | 
					
						
							|  |  |  | 	parts := strings.Split(time, ":") | 
					
						
							|  |  |  | 	units := []string{"h", "m", "s"} | 
					
						
							|  |  |  | 	units = units[len(units)-len(parts):] | 
					
						
							|  |  |  | 	f := "" | 
					
						
							|  |  |  | 	for idx, part := range parts { | 
					
						
							|  |  |  | 		f = f + part + units[idx] | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	dur, _ := t.ParseDuration(f) | 
					
						
							|  |  |  | 	return dur.Seconds() | 
					
						
							|  |  |  | } |