up
This commit is contained in:
parent
196c29cd70
commit
954b9c9037
@ -525,20 +525,18 @@ func (c *Client) ListFiles(ctx context.Context, parentID string) ([]File, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// =========================== Stream ===========================
|
// =========================== Stream ===========================
|
||||||
func (c *Client) CreateTranscode(ctx context.Context, fileID, preset string) (string, error) {
|
// func (c *Client) CreateTranscode(ctx context.Context, fileID, preset string) (string, error) {
|
||||||
var resp struct{ TranscodeID string `json:"transcodeId"` }
|
// var resp struct{ TranscodeID string `json:"transcodeId"` }
|
||||||
body := map[string]string{"fileId": fileID, "preset": preset}
|
// body := map[string]string{"fileId": fileID}
|
||||||
if err := c.doJSON(ctx, "POST", "stream/transcode", nil, body, &resp); err != nil {
|
// if err := c.doJSON(ctx, "POST", "stream/transcode", nil, body, &resp); err != nil {
|
||||||
return "", err
|
// return "", err
|
||||||
}
|
// }
|
||||||
return resp.TranscodeID, nil
|
// return resp.TranscodeID, nil
|
||||||
}
|
// }
|
||||||
|
|
||||||
func (c *Client) GetTranscode(ctx context.Context, fileID string) (*StreamInfo, error) {
|
func (c *Client) CreateTranscode(ctx context.Context, fileID string) (*StreamInfo, error) {
|
||||||
body := struct {
|
requestBody := map[string]string{
|
||||||
ID string `json:"id"`
|
"id": fileID,
|
||||||
}{
|
|
||||||
ID: fileID,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var raw struct {
|
var raw struct {
|
||||||
@ -560,7 +558,7 @@ func (c *Client) GetTranscode(ctx context.Context, fileID string) (*StreamInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
path := "stream/transcode/add"
|
path := "stream/transcode/add"
|
||||||
if err := c.doJSON(ctx, "POST", path, nil, body, &raw); err != nil {
|
if err := c.doJSON(ctx, "POST", path, nil, requestBody, &raw); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,3 +577,4 @@ func (c *Client) GetTranscode(ctx context.Context, fileID string) (*StreamInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -309,7 +309,7 @@ func HandleAddJob(db *gorm.DB) http.HandlerFunc {
|
|||||||
|
|
||||||
// Enregistre chaque lien comme un job "en attente"
|
// Enregistre chaque lien comme un job "en attente"
|
||||||
for _, l := range links {
|
for _, l := range links {
|
||||||
streamInfo, err := client.GetTranscode(ctx, l.ID)
|
streamInfo, err := client.CreateTranscode(ctx,l.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("Erreur GetTranscode:", err)
|
log.Println("Erreur GetTranscode:", err)
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user