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

View File

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