Skip to content

Commit 7dc2dc1

Browse files
committed
Display ending episode # on details when it spans multiple episode #
1 parent 1d99cb4 commit 7dc2dc1

File tree

7 files changed

+39
-7
lines changed

7 files changed

+39
-7
lines changed

components/data/ImageData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<interface>
44
<field id="json" type="assocarray" onChange="setFields" />
55
<field id="imagetype" type="string" />
6+
<field id="posterdisplaymode" type="string" />
67
<field id="size" type="string" />
78
<field id="height" type="integer" />
89
<field id="width" type="integer" />

components/extras/ExtrasItem.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<LayoutGroup layoutDirection="vert">
55
<Poster id="posterImg" width="234" height="300" translation="[8,243]" failedBitmapUri="pkg:/images/baseline_person_white_48dp.png" />
66
<ScrollingLabel id="pLabel"
7-
horizAlign="center" vertAlign="bottom"
7+
horizAlign="left" vertAlign="bottom"
88
height="48"
99
font="font:SmallestBoldSystemFont" repeatCount="0" />
1010
<ScrollingLabel id="SubTitle"
11-
horizAlign="center" vertAlign="center"
11+
horizAlign="left" vertAlign="center"
1212
height="32"
1313
font="font:SmallestBoldSystemFont" color="#A7A7A7FF" repeatCount="0" />
1414
</LayoutGroup>

components/extras/ExtrasRowList.bs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,18 @@ sub onSeasonOfEpisodesLoaded()
5555
header += ` ${data[0].json.ParentIndexNumber}`
5656
end if
5757

58-
if m.top.episodeNumber > 0
59-
for i = 1 to m.top.episodeNumber - 1
58+
' We can't simply use the episode index due to combination episodes
59+
shiftAmount = 0
60+
if isValidAndNotEmpty(m.top.episodeID)
61+
for each episode in data
62+
if isStringEqual(m.top.episodeID, episode.json.LookupCI("id")) then exit for
63+
shiftAmount++
64+
end for
65+
end if
66+
67+
' Shift episodes array so the selected episode is displayed first
68+
if shiftAmount > 0
69+
for i = 0 to shiftAmount - 1
6070
itemToMove = data.Shift()
6171
data.push(itemToMove)
6272
end for
@@ -224,7 +234,13 @@ function buildRow(rowTitle as string, items, imgWdth = 0)
224234
if LCase(mov.json.type) = VideoType.EPISODE
225235
if isAllValid([mov.json.SeriesName, mov.json.ParentIndexNumber, mov.json.IndexNumber, mov.json.Name])
226236
mov.labelText = mov.json.SeriesName
227-
mov.subTitle = `S${mov.json.ParentIndexNumber}:E${mov.json.IndexNumber} - ${mov.json.Name}`
237+
238+
endingEpisode = ""
239+
if isValid(mov.json.LookupCI("indexNumberEnd"))
240+
endingEpisode = `-${mov.json.LookupCI("indexNumberEnd")}`
241+
end if
242+
243+
mov.subTitle = `S${mov.json.ParentIndexNumber}:E${mov.json.IndexNumber}${endingEpisode} - ${mov.json.Name}`
228244
else
229245
mov.labelText = mov.json.Name
230246
mov.subTitle = mov.json.ProductionYear

components/extras/ExtrasRowList.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<field id="hasItems" type="boolean" />
77
<field id="parentId" type="string" />
88
<field id="showID" type="string" />
9-
<field id="episodeNumber" type="Integer" />
9+
<field id="episodeID" type="string" />
1010
<field id="seasonID" type="string" />
1111
<field id="focusedItem" type="node" alwaysNotify="true" />
1212
<field id="selectedItem" type="node" alwaysNotify="true" />

