diff --git a/components/tvshows/details-list.brs b/components/tvshows/details-list.brs
new file mode 100644
index 00000000..b408ec38
--- /dev/null
+++ b/components/tvshows/details-list.brs
@@ -0,0 +1,54 @@
+sub init()
+ m.title = m.top.findNode("title")
+ m.title.text = "Loading..."
+end sub
+
+function itemContentChanged() as void
+ item = m.top.itemContent
+ itemData = item.json
+ m.top.findNode("title").text = item.title
+ m.top.findNode("poster").uri = item.posterURL
+ m.top.findNode("overview").text = item.overview
+
+ if type(itemData.RunTimeTicks) = "LongInteger"
+ m.top.findNode("runtime").text = stri(getRuntime()) + " mins"
+ m.top.findNode("endtime").text = "Ends at " + getEndTime()
+ end if
+ if itemData.communityRating <> invalid then
+ m.top.findNode("communityRating").text = str(int(itemData.communityRating*10)/10)
+ end if
+end function
+
+function getRuntime() as integer
+ itemData = m.top.itemContent.json
+
+ ' A tick is .1ms, so 1/10,000,000 for ticks to seconds,
+ ' then 1/60 for seconds to minutess... 1/600,000,000
+ return int(itemData.RunTimeTicks / 600000000.0)
+end function
+
+function getEndTime() as string
+ itemData = m.top.itemContent.json
+ date = CreateObject("roDateTime")
+ duration_s = int(itemData.RunTimeTicks / 10000000.0)
+ date.fromSeconds(date.asSeconds() + duration_s)
+ date.toLocalTime()
+ hours = date.getHours()
+ meridian = "AM"
+ if hours = 0
+ hours = 12
+ meridian = "AM"
+ else if hours = 12
+ hours = 12
+ meridian = "PM"
+ else if hours > 12
+ hours = hours - 12
+ meridian = "PM"
+ end if
+ minutes = stri(date.getMinutes()).trim()
+ if val(minutes) > 10
+ minutes= "0" + minutes
+ end if
+
+ return Substitute("{0}:{1} {2}", stri(hours).trim(), stri(date.getMinutes()).trim(), meridian)
+end function
diff --git a/components/tvshows/details-list.xml b/components/tvshows/details-list.xml
new file mode 100644
index 00000000..85c6d56f
--- /dev/null
+++ b/components/tvshows/details-list.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/tvshows/episode.brs b/components/tvshows/episode.brs
deleted file mode 100644
index a6b0cf7b..00000000
--- a/components/tvshows/episode.brs
+++ /dev/null
@@ -1,7 +0,0 @@
-sub init()
- m.top.overhangTitle = "Season"
-end sub
-
-sub setSeason()
- m.top.overhangTitle = m.top.seasonData.name
-end sub
\ No newline at end of file
diff --git a/components/tvshows/episodes.brs b/components/tvshows/episodes.brs
new file mode 100644
index 00000000..6b8247b2
--- /dev/null
+++ b/components/tvshows/episodes.brs
@@ -0,0 +1,7 @@
+sub init()
+ m.top.overhangTitle = "Season"
+end sub
+
+sub setSeason()
+ m.top.overhangTitle = m.top.seasonData.SeriesName + " - " + m.top.seasonData.name
+end sub
diff --git a/components/tvshows/episodes.xml b/components/tvshows/episodes.xml
index d5b22a54..4062865b 100644
--- a/components/tvshows/episodes.xml
+++ b/components/tvshows/episodes.xml
@@ -1,12 +1,12 @@
-
+
-
+
-
+
diff --git a/components/tvshows/rowlist-episode.brs b/components/tvshows/rowlist-episode.brs
index b586937c..2e15d47a 100644
--- a/components/tvshows/rowlist-episode.brs
+++ b/components/tvshows/rowlist-episode.brs
@@ -1,67 +1,66 @@
sub init()
- m.top.itemComponentName = "ListPoster"
+ m.top.itemComponentName = "TVListDetails"
+ m.top.content = setData()
- m.top.rowFocusAnimationStyle = "floatingFocus"
+ m.top.rowFocusAnimationStyle = "floatingFocus"
- updateSize()
-
- m.top.setFocus(true)
+ m.top.showRowLabel = [false]
+
+ updateSize()
+
+ m.top.setFocus(true)
end sub
sub updateSize()
- m.top.numRows = 1
- m.top.rowSize = 3
+ m.top.numRows = 1
+ m.top.itemsPerRow = 1
- dimensions = m.top.getScene().currentDesignResolution
+ dimensions = m.top.getScene().currentDesignResolution
- border = 75
- m.top.translation = [border, border + 115]
+ border = 75
+ m.top.translation = [border, border + 115]
- textHeight = 80
- itemWidth = (dimensions["width"] - border*2) / m.top.rowSize
- itemHeight = itemWidth * dimensions["height"]/ dimensions["width"] + textHeight
+ textHeight = 80
+ itemWidth = (dimensions["width"] - border*2)
+ itemHeight = 300
- m.top.visible = true
+ m.top.visible = true
- m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
- m.top.itemSpacing = [ 0, 10 ]
+ ' Size of the individual rows
+ m.top.itemSize = [dimensions["width"] - border*2, itemHeight]
+ ' Spacing between Rows
+ m.top.itemSpacing = [ 0, 40]
- m.top.rowItemSize = [ itemWidth, itemHeight ]
- m.top.rowItemSpacing = [ 0, 0 ]
-
-
- episodeData = m.top.TVEpisodeData
-
- if episodeData = invalid then return
-
- rowsize = m.top.rowSize
-
- n = episodeData.items.count()
-
- ' Test for no remainder
- if int(n/rowsize) = n/rowsize then
- m.top.numRows = n/rowsize
- else
- m.top.numRows = n/rowsize + 1
- end if
+ ' Size of items in the row
+ m.top.rowItemSize = [ itemWidth, itemHeight ]
+ ' Spacing between items in the row
+ m.top.rowItemSpacing = [ 20, 0 ]
end sub
-function getData()
- if m.top.TVEpisodeData = invalid then
- data = CreateObject("roSGNode", "ContentNode")
- return data
- end if
-
- updateSize()
-
- episodeData = m.top.TVEpisodeData
- rowsize = m.top.rowSize
- data = CreateObject("roSGNode", "ContentNode")
- row = data.CreateChild("ContentNode")
- row.title = "Episodes"
- for each item in episodeData.items
- row.appendChild(item)
- end for
- m.top.content = data
- return data
+function setupRows()
+ updateSize()
+ objects = m.top.objects
+ m.top.numRows = objects.items.count()
+ m.top.content = setData()
+end function
+
+function setData()
+ data = CreateObject("roSGNode", "ContentNode")
+ if m.top.objects = invalid then
+ ' Return an empty node just to return something; we'll update once we have data
+ return data
+ end if
+
+ for each item in m.top.objects.items
+ row = data.CreateChild("ContentNode")
+ row.appendChild(item)
+ end for
+
+ return data
+end function
+
+function onKeyEvent(key as string, press as boolean) as boolean
+ if not press then return false
+
+ return false
end function
diff --git a/components/tvshows/rowlist-episode.xml b/components/tvshows/rowlist-episode.xml
index 9fdedf25..dfb31695 100644
--- a/components/tvshows/rowlist-episode.xml
+++ b/components/tvshows/rowlist-episode.xml
@@ -1,8 +1,9 @@
-
-
+
+
+
diff --git a/source/ShowScenes.brs b/source/ShowScenes.brs
index 2b3f1386..7f891b09 100644
--- a/source/ShowScenes.brs
+++ b/source/ShowScenes.brs
@@ -198,7 +198,6 @@ end function
function CreateMovieDetailsGroup(movie)
group = CreateObject("roSGNode", "MovieDetails")
-
movie = ItemMetaData(movie.id)
group.itemContent = movie
@@ -243,7 +242,7 @@ end function
function CreateSeasonDetailsGroup(series, season)
group = CreateObject("roSGNode", "TVEpisodes")
- group.seasonData = TVSeasons(series.id)
+ group.seasonData = ItemMetaData(season.id)
group.objects = TVEpisodes(series.id, season.id)
group.observeField("episodeSelected", m.port)
diff --git a/source/api/Items.brs b/source/api/Items.brs
index 7fcd7630..a5528973 100644
--- a/source/api/Items.brs
+++ b/source/api/Items.brs
@@ -131,7 +131,7 @@ function ItemList(library_id = invalid as string, params = {})
tmp.json = item
results.push(tmp)
else
- print item.type
+ print "Items.brs::ItemList received unhandled type: " item.type
' Otherwise we just stick with the JSON
results.push(item)
end if
@@ -165,8 +165,13 @@ function ItemMetaData(id as string)
tmp.image = PosterImage(data.id)
tmp.json = item
return tmp
+ else if data.type = "Season"
+ tmp = CreateObject("roSGNode", "TVSeasonData")
+ tmp.image = PosterImage(data.id)
+ tmp.json = data
+ return tmp
else
- print data.type
+ print "Items.brs::ItemMetaData processed unhandled type: " data.type
' Return json if we don't know what it is
return data
end if
@@ -202,13 +207,14 @@ function TVEpisodes(show_id as string, season_id as string)
data = getJson(resp)
results = []
for each item in data.Items
- imgParams = { "AddPlayedIndicator": item.UserData.Played }
+ imgParams = { "AddPlayedIndicator": item.UserData.Played, "maxWidth": 712, "maxheight": 400 }
tmp = CreateObject("roSGNode", "TVEpisodeData")
tmp.image = PosterImage(item.id, imgParams)
if tmp.image <> invalid
tmp.image.posterDisplayMode = "scaleToFit"
end if
tmp.json = item
+ tmp.overview = ItemMetaData(item.id).overview
results.push(tmp)
end for
data.Items = results