Some code cleanup.

This commit is contained in:
gmemstr 2017-09-11 10:10:35 -07:00
parent 07525d643d
commit 0a20d53655
4 changed files with 29 additions and 6 deletions

View file

@ -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)

View file

@ -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"
}

View file

@ -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" {
}
}

View file

@ -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")},