Skip to content

Commit

Permalink
fixup! Add minimal xtream m3u cache storage
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Emmanuel Jacquier <pierre-emmanuel.jacquier@exoscale.ch>
  • Loading branch information
pierre-emmanuelJ committed Sep 28, 2019
1 parent 54b56f4 commit 8329c66
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/routes/xtream.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,19 @@ func (p *proxy) xtreamGet(c *gin.Context) {
}

// XXX Add cache per url and store it on the local storage or key/value storage e.g: etcd, redis...
lock.RLock()
if xtreamM3uCacheLastURL != m3uURL.String() {
log.Printf("[iptv-proxy] %v | %s | xtream cache m3u file\n", time.Now().Format("2006/01/02 - 15:04:05"), c.ClientIP())
lock.RUnlock()
lock.Lock()
xtreamM3uCacheLastURL = m3uURL.String()
lock.Unlock()
if err := p.cacheXtreamM3u(m3uURL); err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
} else {
lock.RUnlock()
}

c.Header("Content-Disposition", "attachment; filename=\"iptv.m3u\"")
Expand Down

0 comments on commit 8329c66

Please sign in to comment.