Fix upsert of torrents
Some checks reported errors
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build was killed

We're missing some infos from the Torrents
We ensure that we set them for now, we'll need to edit the polochon
torrenters so that they put this info
And add a DB constraint, a torrent shouldn't be able to be created
without an imdbID
This commit is contained in:
Lucas BEE 2020-04-10 17:47:35 +02:00
parent 114f022b8d
commit 4206d09954
2 changed files with 4 additions and 0 deletions

View File

@ -223,6 +223,7 @@ func (m *Movie) RefreshTorrents(env *web.Env, torrenters []polochon.Torrenter) e
// Update them in database
for _, t := range m.Movie.Torrents {
t.ImdbID = m.ImdbID
err = models.UpsertMovieTorrent(env.Database, t)
if err != nil {
log.Error("error while adding torrent", err)

View File

@ -179,6 +179,9 @@ func RefreshTorrents(env *web.Env, showEpisode *polochon.ShowEpisode, torrenters
// Upsert all the torrents we got
for _, t := range showEpisode.Torrents {
t.ImdbID = showEpisode.ShowImdbID
t.Season = showEpisode.Season
t.Episode = showEpisode.Episode
err = models.UpsertEpisodeTorrent(env.Database, t)
if err != nil {
log.Errorf("error while adding torrent : %s", err)