diff --git a/backend/movies/movies.go b/backend/movies/movies.go index 2252d2f..7507989 100644 --- a/backend/movies/movies.go +++ b/backend/movies/movies.go @@ -6,13 +6,14 @@ import ( "fmt" "os" "path/filepath" + "time" "git.quimbo.fr/odwrtw/canape/backend/backend" "git.quimbo.fr/odwrtw/canape/backend/subtitles" "git.quimbo.fr/odwrtw/canape/backend/users" "git.quimbo.fr/odwrtw/canape/backend/web" "github.com/odwrtw/papi" - "github.com/odwrtw/polochon/lib" + polochon "github.com/odwrtw/polochon/lib" "github.com/sirupsen/logrus" ) @@ -30,34 +31,43 @@ type Movie struct { func (m *Movie) MarshalJSON() ([]byte, error) { type Alias Movie - var downloadURL string - var subs []subtitles.Subtitle - // If the episode is present, fill the downloadURL - if m.pMovie != nil { - // Get the DownloadURL - downloadURL, _ = m.client.DownloadURL(m.pMovie) - // Append the Subtitles - for _, l := range m.pMovie.Subtitles { - subtitleURL, _ := m.client.SubtitleURL(m.pMovie, l) - subs = append(subs, subtitles.Subtitle{ - Language: l, - URL: subtitleURL, - VVTFile: fmt.Sprintf("/movies/%s/subtitles/%s", m.ImdbID, l), - }) - } - } - // Marshal the movie with its polochon_url movieToMarshal := &struct { *Alias PolochonURL string `json:"polochon_url"` PosterURL string `json:"poster_url"` Subtitles []subtitles.Subtitle `json:"subtitles"` + DateAdded time.Time `json:"date_added"` + Quality string `json:"quality"` + AudioCodec string `json:"audio_codec"` + VideoCodec string `json:"video_codec"` + Container string `json:"container"` }{ - Alias: (*Alias)(m), - PolochonURL: downloadURL, - PosterURL: m.PosterURL(), - Subtitles: subs, + Alias: (*Alias)(m), + PosterURL: m.PosterURL(), + Subtitles: []subtitles.Subtitle{}, + } + + if m.pMovie != nil { + // Get the DownloadURL + movieToMarshal.PolochonURL, _ = m.client.DownloadURL(m.pMovie) + + // Get the metadata + movieToMarshal.DateAdded = m.pMovie.DateAdded + movieToMarshal.Quality = m.pMovie.Quality + movieToMarshal.AudioCodec = m.pMovie.AudioCodec + movieToMarshal.VideoCodec = m.pMovie.VideoCodec + movieToMarshal.Container = m.pMovie.Container + + // Append the Subtitles + for _, l := range m.pMovie.Subtitles { + subtitleURL, _ := m.client.SubtitleURL(m.pMovie, l) + movieToMarshal.Subtitles = append(movieToMarshal.Subtitles, subtitles.Subtitle{ + Language: l, + URL: subtitleURL, + VVTFile: fmt.Sprintf("/movies/%s/subtitles/%s", m.ImdbID, l), + }) + } } return json.Marshal(movieToMarshal) diff --git a/backend/shows/episodes.go b/backend/shows/episodes.go index a1ab1a0..152cf4e 100644 --- a/backend/shows/episodes.go +++ b/backend/shows/episodes.go @@ -3,13 +3,14 @@ package shows import ( "encoding/json" "fmt" + "time" - "github.com/odwrtw/papi" - polochon "github.com/odwrtw/polochon/lib" - "github.com/sirupsen/logrus" "git.quimbo.fr/odwrtw/canape/backend/backend" "git.quimbo.fr/odwrtw/canape/backend/subtitles" "git.quimbo.fr/odwrtw/canape/backend/web" + "github.com/odwrtw/papi" + polochon "github.com/odwrtw/polochon/lib" + "github.com/sirupsen/logrus" ) // Episode represents an episode @@ -25,6 +26,12 @@ func (e *Episode) MarshalJSON() ([]byte, error) { var downloadURL string var subs []subtitles.Subtitle + var dateAdded time.Time + var quality string + var audioCodec string + var videoCodec string + var container string + // If the episode is present, fill the downloadURL if e.pShow != nil { pEpisode := e.pShow.GetEpisode(e.Season, e.Episode) @@ -37,6 +44,12 @@ func (e *Episode) MarshalJSON() ([]byte, error) { Season: e.Season, }, ) + dateAdded = pEpisode.DateAdded + quality = pEpisode.Quality + audioCodec = pEpisode.AudioCodec + videoCodec = pEpisode.VideoCodec + container = pEpisode.Container + // Append the Subtitles for _, l := range pEpisode.Subtitles { subtitleURL, _ := e.client.SubtitleURL(pEpisode, l) @@ -54,10 +67,20 @@ func (e *Episode) MarshalJSON() ([]byte, error) { *alias PolochonURL string `json:"polochon_url"` Subtitles []subtitles.Subtitle `json:"subtitles"` + DateAdded time.Time `json:"date_added"` + Quality string `json:"quality"` + AudioCodec string `json:"audio_codec"` + VideoCodec string `json:"video_codec"` + Container string `json:"container"` }{ alias: (*alias)(e), PolochonURL: downloadURL, Subtitles: subs, + DateAdded: dateAdded, + Quality: quality, + AudioCodec: audioCodec, + VideoCodec: videoCodec, + Container: container, } return json.Marshal(episodeToMarshal) diff --git a/frontend/js/components/list/details.js b/frontend/js/components/list/details.js index f848afb..ca74023 100644 --- a/frontend/js/components/list/details.js +++ b/frontend/js/components/list/details.js @@ -18,6 +18,13 @@ export default function ListDetails(props) { rating={props.data.get("rating")} votes={props.data.get("votes")} /> +

{props.data.get("plot")}

{props.children} @@ -77,6 +84,22 @@ function TrackingLabel(props) { ); } +function PolochonMetadata(props) { + if (!props.quality || props.quality === "") { + return null; + } + + return ( +

+ {props.quality} + {props.container} + {props.videoCodec} + {props.audioCodec} + {props.releaseGroup} +

+ ); +} + function Genres(props) { if (props.genres === undefined) { return null; diff --git a/frontend/js/components/shows/details.js b/frontend/js/components/shows/details.js index 6f0207b..3e6775d 100644 --- a/frontend/js/components/shows/details.js +++ b/frontend/js/components/shows/details.js @@ -179,6 +179,22 @@ class Season extends React.Component { } } +function PolochonMetadata(props) { + if (!props.quality || props.quality === "") { + return null; + } + + return ( + + {props.quality} + {props.container} + {props.videoCodec} + {props.audioCodec} + {props.releaseGroup} + + ); +} + function Episode(props) { return ( @@ -191,7 +207,13 @@ function Episode(props) { {props.data.get("title")} - + {props.data.get("polochon_url") !== "" &&