From 8a2f7af9e85efc1c7729c41003a060c08fbee07a Mon Sep 17 00:00:00 2001 From: Akhil Gupta Date: Mon, 20 Sep 2021 16:24:52 +0530 Subject: [PATCH 1/3] delete dolder and image lazy loading --- Readme.md | 2 +- client/episodes.html | 2 +- client/episodes_new.html | 2 +- client/settings.html | 2 +- service/fileService.go | 4 ++++ service/podcastService.go | 6 ++++++ 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Readme.md b/Readme.md index 0261ef5..34f8c7b 100644 --- a/Readme.md +++ b/Readme.md @@ -14,7 +14,7 @@ -->

Podgrab

-

Current Version -2021.08.25

+

Current Version -2021.09.20

A self-hosted podcast manager to download episodes as soon as they become live diff --git a/client/episodes.html b/client/episodes.html index 92f029c..ee7bca4 100644 --- a/client/episodes.html +++ b/client/episodes.html @@ -67,7 +67,7 @@ class="u-full-width" src="/podcastitems/{{.ID}}/image" alt="{{ .Title }}" - lazy="lazy" + loading="lazy" />

diff --git a/client/episodes_new.html b/client/episodes_new.html index 80c89ac..387974b 100644 --- a/client/episodes_new.html +++ b/client/episodes_new.html @@ -125,7 +125,7 @@ class="u-full-width" :src=" getEpisodeImage(item)" v-bind:alt="item.Title" - lazy="lazy" + loading="lazy" />
diff --git a/client/settings.html b/client/settings.html index 8dcee6f..5cd275d 100644 --- a/client/settings.html +++ b/client/settings.html @@ -132,7 +132,7 @@ - + diff --git a/service/fileService.go b/service/fileService.go index c9857de..4c9fc56 100644 --- a/service/fileService.go +++ b/service/fileService.go @@ -346,6 +346,10 @@ func createConfigFolderIfNotExists(folder string) string { return createFolder(folder, dataPath) } +func deletePodcastFolder(folder string) error { + return os.RemoveAll(createDataFolderIfNotExists(folder)) +} + func getFileName(link string, title string, defaultExtension string) string { fileUrl, err := url.Parse(link) checkError(err) diff --git a/service/podcastService.go b/service/podcastService.go index d87b3c0..8efa1fa 100644 --- a/service/podcastService.go +++ b/service/podcastService.go @@ -676,6 +676,12 @@ func DeletePodcast(id string, deleteFiles bool) error { db.DeletePodcastItemById(item.ID) } + + err = deletePodcastFolder(podcast.Title) + if err != nil { + return err + } + err = db.DeletePodcastById(id) if err != nil { return err From 916ce33449edcf1549f185c05e0e21bdbead33e5 Mon Sep 17 00:00:00 2001 From: Akhil Gupta Date: Fri, 1 Oct 2021 13:54:14 +0530 Subject: [PATCH 2/3] added feed for single podcast --- Readme.md | 2 +- client/index.html | 6 +++++- client/settings.html | 2 +- controllers/podcast.go | 22 ++++++++++++++++++++++ main.go | 1 + 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 34f8c7b..cf16aa7 100644 --- a/Readme.md +++ b/Readme.md @@ -14,7 +14,7 @@ -->

Podgrab

-

Current Version -2021.09.20

+

Current Version -2021.10.01

A self-hosted podcast manager to download episodes as soon as they become live diff --git a/client/index.html b/client/index.html index 766e695..a5d6b4b 100644 --- a/client/index.html +++ b/client/index.html @@ -327,7 +327,7 @@

- + @@ -347,6 +347,10 @@ + + + +
Current Version 2021.08.25 2021.09.20
Website${ detailPodcast.Author }
UrlOriginal Url Link
Paused ${ detailPodcast.IsPaused?'Yes':'No' }
Podgrab Feed Link
diff --git a/client/settings.html b/client/settings.html index 5cd275d..f857945 100644 --- a/client/settings.html +++ b/client/settings.html @@ -132,7 +132,7 @@ - + diff --git a/controllers/podcast.go b/controllers/podcast.go index 5fb7282..e0688c3 100644 --- a/controllers/podcast.go +++ b/controllers/podcast.go @@ -487,6 +487,28 @@ func createRss(items []db.PodcastItem, title, description string, c *gin.Context } } +func GetRssForPodcastById(c *gin.Context) { + var searchByIdQuery SearchByIdQuery + if c.ShouldBindUri(&searchByIdQuery) == nil { + var podcast db.Podcast + err:=db.GetPodcastById(searchByIdQuery.Id,&podcast) + if err != nil { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request"}) + } + var podIds []string + podIds = append(podIds, searchByIdQuery.Id) + items := *service.GetAllPodcastItemsByPodcastIds(podIds) + + description := podcast.Summary + title := podcast.Title + + if err == nil { + c.XML(200, createRss(items, title, description, c)) + } + } else { + c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid request"}) + } +} func GetRssForTagById(c *gin.Context) { var searchByIdQuery SearchByIdQuery if c.ShouldBindUri(&searchByIdQuery) == nil { diff --git a/main.go b/main.go index 0fcdbe0..426c820 100644 --- a/main.go +++ b/main.go @@ -159,6 +159,7 @@ func main() { router.DELETE("/podcasts/:id/podcast", controllers.DeleteOnlyPodcastById) router.GET("/podcasts/:id/pause", controllers.PausePodcastById) router.GET("/podcasts/:id/unpause", controllers.UnpausePodcastById) + router.GET("/podcasts/:id/rss", controllers.GetRssForPodcastById) router.GET("/podcastitems", controllers.GetAllPodcastItems) router.GET("/podcastitems/:id", controllers.GetPodcastItemById) From 25df997d306d7ee544c53cd79510bf164135c80b Mon Sep 17 00:00:00 2001 From: Akhil Gupta Date: Mon, 4 Oct 2021 13:05:35 +0530 Subject: [PATCH 3/3] fix volume issue --- client/player.html | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/client/player.html b/client/player.html index 27f8329..f0790f2 100644 --- a/client/player.html +++ b/client/player.html @@ -953,21 +953,12 @@ div#large-visualization{ "autoplay": true, "volume":volume, "callbacks": { - // 'song_change':function(){ - // song = Amplitude.getActiveSongMetadata(); - // if(self.songLoaded.indexOf(song.id)!==-1){ - // return; - // } - // time= self.getSavedSongTime(); - // console.log('change',time) - // if(time>0){ - // self.songLoaded.push(song.id); - // Amplitude.skipTo(time,song.index); - // setTimeout(() => { - // self.songLoaded=self.songLoaded.splice(self.songLoaded.indexOf(song.id),1) - // }, 500); - // } - // }, + 'song_change':function(){ + if(localStorage && localStorage.playerVolume){ + volume=parseInt(localStorage.playerVolume) + Amplitude.setVolume(volume); + } + }, 'timeupdate':function(){ var secs=Math.floor(Amplitude.getSongPlayedSeconds());
Current Version 2021.09.20 2021.10.01
Website