Fix json time when unmarshalling

https://github.com/stashapp/stash/issues/25
This commit is contained in:
Stash Dev
2019-03-09 10:14:55 -08:00
parent f57c2bff1d
commit c4d45db30c
8 changed files with 70 additions and 70 deletions

View File

@@ -90,7 +90,7 @@ func parse(filePath string, probeJSON *FFProbeJSON) (*VideoFile, error) {
fileStat, _ := os.Stat(filePath)
result.Size = fileStat.Size()
result.StartTime, _ = strconv.ParseFloat(probeJSON.Format.StartTime, 64)
result.CreationTime = probeJSON.Format.Tags.CreationTime
result.CreationTime = probeJSON.Format.Tags.CreationTime.Time
audioStream := result.GetAudioStream()
if audioStream != nil {

View File

@@ -1,7 +1,7 @@
package ffmpeg
import (
"time"
"github.com/stashapp/stash/pkg/models"
)
type FFProbeJSON struct {
@@ -17,11 +17,11 @@ type FFProbeJSON struct {
Size string `json:"size"`
StartTime string `json:"start_time"`
Tags struct {
CompatibleBrands string `json:"compatible_brands"`
CreationTime time.Time `json:"creation_time"`
Encoder string `json:"encoder"`
MajorBrand string `json:"major_brand"`
MinorVersion string `json:"minor_version"`
CompatibleBrands string `json:"compatible_brands"`
CreationTime models.JSONTime `json:"creation_time"`
Encoder string `json:"encoder"`
MajorBrand string `json:"major_brand"`
MinorVersion string `json:"minor_version"`
} `json:"tags"`
} `json:"format"`
Streams []FFProbeStream `json:"streams"`
@@ -76,10 +76,10 @@ type FFProbeStream struct {
StartPts int `json:"start_pts"`
StartTime string `json:"start_time"`
Tags struct {
CreationTime time.Time `json:"creation_time"`
HandlerName string `json:"handler_name"`
Language string `json:"language"`
Rotate string `json:"rotate"`
CreationTime models.JSONTime `json:"creation_time"`
HandlerName string `json:"handler_name"`
Language string `json:"language"`
Rotate string `json:"rotate"`
} `json:"tags"`
TimeBase string `json:"time_base"`
Width int `json:"width,omitempty"`