Merge branch 'sentriz:master' into ldap_auth
This commit is contained in:
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"sort"
|
||||
"time"
|
||||
@@ -208,8 +209,10 @@ func playlistRender(c *Controller, params params.Params, playlistID string, play
|
||||
for _, path := range playlist.Items {
|
||||
file, err := specidpaths.Lookup(c.DB, PathsOf(c.MusicPaths), c.PodcastsPath, path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("lookup path %q: %w", path, err)
|
||||
log.Printf("error looking up path %q: %s", path, err)
|
||||
continue
|
||||
}
|
||||
|
||||
var trch *spec.TrackChild
|
||||
switch id := file.SID(); id.Type {
|
||||
case specid.Track:
|
||||
@@ -237,5 +240,8 @@ func playlistRender(c *Controller, params params.Params, playlistID string, play
|
||||
trch.TranscodedSuffix = transcodeSuffix
|
||||
resp.List = append(resp.List, trch)
|
||||
}
|
||||
|
||||
resp.SongCount = len(resp.List)
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package spec
|
||||
|
||||
import "go.senan.xyz/gonic/db"
|
||||
import (
|
||||
"jaytaylor.com/html2text"
|
||||
"go.senan.xyz/gonic/db"
|
||||
)
|
||||
|
||||
func NewPodcastChannel(p *db.Podcast) *PodcastChannel {
|
||||
ret := &PodcastChannel{
|
||||
@@ -23,13 +26,17 @@ func NewPodcastEpisode(e *db.PodcastEpisode) *PodcastEpisode {
|
||||
if e == nil {
|
||||
return nil
|
||||
}
|
||||
desc, err := html2text.FromString(e.Description, html2text.Options{TextOnly: true})
|
||||
if (err != nil) {
|
||||
desc = ""
|
||||
}
|
||||
return &PodcastEpisode{
|
||||
ID: e.SID(),
|
||||
StreamID: e.SID(),
|
||||
ContentType: e.MIME(),
|
||||
ChannelID: e.PodcastSID(),
|
||||
Title: e.Title,
|
||||
Description: e.Description,
|
||||
Description: desc,
|
||||
Status: string(e.Status),
|
||||
CoverArt: e.PodcastSID(),
|
||||
PublishDate: *e.PublishDate,
|
||||
|
||||
@@ -27,7 +27,7 @@ func Locate(dbc *db.DB, podcastsPath string, id specid.ID) (Result, error) {
|
||||
}
|
||||
case specid.PodcastEpisode:
|
||||
var pe db.PodcastEpisode
|
||||
if err := dbc.Where("id=?", id.Value).Find(&pe).Error; err == nil {
|
||||
if err := dbc.Where("id=? AND status=?", id.Value, db.PodcastEpisodeStatusCompleted).Find(&pe).Error; err == nil {
|
||||
pe.AbsP = filepath.Join(podcastsPath, pe.Path)
|
||||
return &pe, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user