Compare commits

..

No commits in common. "eff6b6e19fb0860ac1fcfb8547fb5cdfb2a3a9e6" and "ae7c752e43ae672797835d62cae5db6a507fce8e" have entirely different histories.

14 changed files with 45 additions and 48 deletions

View File

@ -7,8 +7,7 @@ import (
"git.quimbo.fr/odwrtw/canape/backend/models" "git.quimbo.fr/odwrtw/canape/backend/models"
"git.quimbo.fr/odwrtw/canape/backend/web" "git.quimbo.fr/odwrtw/canape/backend/web"
polochon "github.com/odwrtw/polochon/lib" "github.com/odwrtw/papi"
"github.com/odwrtw/polochon/lib/papi"
) )
// TorrentEventer represents the Eventer for torrents // TorrentEventer represents the Eventer for torrents
@ -17,7 +16,7 @@ type TorrentEventer struct {
done chan struct{} done chan struct{}
pClient *papi.Client pClient *papi.Client
// previous keep the previous data // previous keep the previous data
previous []*polochon.Torrent previous []*papi.Torrent
// data holds the computed data // data holds the computed data
data []*models.TorrentVideo data []*models.TorrentVideo
} }

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
"github.com/odwrtw/polochon/lib/papi" "github.com/odwrtw/papi"
) )
const ( const (

View File

@ -2,19 +2,20 @@ package models
import ( import (
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
"github.com/odwrtw/papi"
polochon "github.com/odwrtw/polochon/lib" polochon "github.com/odwrtw/polochon/lib"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// TorrentVideo reprensents a torrent embeding the video inforamtions // TorrentVideo reprensents a torrent embeding the video inforamtions
type TorrentVideo struct { type TorrentVideo struct {
*polochon.Torrent *papi.Torrent
Img string `json:"img"` Img string `json:"img"`
Video polochon.Video `json:"video,omitempty"` Video polochon.Video `json:"video,omitempty"`
} }
// NewTorrentVideo returns a new TorrentVideo // NewTorrentVideo returns a new TorrentVideo
func NewTorrentVideo(t *polochon.Torrent) *TorrentVideo { func NewTorrentVideo(t *papi.Torrent) *TorrentVideo {
torrent := &polochon.Torrent{ torrent := &polochon.Torrent{
ImdbID: t.ImdbID, ImdbID: t.ImdbID,
Type: polochon.VideoType(t.Type), Type: polochon.VideoType(t.Type),
@ -56,7 +57,7 @@ func (t *TorrentVideo) Update(detailer polochon.Detailer, db *sqlx.DB, log *logr
} }
// NewTorrentVideos returns a new slice of TorrentVideo from papi torrents // NewTorrentVideos returns a new slice of TorrentVideo from papi torrents
func NewTorrentVideos(detailer polochon.Detailer, db *sqlx.DB, log *logrus.Entry, torrents []*polochon.Torrent) []*TorrentVideo { func NewTorrentVideos(detailer polochon.Detailer, db *sqlx.DB, log *logrus.Entry, torrents []*papi.Torrent) []*TorrentVideo {
tv := make([]*TorrentVideo, len(torrents)) tv := make([]*TorrentVideo, len(torrents))
for i := range torrents { for i := range torrents {
tv[i] = NewTorrentVideo(torrents[i]) tv[i] = NewTorrentVideo(torrents[i])

View File

@ -7,7 +7,7 @@ import (
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
"github.com/jmoiron/sqlx/types" "github.com/jmoiron/sqlx/types"
"github.com/odwrtw/polochon/lib/papi" "github.com/odwrtw/papi"
) )
const ( const (

View File

@ -10,6 +10,7 @@ import (
_ "github.com/odwrtw/polochon/modules/mock" _ "github.com/odwrtw/polochon/modules/mock"
_ "github.com/odwrtw/polochon/modules/openguessit" _ "github.com/odwrtw/polochon/modules/openguessit"
_ "github.com/odwrtw/polochon/modules/opensubtitles" _ "github.com/odwrtw/polochon/modules/opensubtitles"
_ "github.com/odwrtw/polochon/modules/pam"
_ "github.com/odwrtw/polochon/modules/pushover" _ "github.com/odwrtw/polochon/modules/pushover"
_ "github.com/odwrtw/polochon/modules/tmdb" _ "github.com/odwrtw/polochon/modules/tmdb"
_ "github.com/odwrtw/polochon/modules/tpb" _ "github.com/odwrtw/polochon/modules/tpb"

View File

@ -10,8 +10,8 @@ import (
"git.quimbo.fr/odwrtw/canape/backend/subtitles" "git.quimbo.fr/odwrtw/canape/backend/subtitles"
"git.quimbo.fr/odwrtw/canape/backend/web" "git.quimbo.fr/odwrtw/canape/backend/web"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/odwrtw/papi"
polochon "github.com/odwrtw/polochon/lib" polochon "github.com/odwrtw/polochon/lib"
"github.com/odwrtw/polochon/lib/papi"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -193,7 +193,7 @@ func PolochonDeleteHandler(env *web.Env, w http.ResponseWriter, r *http.Request)
} }
// Delete the movie // Delete the movie
return client.Delete(&papi.Movie{Movie: &polochon.Movie{ImdbID: id}}) return client.Delete(&papi.Movie{ImdbID: id})
} }
// AddToWishlist adds a movie to the user's wishlist // AddToWishlist adds a movie to the user's wishlist
@ -295,7 +295,7 @@ func RefreshMovieSubtitlesHandler(env *web.Env, w http.ResponseWriter, r *http.R
return env.RenderError(w, err) return env.RenderError(w, err)
} }
movie := &papi.Movie{Movie: &polochon.Movie{ImdbID: id}} movie := &papi.Movie{ImdbID: id}
refreshSubs, err := client.UpdateSubtitles(movie) refreshSubs, err := client.UpdateSubtitles(movie)
if err != nil { if err != nil {
return env.RenderError(w, err) return env.RenderError(w, err)
@ -329,7 +329,7 @@ func DownloadVVTSubtitle(env *web.Env, w http.ResponseWriter, r *http.Request) e
return env.RenderError(w, err) return env.RenderError(w, err)
} }
url, err := client.SubtitleURL(&papi.Movie{Movie: &polochon.Movie{ImdbID: id}}, lang) url, err := client.SubtitleURL(&papi.Movie{ImdbID: id}, lang)
if err != nil { if err != nil {
return env.RenderError(w, err) return env.RenderError(w, err)
} }

View File

@ -11,8 +11,8 @@ import (
"git.quimbo.fr/odwrtw/canape/backend/subtitles" "git.quimbo.fr/odwrtw/canape/backend/subtitles"
"git.quimbo.fr/odwrtw/canape/backend/web" "git.quimbo.fr/odwrtw/canape/backend/web"
"github.com/odwrtw/errors" "github.com/odwrtw/errors"
"github.com/odwrtw/papi"
polochon "github.com/odwrtw/polochon/lib" polochon "github.com/odwrtw/polochon/lib"
"github.com/odwrtw/polochon/lib/papi"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -54,7 +54,7 @@ func (m *Movie) MarshalJSON() ([]byte, error) {
// Get the metadata // Get the metadata
movieToMarshal.DateAdded = m.pMovie.DateAdded movieToMarshal.DateAdded = m.pMovie.DateAdded
movieToMarshal.Quality = string(m.pMovie.Quality) movieToMarshal.Quality = m.pMovie.Quality
movieToMarshal.AudioCodec = m.pMovie.AudioCodec movieToMarshal.AudioCodec = m.pMovie.AudioCodec
movieToMarshal.VideoCodec = m.pMovie.VideoCodec movieToMarshal.VideoCodec = m.pMovie.VideoCodec
movieToMarshal.Container = m.pMovie.Container movieToMarshal.Container = m.pMovie.Container

View File

@ -9,8 +9,8 @@ import (
"git.quimbo.fr/odwrtw/canape/backend/subtitles" "git.quimbo.fr/odwrtw/canape/backend/subtitles"
"git.quimbo.fr/odwrtw/canape/backend/web" "git.quimbo.fr/odwrtw/canape/backend/web"
"github.com/odwrtw/errors" "github.com/odwrtw/errors"
"github.com/odwrtw/papi"
polochon "github.com/odwrtw/polochon/lib" polochon "github.com/odwrtw/polochon/lib"
"github.com/odwrtw/polochon/lib/papi"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -39,15 +39,13 @@ func (e *Episode) MarshalJSON() ([]byte, error) {
// Get the DownloadURL // Get the DownloadURL
downloadURL, _ = e.show.client.DownloadURL( downloadURL, _ = e.show.client.DownloadURL(
&papi.Episode{ &papi.Episode{
ShowEpisode: &polochon.ShowEpisode{
ShowImdbID: e.ShowImdbID, ShowImdbID: e.ShowImdbID,
Episode: e.Episode, Episode: e.Episode,
Season: e.Season, Season: e.Season,
}, },
},
) )
dateAdded = pEpisode.DateAdded dateAdded = pEpisode.DateAdded
quality = string(pEpisode.Quality) quality = pEpisode.Quality
audioCodec = pEpisode.AudioCodec audioCodec = pEpisode.AudioCodec
videoCodec = pEpisode.VideoCodec videoCodec = pEpisode.VideoCodec
container = pEpisode.Container container = pEpisode.Container

View File

@ -14,8 +14,8 @@ import (
"git.quimbo.fr/odwrtw/canape/backend/subtitles" "git.quimbo.fr/odwrtw/canape/backend/subtitles"
"git.quimbo.fr/odwrtw/canape/backend/web" "git.quimbo.fr/odwrtw/canape/backend/web"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/odwrtw/papi"
polochon "github.com/odwrtw/polochon/lib" polochon "github.com/odwrtw/polochon/lib"
"github.com/odwrtw/polochon/lib/papi"
) )
// ErrPolochonUnavailable is an error returned if the polochon server is not available // ErrPolochonUnavailable is an error returned if the polochon server is not available
@ -361,11 +361,9 @@ func RefreshEpisodeSubtitlesHandler(env *web.Env, w http.ResponseWriter, r *http
} }
e := &papi.Episode{ e := &papi.Episode{
ShowEpisode: &polochon.ShowEpisode{
ShowImdbID: id, ShowImdbID: id,
Season: season, Season: season,
Episode: episode, Episode: episode,
},
} }
refreshedSubs, err := client.UpdateSubtitles(e) refreshedSubs, err := client.UpdateSubtitles(e)
@ -404,11 +402,9 @@ func DownloadVVTSubtitle(env *web.Env, w http.ResponseWriter, r *http.Request) e
} }
url, err := client.SubtitleURL(&papi.Episode{ url, err := client.SubtitleURL(&papi.Episode{
ShowEpisode: &polochon.ShowEpisode{
ShowImdbID: id, ShowImdbID: id,
Season: season, Season: season,
Episode: episode, Episode: episode,
},
}, lang) }, lang)
if err != nil { if err != nil {
return env.RenderError(w, err) return env.RenderError(w, err)

View File

@ -10,8 +10,8 @@ import (
"git.quimbo.fr/odwrtw/canape/backend/models" "git.quimbo.fr/odwrtw/canape/backend/models"
"git.quimbo.fr/odwrtw/canape/backend/web" "git.quimbo.fr/odwrtw/canape/backend/web"
"github.com/odwrtw/errors" "github.com/odwrtw/errors"
"github.com/odwrtw/papi"
polochon "github.com/odwrtw/polochon/lib" polochon "github.com/odwrtw/polochon/lib"
"github.com/odwrtw/polochon/lib/papi"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )

View File

@ -10,13 +10,14 @@ import (
"git.quimbo.fr/odwrtw/canape/backend/models" "git.quimbo.fr/odwrtw/canape/backend/models"
"git.quimbo.fr/odwrtw/canape/backend/web" "git.quimbo.fr/odwrtw/canape/backend/web"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/odwrtw/papi"
polochon "github.com/odwrtw/polochon/lib" polochon "github.com/odwrtw/polochon/lib"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
// DownloadHandler downloads a movie via polochon // DownloadHandler downloads a movie via polochon
func DownloadHandler(env *web.Env, w http.ResponseWriter, r *http.Request) error { func DownloadHandler(env *web.Env, w http.ResponseWriter, r *http.Request) error {
torrent := &polochon.Torrent{} torrent := &papi.Torrent{}
err := json.NewDecoder(r.Body).Decode(torrent) err := json.NewDecoder(r.Body).Decode(torrent)
if err != nil { if err != nil {
return env.RenderError(w, errors.New("failed to get the url")) return env.RenderError(w, errors.New("failed to get the url"))

View File

@ -51,9 +51,7 @@ export default (state = defaultState, action) =>
}); });
let seasonMap = new Map(); let seasonMap = new Map();
seasonNumbers seasonNumbers.sort().forEach((n) => {
.sort((a, b) => a - b)
.forEach((n) => {
let episodes = []; let episodes = [];
seasons[n] seasons[n]
.sort((a, b) => a.episode - b.episode) .sort((a, b) => a.episode - b.episode)

3
go.mod
View File

@ -15,7 +15,8 @@ require (
github.com/mattn/go-sqlite3 v1.10.0 // indirect github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/odwrtw/errors v0.0.0-20170604160533-c747b9d17833 github.com/odwrtw/errors v0.0.0-20170604160533-c747b9d17833
github.com/odwrtw/polochon v0.0.0-20200416140115-2ad474aa633d github.com/odwrtw/papi v0.0.0-20200416090004-26e95d2feb66
github.com/odwrtw/polochon v0.0.0-20200416085801-6331a40936bf
github.com/phyber/negroni-gzip v0.0.0-20180113114010-ef6356a5d029 github.com/phyber/negroni-gzip v0.0.0-20180113114010-ef6356a5d029
github.com/pioz/tvdb v0.0.0-20190503215423-f45c687faba9 // indirect github.com/pioz/tvdb v0.0.0-20190503215423-f45c687faba9 // indirect
github.com/robfig/cron v1.1.0 github.com/robfig/cron v1.1.0

6
go.sum
View File

@ -134,8 +134,10 @@ github.com/odwrtw/guessit v0.0.0-20200131084001-f88613483547/go.mod h1:W22g7wtc0
github.com/odwrtw/imdb-watchlist v0.0.0-20190417175016-b7a9f7503d69 h1:ow6b/4Jj7J5iYwU678/rbijvaNUJrYkg13j9Nivkung= github.com/odwrtw/imdb-watchlist v0.0.0-20190417175016-b7a9f7503d69 h1:ow6b/4Jj7J5iYwU678/rbijvaNUJrYkg13j9Nivkung=
github.com/odwrtw/imdb-watchlist v0.0.0-20190417175016-b7a9f7503d69/go.mod h1:o2tLH95CtNdqhDb0aS2NbU+1I4PmaNsODpr33Ry0JC0= github.com/odwrtw/imdb-watchlist v0.0.0-20190417175016-b7a9f7503d69/go.mod h1:o2tLH95CtNdqhDb0aS2NbU+1I4PmaNsODpr33Ry0JC0=
github.com/odwrtw/papi v0.0.0-20190413103029-bd5bfea85ae6/go.mod h1:CXotdtODLpW0/yuFV5XH8Rmrj0eAfPLvdMKykPM2WCk= github.com/odwrtw/papi v0.0.0-20190413103029-bd5bfea85ae6/go.mod h1:CXotdtODLpW0/yuFV5XH8Rmrj0eAfPLvdMKykPM2WCk=
github.com/odwrtw/polochon v0.0.0-20200416140115-2ad474aa633d h1:jquS1D5p2ldxmbbWW4Vg2FCmvXxIIhq5zeoHSpwGtLw= github.com/odwrtw/papi v0.0.0-20200416090004-26e95d2feb66 h1:E+UrY1WG5xp65UXs2rbtVVD4FdSffMR9E0lbd7xdf80=
github.com/odwrtw/polochon v0.0.0-20200416140115-2ad474aa633d/go.mod h1:rBjekia21ToZoTxJqR/5Ued8EYwKTtamq+bo/XINOjA= github.com/odwrtw/papi v0.0.0-20200416090004-26e95d2feb66/go.mod h1:eY0skvVHJBwbSJ18uq2c1T4SvhdEV8R0XFSb0zKh5Yo=
github.com/odwrtw/polochon v0.0.0-20200416085801-6331a40936bf h1:zzsX9o1Gxe1esokjdcOMa5hMC2aqubWXQoAEqMCMyyY=
github.com/odwrtw/polochon v0.0.0-20200416085801-6331a40936bf/go.mod h1:rBjekia21ToZoTxJqR/5Ued8EYwKTtamq+bo/XINOjA=
github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f h1:fwEIGT+o3e8+XkBqrwsE3/+9ketTQXflPhCkv3/w990= github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f h1:fwEIGT+o3e8+XkBqrwsE3/+9ketTQXflPhCkv3/w990=
github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f/go.mod h1:updLvMbQo2xHoz94MX9+GqmSoKhf6E8fs/J+wLvvu6A= github.com/odwrtw/tpb v0.0.0-20200130133144-c846aa382c6f/go.mod h1:updLvMbQo2xHoz94MX9+GqmSoKhf6E8fs/J+wLvvu6A=
github.com/odwrtw/trakttv v0.0.0-20200404161731-0d594827e4f9 h1:PuQLHO75MXUsJpf9BcTVxvR/FCkdn1MZnZt6h3o6cJI= github.com/odwrtw/trakttv v0.0.0-20200404161731-0d594827e4f9 h1:PuQLHO75MXUsJpf9BcTVxvR/FCkdn1MZnZt6h3o6cJI=