diff --git a/renders/renders.go b/renders/renders.go index 6622d47..17b35d6 100644 --- a/renders/renders.go +++ b/renders/renders.go @@ -870,12 +870,13 @@ func probe(ctx context.Context, file string) (*ffprobeOut, error) { } type mediaItemView struct { - Title string - Duration int64 - Width, Height int - ThumbURL string - FilePath string - MediaPartID int64 + Title string + Duration int64 // en secondes + DurationFmt string // ex: "3:45" + Width, Height int + ThumbURL string + FilePath string + MediaPartID int64 } // PathMedia renvoie la liste des sous-dossiers et médias du dossier `PathDownload` @@ -942,6 +943,8 @@ func PathMedia(db *gorm.DB) http.HandlerFunc { if err == nil { if d, err := strconv.ParseFloat(info.Format.Duration, 64); err == nil { view.Duration = int64(d) + view.DurationFmt = fmt.Sprintf("%d:%02d", view.Duration/60, view.Duration%60) + } for _, s := range info.Streams { if s.CodecType == "video" { diff --git a/templates/media_list.pages.tmpl b/templates/media_list.pages.tmpl index ca99e9e..3f8d4d6 100644 --- a/templates/media_list.pages.tmpl +++ b/templates/media_list.pages.tmpl @@ -1,49 +1,19 @@ -