up debid link

This commit is contained in:
cangui 2025-06-19 19:46:37 +02:00
parent 6907794858
commit 196c29cd70
2 changed files with 18 additions and 9 deletions

View File

@ -534,7 +534,13 @@ func (c *Client) CreateTranscode(ctx context.Context, fileID, preset string) (st
return resp.TranscodeID, nil return resp.TranscodeID, nil
} }
func (c *Client) GetTranscode(ctx context.Context, transcodeID string) (*StreamInfo, error) { func (c *Client) GetTranscode(ctx context.Context, fileID string) (*StreamInfo, error) {
body := struct {
ID string `json:"id"`
}{
ID: fileID,
}
var raw struct { var raw struct {
Success bool `json:"success"` Success bool `json:"success"`
Value struct { Value struct {
@ -545,15 +551,16 @@ func (c *Client) GetTranscode(ctx context.Context, transcodeID string) (*StreamI
MimeType string `json:"mimetype"` MimeType string `json:"mimetype"`
Domain string `json:"domain"` Domain string `json:"domain"`
File struct { File struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Size int64 `json:"size"` Size int64 `json:"size"`
Source string `json:"source"`
} `json:"file"` } `json:"file"`
} `json:"value"` } `json:"value"`
} }
path := fmt.Sprintf("stream/transcode/%s", transcodeID) path := "stream/transcode/add"
if err := c.doJSON(ctx, "GET", path, nil, nil, &raw); err != nil { if err := c.doJSON(ctx, "POST", path, nil, body, &raw); err != nil {
return nil, err return nil, err
} }
@ -570,3 +577,5 @@ func (c *Client) GetTranscode(ctx context.Context, transcodeID string) (*StreamI
} }
return info, nil return info, nil
} }

View File

@ -311,9 +311,9 @@ func HandleAddJob(db *gorm.DB) http.HandlerFunc {
for _, l := range links { for _, l := range links {
streamInfo, err := client.GetTranscode(ctx, l.ID) streamInfo, err := client.GetTranscode(ctx, l.ID)
if err != nil { if err != nil {
log.Println("Erreur GetTranscode:", err) log.Println("Erreur GetTranscode:", err)
return return
} }
job := &download.DownloadJob{ job := &download.DownloadJob{
ID: l.ID, ID: l.ID,