fix: issues
This commit is contained in:
@@ -120,7 +120,7 @@ func (c *Controller) MediaSegment(ctx fiber.Ctx) error {
|
||||
return err
|
||||
}
|
||||
|
||||
filepath := c.svc.GetSegmentPath(ctx.Context(), mediaType, model.Hash, segments[0])
|
||||
filepath := c.svc.GetSegmentPath(ctx.Context(), mediaType, model.TenantID, model.Hash, segments[0])
|
||||
return ctx.SendFile(filepath)
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ func (svc *Service) GetMediaByID(ctx context.Context, tenantId, userId, id int64
|
||||
func (svc *Service) ModelToListItem(ctx context.Context, m *model.Medias) *ListItem {
|
||||
item := &ListItem{
|
||||
ID: m.ID,
|
||||
Poster: fmt.Sprintf("/static/%s/poster.jpg", m.Hash),
|
||||
Poster: fmt.Sprintf("/posters/%d/%s.jpg", m.TenantID, m.Hash),
|
||||
Hash: m.Hash,
|
||||
Title: m.Title,
|
||||
Description: m.Description,
|
||||
@@ -253,7 +253,7 @@ func (svc *Service) Upsert(ctx context.Context, tenantId int64, item media_store
|
||||
// get video m3u8
|
||||
func (svc *Service) GetM3U8(ctx context.Context, tenantId int64, types pg.MediaType, hash string, bought bool) (m3u8.Playlist, error) {
|
||||
log := svc.log.WithField("method", "GetM3U8")
|
||||
indexPath := filepath.Join(svc.storageConfig.Path, hash, types.String(), "index.m3u8")
|
||||
indexPath := filepath.Join(svc.storageConfig.Path, fmt.Sprintf("%d", tenantId), hash, types.String(), "index.m3u8")
|
||||
log.Infof("m3u8 path: %s", indexPath)
|
||||
|
||||
f, err := os.Open(indexPath)
|
||||
@@ -313,8 +313,8 @@ func (svc *Service) GetM3U8(ctx context.Context, tenantId int64, types pg.MediaT
|
||||
}
|
||||
|
||||
// GetSegmentPath
|
||||
func (svc *Service) GetSegmentPath(ctx context.Context, t pg.MediaType, hash string, segment int64) string {
|
||||
return filepath.Join(svc.storageConfig.Path, hash, t.String(), fmt.Sprintf("%d.ts", segment))
|
||||
func (svc *Service) GetSegmentPath(ctx context.Context, t pg.MediaType, tenantId int64, hash string, segment int64) string {
|
||||
return filepath.Join(svc.storageConfig.Path, fmt.Sprintf("%d", tenantId), hash, t.String(), fmt.Sprintf("%d.ts", segment))
|
||||
}
|
||||
|
||||
func (svc *Service) Checkout(ctx context.Context, tenantId, userId, mediaId int64) error {
|
||||
|
||||
Reference in New Issue
Block a user