refactor(podcast)!: make podcasts global not per user, to match spec

Release-As: 0.15.0
This commit is contained in:
brian-doherty
2022-05-03 16:32:18 -05:00
committed by sentriz
parent e883de8c95
commit 182c96e966
9 changed files with 121 additions and 112 deletions

View File

@@ -7,15 +7,14 @@ package db
import (
"path"
"path/filepath"
"strconv"
"strings"
"time"
// TODO: remove this dep
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
"go.senan.xyz/gonic/mime"
"go.senan.xyz/gonic/server/ctrlsubsonic/specid"
)
func splitInt(in, sep string) []int {
@@ -315,7 +314,6 @@ type Podcast struct {
ID int `gorm:"primary_key"`
UpdatedAt time.Time
ModifiedAt time.Time
UserID int `sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
URL string
Title string
Description string
@@ -326,11 +324,6 @@ type Podcast struct {
AutoDownload PodcastAutoDownload
}
func (p *Podcast) Fullpath(podcastPath string) string {
sanitizedTitle := strings.ReplaceAll(p.Title, "/", "_")
return filepath.Join(podcastPath, filepath.Clean(sanitizedTitle))
}
func (p *Podcast) SID() *specid.ID {
return &specid.ID{Type: specid.Podcast, Value: p.ID}
}