more fucking fixes
Some checks are pending
CI Pipeline / Run Tests (push) Waiting to run
CI Pipeline / Lint Code (push) Waiting to run
CI Pipeline / Security Scan (push) Waiting to run
CI Pipeline / E2E Tests (push) Blocked by required conditions

This commit is contained in:
Enki 2025-08-27 19:45:49 -07:00
parent 35db6597e3
commit 28e32c33de

View File

@ -1427,9 +1427,50 @@ func (g *Gateway) getMetadata(fileHash string) (*FileMetadata, error) {
Chunks: chunks, Chunks: chunks,
} }
// Check if file has completed transcoding and add streaming info
if g.transcodingManager != nil {
status := g.transcodingManager.GetTranscodingStatus(fileHash)
if status == "completed" {
// File has been successfully transcoded, mark it as video
metadata.StreamingInfo = &streaming.FileInfo{
Name: dbMetadata.OriginalName,
Size: dbMetadata.Size,
IsVideo: true,
MimeType: getVideoMimeType(dbMetadata.OriginalName),
Duration: 0, // TODO: Get actual duration from ffprobe
}
log.Printf("DEBUG: Added streaming info for transcoded file %s", fileHash)
}
}
return metadata, nil return metadata, nil
} }
// getVideoMimeType returns appropriate MIME type for video files
func getVideoMimeType(filename string) string {
ext := strings.ToLower(filepath.Ext(filename))
switch ext {
case ".mp4":
return "video/mp4"
case ".mkv":
return "video/x-matroska"
case ".avi":
return "video/x-msvideo"
case ".webm":
return "video/webm"
case ".mov":
return "video/quicktime"
case ".wmv":
return "video/x-ms-wmv"
case ".flv":
return "video/x-flv"
case ".m4v":
return "video/mp4"
default:
return "video/mp4" // Default fallback
}
}
// WebSeed handlers (BEP-19 support) - Enhanced for BitTorrent client compatibility // WebSeed handlers (BEP-19 support) - Enhanced for BitTorrent client compatibility
func (g *Gateway) WebSeedHandler(w http.ResponseWriter, r *http.Request) { func (g *Gateway) WebSeedHandler(w http.ResponseWriter, r *http.Request) {
// Validate HTTP method // Validate HTTP method