Fix upsert of torrents
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:
parent
114f022b8d
commit
4206d09954
@ -223,6 +223,7 @@ func (m *Movie) RefreshTorrents(env *web.Env, torrenters []polochon.Torrenter) e
|
|||||||
|
|
||||||
// Update them in database
|
// Update them in database
|
||||||
for _, t := range m.Movie.Torrents {
|
for _, t := range m.Movie.Torrents {
|
||||||
|
t.ImdbID = m.ImdbID
|
||||||
err = models.UpsertMovieTorrent(env.Database, t)
|
err = models.UpsertMovieTorrent(env.Database, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("error while adding torrent", err)
|
log.Error("error while adding torrent", err)
|
||||||
|
@ -179,6 +179,9 @@ func RefreshTorrents(env *web.Env, showEpisode *polochon.ShowEpisode, torrenters
|
|||||||
|
|
||||||
// Upsert all the torrents we got
|
// Upsert all the torrents we got
|
||||||
for _, t := range showEpisode.Torrents {
|
for _, t := range showEpisode.Torrents {
|
||||||
|
t.ImdbID = showEpisode.ShowImdbID
|
||||||
|
t.Season = showEpisode.Season
|
||||||
|
t.Episode = showEpisode.Episode
|
||||||
err = models.UpsertEpisodeTorrent(env.Database, t)
|
err = models.UpsertEpisodeTorrent(env.Database, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("error while adding torrent : %s", err)
|
log.Errorf("error while adding torrent : %s", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user