~nature/yt-cli

bf35500e46564af340f7b8737b7e8ecde114e524 — LordNature 1 year, 5 months ago df71c45
main.go: List all videos to stdout for wrapper.
1 files changed, 7 insertions(+), 12 deletions(-)

M main.go
M main.go => main.go +7 -12
@@ 72,7 72,6 @@ func main() {
	var list = flag.Bool("list", false, "List all videos from subscriptions.")
	flag.Parse()


	// Print usage if no arguments
	if len(os.Args[1:]) == 0 {
		flag.Usage()


@@ 95,7 94,7 @@ func main() {
		}
	}

	// List all channels' videos
	// List all channels' videos to stdout
	if *list == true {
		subs, _ := readSubs()
		for _, k := range subs {


@@ 103,22 102,18 @@ func main() {
			if err != nil {
				panic(err)
			}
			channels = append(channels, ch)
		}
		vid, err := listVideos(channels)
		if err != nil {
			panic(err)
		}
		err = playVideo(vid)
		if err != nil {
			panic(err)
			for i, v := range ch.Videos {
				if i > 4 { break }
				fmt.Printf("[%.10s] %.20s - %.50s\n", v.Date, ch.Name, v.Title)
			}
		}
	}

	// Get videoID from formatted title
}

// Appends subscription to file
func addSub(id string) (err error) {
	fmt.Println(CONFIG_DIR)
	// Open file in append mode only
	file, err := os.OpenFile(CONFIG_DIR + "/channels", os.O_APPEND|os.O_WRONLY, 0600)
	if err != nil {