fix(download): suffix only colliding quality variants

This commit is contained in:
zarzet
2026-07-29 02:43:35 +07:00
parent 1f55523b64
commit e7fbaf7b75
41 changed files with 629 additions and 110 deletions
+12
View File
@@ -83,6 +83,18 @@ func buildOutputPathForExtension(req DownloadRequest, ext *loadedExtension) stri
return filepath.Join(tempDir, buildDownloadFilename(req))
}
func shouldReuseExistingOutput(req DownloadRequest, outputPath string) bool {
if req.AllowQualityVariant || isFDOutput(req.OutputFD) {
return false
}
path := strings.TrimSpace(outputPath)
if path == "" || strings.HasPrefix(path, "content://") || strings.HasPrefix(path, "/proc/self/fd/") {
return false
}
info, err := os.Stat(path)
return err == nil && info.Mode().IsRegular() && info.Size() > 0
}
func canEmbedGenreLabel(filePath string) bool {
path := strings.TrimSpace(filePath)
if path == "" || strings.HasPrefix(path, "content://") || strings.HasPrefix(path, "/proc/self/fd/") {