diff --git a/CHANGELOG.md b/CHANGELOG.md index b3f741b..b89fa60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [v0.3.0] +### Added +- Show selected shows on home page. +- Version to WebUI pages. ## [v0.2.0] ### Added @@ -32,6 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - App would attempt to sync even if a token was not obtained. - Spaces in TV Show names cause errors. -[unreleased]: https://github.com/danstis/Plex-Sync/compare/v0.2.0...HEAD +[unreleased]: https://github.com/danstis/Plex-Sync/compare/v0.3.0...HEAD +[v0.3.0]: https://github.com/danstis/Plex-Sync/compare/v0.2.0...v0.3.0 [v0.2.0]: https://github.com/danstis/Plex-Sync/compare/v0.1.0...v0.2.0 [v0.1.0]: https://github.com/danstis/Plex-Sync/compare/v0.0.1...v0.1.0 diff --git a/plex/server.go b/plex/server.go index 0091f00..8f1baeb 100644 --- a/plex/server.go +++ b/plex/server.go @@ -13,11 +13,11 @@ import ( // Host defines the data to be stored for server objects type Host struct { - Name string - Hostname string - Port int - Ssl bool - Token string + Name string + Hostname string + Port int + Ssl bool + Token string } var ( @@ -99,7 +99,7 @@ func SyncWatchedTv(source, destination Host) error { log.Printf("Syncing watched Tv Shows from %q to %q", source.Name, destination.Name) // Return all selected shows - ss, err := selectedShows() + ss, err := SelectedShows() if err != nil { return err } @@ -151,8 +151,8 @@ func SyncWatchedTv(source, destination Host) error { return nil } -// selectedShows returns the selected tv shows from the tvShowsFile -func selectedShows() ([]string, error) { +// SelectedShows returns the selected tv shows from the tvShowsFile +func SelectedShows() ([]string, error) { file, err := os.Open(tvShowFile) if err != nil { return nil, fmt.Errorf("failed to open tvshows file %q", tvShowFile) diff --git a/plex/server_test.go b/plex/server_test.go index 2923a8d..0a74460 100644 --- a/plex/server_test.go +++ b/plex/server_test.go @@ -85,7 +85,7 @@ func Test_selectedShows(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := selectedShows() + got, err := SelectedShows() if (err != nil) != tt.wantErr { t.Errorf("selectedShows() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/webui/handlers.go b/webui/handlers.go index eb9e380..68303fe 100644 --- a/webui/handlers.go +++ b/webui/handlers.go @@ -13,12 +13,17 @@ import ( "github.com/danstis/Plex-Sync/plex" ) -// VersionInfo defines a struct to store the current version information. -type VersionInfo struct { +// PageData defines a struct to store the current version information. +type PageData struct { Version string + Shows []string } -var v = VersionInfo{Version: plex.Version} +var ss, _ = plex.SelectedShows() +var v = PageData{ + Version: plex.Version, + Shows: ss, +} // RootHandler returns the default page. func rootHandler(w http.ResponseWriter, r *http.Request) { diff --git a/webui/templates/index.html b/webui/templates/index.html index d58b835..2aa21bc 100644 --- a/webui/templates/index.html +++ b/webui/templates/index.html @@ -55,8 +55,12 @@
-

Plex-Sync

-

Some text in here...

+

Welcome to Plex-Sync

+ {{if .Shows}} +

Selected Shows:

+ {{range .Shows}} +

{{.}}

+ {{end}} {{end}}