From 4decbd425cadeb5e6e652c3f0fb3a8a3103e940c Mon Sep 17 00:00:00 2001 From: Dan Anstis Date: Sat, 28 Oct 2017 12:20:28 +1100 Subject: [PATCH] Refresh Shows on Hompage reload (#53) * Add function to refresh shows for the home page * Bump version * Update changelog * Update to build process Fixes #50 --- .appveyor.yml | 2 +- CHANGELOG.md | 6 +++++- plex/version.go | 2 +- webui/handlers.go | 10 ++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 9aa221b..5f5d418 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -20,7 +20,7 @@ before_build: - goverage -v .\... - dir *.out - echo %APPVEYOR_REPO_COMMIT% - - godacov -t %CODACY_TOKEN% -r coverage.out -c %APPVEYOR_REPO_COMMIT% + - ps: Invoke-Expression -Command "godacov -t $env:CODACY_TOKEN -r coverage.out -c $env:APPVEYOR_REPO_COMMIT" -ErrorAction "SilentlyContinue" - go tool cover -func coverage.out build_script: diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fb647a..1a100ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] +### Changed +- Refresh shows when reloading the WebUI homepage. + ## [v0.3.3] ### Added - Script to bump version using GitVersion. @@ -47,7 +51,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Spaces in TV Show names cause errors. [unreleased]: https://github.com/danstis/Plex-Sync/compare/v0.3.3...HEAD -[v0.3.2]: https://github.com/danstis/Plex-Sync/compare/v0.3.1...v0.3.3 +[v0.3.3]: https://github.com/danstis/Plex-Sync/compare/v0.3.1...v0.3.3 [v0.3.1]: https://github.com/danstis/Plex-Sync/compare/v0.3.0...v0.3.1 [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 diff --git a/plex/version.go b/plex/version.go index 3628b56..3ac7230 100644 --- a/plex/version.go +++ b/plex/version.go @@ -1,4 +1,4 @@ package plex // Version contains the version of the app. -const Version = "0.3.5-ci.1" +const Version = "0.3.5-refresh-shows-onreload-homepage.4" diff --git a/webui/handlers.go b/webui/handlers.go index 68303fe..e39552d 100644 --- a/webui/handlers.go +++ b/webui/handlers.go @@ -25,9 +25,19 @@ var v = PageData{ Shows: ss, } +// refreshShows updates the PageData with the latest shows. +func refreshShows() { + ss, _ = plex.SelectedShows() + v = PageData{ + Version: plex.Version, + Shows: ss, + } +} + // RootHandler returns the default page. func rootHandler(w http.ResponseWriter, r *http.Request) { tmpl := template.Must(template.ParseFiles(path.Join("webui", "templates", "index.html"))) + refreshShows() tmpl.Execute(w, v) }