diff --git a/rest/templates/list.gohtml b/rest/templates/list.gohtml
index d0caa8e..212308b 100644
--- a/rest/templates/list.gohtml
+++ b/rest/templates/list.gohtml
@@ -47,66 +47,78 @@
- {{if .Continue}}
-
- {{template "plus_icon"}}Continue
-
- {{range .Continue}}
- - {{template "video" .}}
- {{end}}
-
-
- {{end}}
-
- {{if .Videos}}
-
- {{template "plus_icon"}}Videos
-
- {{range .Videos}}
- - {{template "video" .}}
- {{end}}
-
-
- {{end}}
-
- {{if .Playlists}}
-
- {{template "plus_icon"}}Playlists
-
- {{$playlists := .Playlists}}
- {{range $ii, $playlistSection := .PlaylistsOrder}}
-
- {{template "plus_icon"}}{{$playlistSection}}
-
- {{$playlist := index $playlists $playlistSection}}
- {{range $playlist}}
- {{template "playlist" .}}
- {{end}}
-
-
- {{end}}
-
-
-
- {{end}}
-
- {{if .Downloads}}
-
- {{template "plus_icon"}}Downloads
-
- {{range .Downloads}}
- - {{template "video" .}}
- {{end}}
-
-
- {{end}}
-
- {{if .HasHistory}}
-
- {{template "plus_icon"}}History
- Check out your watch history
-
- {{end}}
+ {{if .Continue}}
+
+ {{template "plus_icon"}}Continue
+
+ {{range .Continue}}
+ - {{template "video" .}}
+ {{end}}
+
+
+ {{end}}
+
+ {{if .Videos}}
+
+ {{template "plus_icon"}}Videos
+
+ {{range .Videos}}
+ - {{template "video" .}}
+ {{end}}
+
+
+ {{end}}
+
+ {{if .Playlists}}
+
+ {{template "plus_icon"}}Playlists
+
+ {{$playlists := .Playlists}}
+ {{range $ii, $playlistSection := .PlaylistsOrder}}
+
+ {{template "plus_icon"}}
+ {{$playlistSection}}
+
+ {{$playlist := index $playlists $playlistSection}}
+ {{range $playlist}}
+ {{template "playlist" .}}
+ {{end}}
+
+
+ {{end}}
+
+
+
+ {{end}}
+
+ {{if .Downloads}}
+
+ {{template "plus_icon"}}Downloads
+
+ {{range .Downloads}}
+ - {{template "video" .}}
+ {{end}}
+
+
+ {{end}}
+
+ {{if .Favorites}}
+
+ {{template "plus_icon"}}Favorites
+
+ {{range .Favorites}}
+ - {{template "video" .}}
+ {{end}}
+
+
+ {{end}}
+
+ {{if .HasHistory}}
+
+ {{template "plus_icon"}}History
+ Check out your watch history
+
+ {{end}}
diff --git a/rest/view_models/list_view_model.go b/rest/view_models/list_view_model.go
index 29b666b..464ffd1 100644
--- a/rest/view_models/list_view_model.go
+++ b/rest/view_models/list_view_model.go
@@ -12,6 +12,7 @@ type ListViewModel struct {
Downloads []*VideoViewModel
PlaylistsOrder []string
Playlists map[string][]*PlaylistViewModel
+ Favorites []*VideoViewModel
HasHistory bool
}
@@ -52,6 +53,7 @@ func GetListViewModel(rdx kvas.ReadableRedux) (*ListViewModel, error) {
// videos is all downloaded videos that are not:
// - in history (ended)
// - in continue (have progress)
+ // - is favorite
// - in any auto-refreshing playlist
dcKeys := rdx.Keys(data.VideoDownloadCompletedProperty)
if len(dcKeys) > 0 {
@@ -66,6 +68,9 @@ func GetListViewModel(rdx kvas.ReadableRedux) (*ListViewModel, error) {
if rdx.HasKey(data.VideoProgressProperty, id) {
continue
}
+ if rdx.HasKey(data.VideoFavoriteProperty, id) {
+ continue
+ }
skip := false
for _, playlistId := range rdx.Keys(data.PlaylistAutoRefreshProperty) {
@@ -159,6 +164,19 @@ func GetListViewModel(rdx kvas.ReadableRedux) (*ListViewModel, error) {
}
}
+ fvKeys := rdx.Keys(data.VideoFavoriteProperty)
+ fvKeys, err = rdx.Sort(fvKeys, false, data.VideoTitleProperty)
+ if err != nil {
+ return nil, err
+ }
+
+ for _, id := range fvKeys {
+ lvm.Favorites = append(lvm.Favorites, GetVideoViewModel(id, rdx,
+ ShowPoster,
+ ShowDuration,
+ ShowPublishedDate))
+ }
+
lvm.HasHistory = len(rdx.Keys(data.VideoEndedDateProperty)) > 0
return lvm, nil