Skip to content

Commit

Permalink
Fix arte movie download
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Feb 1, 2021
1 parent d6dc5e5 commit 1e8c519
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmd/aspiratv/download.go
Expand Up @@ -81,7 +81,7 @@ func (a *app) DownloadShow(ctx context.Context, p providers.Provider, m *provide
itemName = filepath.Base(m.Metadata.GetMediaPath(ShowPath))

err := p.GetMediaDetails(ctx, m) // Side effect: Episode number can be determined at this point.
url := m.Metadata.GetMediaInfo().URL
url := m.Metadata.GetMediaInfo().MediaURL
if err != nil || len(url) == 0 {
a.logger.Error().Printf("[%s] Can't get url from %s.", p.Name(), filepath.Base(m.Metadata.GetMediaPath(ShowPath)))
return
Expand Down
3 changes: 2 additions & 1 deletion metadata/nfo/nfo.go
Expand Up @@ -50,7 +50,8 @@ type MediaInfo struct {
Actor []Actor `xml:"actor,omitempty"`
Tag []string `xml:"tag,omitempty"`

URL string `xml:"-"` // Media URL
MediaURL string `xml:"-"` // Media URL mp4
PageURL string `xml:"-"` // Show page url
IsSpecial bool `xml:"-"` // True when special episode
SeasonInfo *Season `xml:"-"` // Possible Season nfo
TVShow *TVShow `xml:"-"` // Possible TVShow nfo
Expand Down
19 changes: 10 additions & 9 deletions providers/artetv/artetv.go
Expand Up @@ -296,9 +296,10 @@ func (p *ArteTV) getShows(ctx context.Context, mr *matcher.MatchRequest, data []
Type: "ARTETV",
},
},
Title: ep.Title,
Plot: ep.ShortDescription,
Thumb: getThumbs(ep.Images),
Title: ep.Title,
Plot: ep.ShortDescription,
Thumb: getThumbs(ep.Images),
PageURL: ep.URL,
// TVShow: &tvshow,
Tag: []string{"Arte"},
},
Expand Down Expand Up @@ -368,7 +369,7 @@ func (p *ArteTV) getSerie(ctx context.Context, mr *matcher.MatchRequest, d Data)

err := parser.Visit(d.URL)
if err != nil {
p.config.Log.Error().Printf("[%s] Can't visit URL: %w", p.Name(), err)
p.config.Log.Error().Printf("[%s] Can't visit URL %q: %w", p.Name(), err)
return
}

Expand Down Expand Up @@ -426,7 +427,7 @@ func (p *ArteTV) getSerie(ctx context.Context, mr *matcher.MatchRequest, d Data)
Season: season,
Episode: episode,
Aired: nfo.Aired(ep.Availability.Start),
URL: ep.URL,
PageURL: ep.URL,
},
}

Expand Down Expand Up @@ -513,7 +514,7 @@ func getBestImage(image Image) string {

const arteDetails = "https://api.arte.tv/api/player/v1/config/fr/%s?autostart=1&lifeCycle=1" // Player to get Video streams ProgID

// GetMediaDetails return the show's URL, a mp4 file
// GetMediaDetails return the media's URL, a mp4 file
func (p *ArteTV) GetMediaDetails(ctx context.Context, m *providers.Media) error {
info := m.Metadata.GetMediaInfo()

Expand All @@ -539,9 +540,9 @@ func (p *ArteTV) GetMediaDetails(ctx context.Context, m *providers.Media) error

})

err := parser.Visit(info.URL)
err := parser.Visit(info.PageURL)
if err != nil {
p.config.Log.Error().Printf("[%s] Can't visit URL: %w", p.Name(), err)
p.config.Log.Error().Printf("[%s] Can't visit URL %q: %w", p.Name(), err)
return err
}
err = json.NewDecoder(strings.NewReader(js)).Decode(&pgm)
Expand Down Expand Up @@ -616,7 +617,7 @@ func (p *ArteTV) GetMediaDetails(ctx context.Context, m *providers.Media) error
return err
}

info.URL = u
info.MediaURL = u
if info.Aired.Time().IsZero() {
info.Aired = nfo.Aired(player.VideoJSONPlayer.VRA.Time())
}
Expand Down
4 changes: 2 additions & 2 deletions providers/francetv/francetv.go
Expand Up @@ -180,9 +180,9 @@ func (p *FranceTV) GetMediaDetails(ctx context.Context, m *providers.Media) erro
if len(pl.URL) == 0 {
return fmt.Errorf("Show's URL is empty")
}
info.URL = pl.URL
info.MediaURL = pl.URL

}
p.config.Log.Trace().Printf("[%s] Player URL for '%s' is %q ", p.Name(), m.Metadata.GetMediaInfo().Title, info.URL)
p.config.Log.Trace().Printf("[%s] Player URL for '%s' is %q ", p.Name(), m.Metadata.GetMediaInfo().Title, info.MediaURL)
return nil
}
2 changes: 1 addition & 1 deletion providers/gulli/player.go
Expand Up @@ -72,7 +72,7 @@ func (p *Gulli) getPlayer(ctx context.Context, mr *matcher.MatchRequest, ID stri
info = &nfo.MediaInfo{}
case "file":
if strings.HasSuffix(strings.ToLower(s), ".m3u8") {
info.URL = s
info.MediaURL = s
}
case "image":
info.Thumb = []nfo.Thumb{
Expand Down

0 comments on commit 1e8c519

Please sign in to comment.