-
Notifications
You must be signed in to change notification settings - Fork 0
/
podman.go
executable file
·68 lines (61 loc) · 1.56 KB
/
podman.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"flag"
"os/user"
"time"
)
// Podcast Holds one podcast
type Podcast struct {
ArtistName string
CollectionName string
FeedURL string
Description string
}
// PodcastEpisode Holds one episode of a podcast
type PodcastEpisode struct {
// The title of the podcast according to ITunes
PodcastTitle string
Title string
Summary string
Link string
Content string
GUID string
StorageLocation string
}
// CachedPodcast a struct that holds podcasts cached in memory/on disk
type CachedPodcast struct {
Type Podcast
Podcasts []PodcastEpisode
Checked time.Time
}
// ItunesSearch returns an array of podcasts that are found by itunes
type ItunesSearch struct {
Results []Podcast
}
// PodcastEpisodeSlice takes a slice of a list of podcasts
type PodcastEpisodeSlice []PodcastEpisode
func main() {
//get users home dir, the default storage
// TODO fix this to work on Windows + to be not a mess
defaultStorage := "."
usr, err := user.Current()
//if no error, store in home directory
if err == nil {
defaultStorage = usr.HomeDir + "/.config/podman"
}
//read config file
configuration := CreateDefault()
configuration.StorageLocation = defaultStorage
readConfig(&configuration)
//read command line flags
noTui := flag.Bool("no-tui", false, "Select whether to use the GUI or not")
flag.Parse()
// Start up the global player
StartPlayer(&configuration)
//made a decision to use TUI or not
if *noTui == true {
RunCui(&configuration)
} else {
StartTui(&configuration)
}
}