components/home/LoadItemsTask.bs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function loadLatestMedia() as object
7474
SeriesName: item.LookupCI("SeriesName"),
7575
ParentIndexNumber: item.LookupCI("ParentIndexNumber"),
7676
IndexNumber: item.LookupCI("IndexNumber"),
77+
IndexNumberEnd: item.LookupCI("IndexNumberEnd"),
7778
AlbumArtist: item.LookupCI("AlbumArtist"),
7879
Status: item.LookupCI("Status"),
7980
ImageTags: item.LookupCI("ImageTags"),
@@ -122,6 +123,7 @@ function loadContinueWatching() as object
122123
EndDate: item.LookupCI("EndDate"),
123124
ParentIndexNumber: item.LookupCI("ParentIndexNumber"),
124125
IndexNumber: item.LookupCI("IndexNumber"),
126+
IndexNumberEnd: item.LookupCI("IndexNumberEnd"),
125127
OfficialRating: item.LookupCI("OfficialRating"),
126128
CollectionType: item.LookupCI("CollectionType"),
127129
ImageTags: item.LookupCI("ImageTags"),
@@ -160,6 +162,7 @@ function loadSeasonOfEpisodes() as object
160162
IndexNumber: item.json.LookupCI("IndexNumber"),
161163
Name: item.json.LookupCI("Name"),
162164
ParentIndexNumber: item.json.LookupCI("ParentIndexNumber"),
165+
IndexNumberEnd: item.json.LookupCI("IndexNumberEnd"),
163166
ProductionYear: item.json.LookupCI("ProductionYear"),
164167
SeriesName: item.json.LookupCI("SeriesName"),
165168
EndDate: item.json.LookupCI("EndDate"),
@@ -200,6 +203,7 @@ function loadContinueListening() as object
200203
Status: item.LookupCI("Status"),
201204
EndDate: item.LookupCI("EndDate"),
202205
ParentIndexNumber: item.LookupCI("ParentIndexNumber"),
206+
IndexNumberEnd: item.LookupCI("IndexNumberEnd"),
203207
IndexNumber: item.LookupCI("IndexNumber"),
204208
OfficialRating: item.LookupCI("OfficialRating"),
205209
CollectionType: item.LookupCI("CollectionType"),
@@ -307,6 +311,7 @@ function loadLiveTVOnNow() as object
307311
Album: item.LookupCI("Album"),
308312
SeriesName: item.LookupCI("SeriesName"),
309313
ParentIndexNumber: item.LookupCI("ParentIndexNumber"),
314+
IndexNumberEnd: item.LookupCI("IndexNumberEnd"),
310315
IndexNumber: item.LookupCI("IndexNumber"),
311316
AlbumArtist: item.LookupCI("AlbumArtist"),
312317
Status: item.LookupCI("Status"),
@@ -432,6 +437,7 @@ function loadFavorites() as object
432437
Status: item.LookupCI("Status"),
433438
EndDate: item.LookupCI("EndDate"),
434439
ParentIndexNumber: item.LookupCI("ParentIndexNumber"),
440+
IndexNumberEnd: item.LookupCI("IndexNumberEnd"),
435441
IndexNumber: item.LookupCI("IndexNumber"),
436442
OfficialRating: item.LookupCI("OfficialRating"),
437443
CollectionType: item.LookupCI("CollectionType"),
@@ -477,6 +483,7 @@ function loadItemsByPerson(videoType, dimens = {}) as object
477483
IndexNumber: item.LookupCI("IndexNumber"),
478484
Name: item.LookupCI("Name"),
479485
ParentIndexNumber: item.LookupCI("ParentIndexNumber"),
486+
IndexNumberEnd: item.LookupCI("IndexNumberEnd"),
480487
ProductionYear: item.LookupCI("ProductionYear"),
481488
SeriesName: item.LookupCI("SeriesName"),
482489
EndDate: item.LookupCI("EndDate"),

components/movies/MovieDetails.bs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ sub itemContentChanged()
257257
if isvalid(m.extrasGrid)
258258
m.extrasGrid.seasonID = item.seasonID
259259
m.extrasGrid.showID = item.showID
260-
m.extrasGrid.episodeNumber = item.json.IndexNumber
260+
m.extrasGrid.episodeID = item.id
261261
end if
262262

263263
if not isChainValid(item, "json")
@@ -422,6 +422,10 @@ sub addEpisodeTitle(itemData as object)
422422
titleText = `Season ${itemData.ParentIndexNumber} Episode ${itemData.IndexNumber}`
423423
end if
424424

425+
if isValid(itemData.LookupCI("indexNumberEnd"))
426+
titleText += `-${itemData.LookupCI("indexNumberEnd")}`
427+
end if
428+
425429
if isValid(itemData.name)
426430
if titleText <> "" then titleText += " • "
427431
titleText += itemData.name

source/static/whatsNew/1.0.9.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
"description": "Create way to navigate between episodes on the detail view",
2424
"author": "1hitsong"
2525
},
26+
{
27+
"description": "Display ending episode number on detail view when episode spans more than one episode number",
28+
"author": "1hitsong"
29+
},
2630
{
2731
"description": "Redesign sign in screen",
2832
"author": "1hitsong"

0 commit comments

Comments
 (0)