(&self)
| 338 | if ct.contains("mp3") || ct.contains("mpeg") { |
| 339 | "MP3" |
| 340 | } else if ct.contains("wav") { |
| 341 | "WAV" |
| 342 | } else if ct.contains("ogg") { |
| 343 | "OGG" |
| 344 | } else if ct.contains("flac") { |
| 345 | "FLAC" |
| 346 | } else if ct.contains("aac") { |
| 347 | "AAC" |
| 348 | } else if ct.contains("webm") { |
| 349 | "WebM" |
| 350 | } else { |
| 351 | "Audio" |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | fn format_size(bytes: usize) -> String { |
| 356 | if bytes < 1024 { |
| 357 | format!("{} B", bytes) |
| 358 | } else if bytes < 1024 * 1024 { |
| 359 | format!("{:.1} KB", bytes as f64 / 1024.0) |
| 360 | } else { |