From 0a20d536555f9d192f14929986a0810f8d05ca0f Mon Sep 17 00:00:00 2001 From: gmemstr Date: Mon, 11 Sep 2017 10:10:35 -0700 Subject: [PATCH] Some code cleanup. --- README.md | 13 +++++++++++-- config.json | 1 + src/admin.go | 14 +++++++++++++- src/generate_rss.go | 7 ++++--- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9458675..bcf3c61 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# whiterabbit +# white rabbit [![gitgalaxy](https://img.shields.io/badge/website-gitgalaxy.com-blue.svg)](https://gitgalaxy.com) [![shield](https://img.shields.io/badge/live-podcast.gitgalaxy.com-green.svg)](https://podcast.gitgalaxy.com) [![follow](https://img.shields.io/twitter/follow/gitgalaxy.svg?style=social&label=Follow)](https://twitter.com/gitgalaxy) @@ -34,7 +34,7 @@ to produce a product that is easy to deploy and easier to use when hosting a pod ``` make install -make and run +make ./webserver ``` @@ -49,6 +49,15 @@ go build webserver.go generate_rss.go admin.go ./webserver ``` +## file format + +white rabbit uses a flat file structure for managing podcast episodes. as such, files have a special naming convention. + +for podcast audio files, filenames take the form of YEAR-MONTH-DAY followed by the title. The two values are +seperated by underscores (`YYYY-MM-DD_TITLE.mp3`). + +shownote fils are markdown formatted and simply append `_SHOWNOTES.md` to the existing filename (sans .mp3 of course). + ### Makefile there are several commands in the Makefile, for various reasons. (commands are preceded by the `make` command) diff --git a/config.json b/config.json index d58b566..75813f9 100644 --- a/config.json +++ b/config.json @@ -5,6 +5,7 @@ "Name": "Git Galaxy Stargazers", "Host": "Gabriel Simmer", "Email": "gabriel@gitgalaxy.com", + "Description": "open source discussion", "Image": "localhost:8000/assets/podcast_image.png", "PodcastUrl": "http://localhost:8000" } \ No newline at end of file diff --git a/src/admin.go b/src/admin.go index 0e38f6d..cca8dc1 100644 --- a/src/admin.go +++ b/src/admin.go @@ -12,9 +12,10 @@ import ( "strings" "io/ioutil" "io" - "os" + "os" // ioOS? ) +// Write custom CSS to disk or send it back to the client if GET func CustomCss(w http.ResponseWriter, r *http.Request) { if r.Method == "POST" { r.ParseMultipartForm(32 << 20) @@ -93,4 +94,15 @@ func RemoveEpisode(w http.ResponseWriter, r *http.Request) { os.Remove(episode) sn := strings.Replace(episode, ".mp3", "_SHOWNOTES.md", 2) os.Remove(sn) +} + +func EditConfig(w http.ResponseWriter, r *http.Request) { + if r.Method == "POST" { + r.ParseMultipartForm(32 << 20) + + + } + if r.Method == "GET" { + + } } \ No newline at end of file diff --git a/src/generate_rss.go b/src/generate_rss.go index 667ca77..b761743 100644 --- a/src/generate_rss.go +++ b/src/generate_rss.go @@ -32,9 +32,10 @@ func watch() { for { select { case event := <-watcher.Events: - log.Println("event:", event) + // log.Println("event:", event) if event.Op&fsnotify.Write == fsnotify.Write { - log.Println("modified file:", event.Name) + // log.Println("modified file:", event.Name) + log.Println("File up(load/date)ed: ", event.Name) generate_rss() } case err := <-watcher.Errors: @@ -69,7 +70,7 @@ func generate_rss() { feed := &feeds.Feed{ Title: viper.GetString("Name"), Link: &feeds.Link{Href: viper.GetString("PodcastUrl")}, - Description: "discussion about open source projects", + Description: viper.GetString("Description"), Author: &feeds.Author{Name: viper.GetString("Host"), Email:viper.GetString("Email")}, Created: now, Image: &feeds.Image{Url: viper.GetString("Image")},