more fucking fixes
This commit is contained in:
parent
35db6597e3
commit
28e32c33de
@ -1427,9 +1427,50 @@ func (g *Gateway) getMetadata(fileHash string) (*FileMetadata, error) {
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
func (g *Gateway) WebSeedHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// Validate HTTP method
|
||||
|
Loading…
x
Reference in New Issue
Block a user