mirror of
https://github.com/gmemstr/pogo.git
synced 2024-09-20 01:31:09 +01:00
Some code cleanup.
This commit is contained in:
parent
07525d643d
commit
0a20d53655
13
README.md
13
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)
|
[![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 install
|
||||||
make and run
|
make
|
||||||
./webserver
|
./webserver
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -49,6 +49,15 @@ go build webserver.go generate_rss.go admin.go
|
||||||
./webserver
|
./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
|
### Makefile
|
||||||
|
|
||||||
there are several commands in the Makefile, for various reasons. (commands are preceded by the `make` command)
|
there are several commands in the Makefile, for various reasons. (commands are preceded by the `make` command)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"Name": "Git Galaxy Stargazers",
|
"Name": "Git Galaxy Stargazers",
|
||||||
"Host": "Gabriel Simmer",
|
"Host": "Gabriel Simmer",
|
||||||
"Email": "gabriel@gitgalaxy.com",
|
"Email": "gabriel@gitgalaxy.com",
|
||||||
|
"Description": "open source discussion",
|
||||||
"Image": "localhost:8000/assets/podcast_image.png",
|
"Image": "localhost:8000/assets/podcast_image.png",
|
||||||
"PodcastUrl": "http://localhost:8000"
|
"PodcastUrl": "http://localhost:8000"
|
||||||
}
|
}
|
14
src/admin.go
14
src/admin.go
|
@ -12,9 +12,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"io"
|
"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) {
|
func CustomCss(w http.ResponseWriter, r *http.Request) {
|
||||||
if r.Method == "POST" {
|
if r.Method == "POST" {
|
||||||
r.ParseMultipartForm(32 << 20)
|
r.ParseMultipartForm(32 << 20)
|
||||||
|
@ -94,3 +95,14 @@ func RemoveEpisode(w http.ResponseWriter, r *http.Request) {
|
||||||
sn := strings.Replace(episode, ".mp3", "_SHOWNOTES.md", 2)
|
sn := strings.Replace(episode, ".mp3", "_SHOWNOTES.md", 2)
|
||||||
os.Remove(sn)
|
os.Remove(sn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func EditConfig(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if r.Method == "POST" {
|
||||||
|
r.ParseMultipartForm(32 << 20)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if r.Method == "GET" {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,9 +32,10 @@ func watch() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case event := <-watcher.Events:
|
case event := <-watcher.Events:
|
||||||
log.Println("event:", event)
|
// log.Println("event:", event)
|
||||||
if event.Op&fsnotify.Write == fsnotify.Write {
|
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()
|
generate_rss()
|
||||||
}
|
}
|
||||||
case err := <-watcher.Errors:
|
case err := <-watcher.Errors:
|
||||||
|
@ -69,7 +70,7 @@ func generate_rss() {
|
||||||
feed := &feeds.Feed{
|
feed := &feeds.Feed{
|
||||||
Title: viper.GetString("Name"),
|
Title: viper.GetString("Name"),
|
||||||
Link: &feeds.Link{Href: viper.GetString("PodcastUrl")},
|
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")},
|
Author: &feeds.Author{Name: viper.GetString("Host"), Email:viper.GetString("Email")},
|
||||||
Created: now,
|
Created: now,
|
||||||
Image: &feeds.Image{Url: viper.GetString("Image")},
|
Image: &feeds.Image{Url: viper.GetString("Image")},
|
||||||
|
|
Loading…
Reference in a new issue