From b4740d5eb4fd55d5a673f123ab25e3fbe0860e53 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Wed, 12 Feb 2025 17:27:00 +0800 Subject: [PATCH] fix: movie subpath --- internal/op/current.go | 4 ++-- internal/op/movie.go | 2 +- internal/op/room.go | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/op/current.go b/internal/op/current.go index c0552606..ef792946 100644 --- a/internal/op/current.go +++ b/internal/op/current.go @@ -35,10 +35,10 @@ func (c *current) Current() model.Current { return c.current } -func (c *current) SubPath() string { +func (c *current) CurrentMovie() model.CurrentMovie { c.lock.RLock() defer c.lock.RUnlock() - return c.current.Movie.SubPath + return c.current.Movie } func (c *current) SetMovie(movie model.CurrentMovie, play bool) { diff --git a/internal/op/movie.go b/internal/op/movie.go index d8cfcbbc..10dd693a 100644 --- a/internal/op/movie.go +++ b/internal/op/movie.go @@ -35,7 +35,7 @@ type Movie struct { } func (m *Movie) SubPath() string { - return m.room.CurrentSubPath() + return m.room.SubPath(m.ID) } func (m *Movie) ExpireID(ctx context.Context) (uint64, error) { diff --git a/internal/op/room.go b/internal/op/room.go index 084b6b50..a939861e 100644 --- a/internal/op/room.go +++ b/internal/op/room.go @@ -478,12 +478,12 @@ func (r *Room) SetCurrentMovie(movieID string, subPath string, play bool) error return m.ClearCache() } -func (r *Room) CurrentSubPath() string { - fmt.Println("CurrentSubPath", r.current) - fmt.Println("CurrentSubPath", r.current) - fmt.Println("CurrentSubPath", r.current) - fmt.Println("CurrentSubPath", r.current) - return r.current.SubPath() +func (r *Room) SubPath(id string) string { + m := r.current.CurrentMovie() + if m.ID == id { + return m.SubPath + } + return "" } func (r *Room) SwapMoviePositions(id1, id2 string) error {