Skip to content

Commit 5402103

Browse files
committed
series tab add bonus video view
1 parent 8d225a7 commit 5402103

File tree

14 files changed

+64
-6
lines changed

14 files changed

+64
-6
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [next]
4+
5+
### Fixed
6+
7+
* add home tab retry dialog when request failed
8+
9+
### Add
10+
11+
* bonus video view for series tab
12+
313
## [0.8.2]
414

515
### Fixed

app/include/tab/media_series.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ class MediaSeries : public brls::Box, public Presenter {
2929
BRLS_BIND(brls::Label, labelGenres, "series/label/genres");
3030
BRLS_BIND(brls::Header, labelNextup, "series/label/nextup");
3131
BRLS_BIND(brls::Header, labelSimilar, "series/label/similar");
32+
BRLS_BIND(brls::Header, labelSpecial, "series/label/special");
3233
BRLS_BIND(HRecyclerFrame, people, "series/people");
3334
BRLS_BIND(HRecyclerFrame, similar, "series/similar");
35+
BRLS_BIND(HRecyclerFrame, special, "series/special");
3436
BRLS_BIND(HRecyclerFrame, nextUp, "series/nextup");
3537
BRLS_BIND(AutoTabFrame, tabFrame, "series/tabFrame");
3638

3739
void doSeries();
3840
void doSeason();
3941
void doSimilar();
4042
void doNextup();
43+
void doSpecial();
4144

4245
std::string seriesId;
4346
};

app/src/tab/media_series.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,14 @@ MediaSeries::MediaSeries(const jellyfin::Item& item) : seriesId(item.Id) {
142142
this->people->registerCell("Cell", MediaCardCell::create);
143143
this->similar->registerCell("Cell", VideoCardCell::create);
144144
this->nextUp->registerCell("Cell", VideoCardCell::create);
145+
this->special->registerCell("Cell", VideoCardCell::create);
145146
this->tabFrame->registerTabAction(this);
146147

147148
this->doSeason();
148149
this->doSeries();
149150
this->doNextup();
150151
this->doSimilar();
152+
this->doSpecial();
151153

152154
// loading Logo
153155
auto logo = item.ImageTags.find(jellyfin::imageTypePrimary);
@@ -284,6 +286,7 @@ void MediaSeries::doSimilar() {
284286
std::string query = HTTP::encode_form({
285287
{"userId", AppConfig::instance().getUserId()},
286288
{"limit", "12"},
289+
{"enableImageTypes", "Primary"},
287290
{"fields", "ItemCounts"},
288291
});
289292

@@ -308,4 +311,28 @@ void MediaSeries::doSimilar() {
308311
brls::Application::notify(ex);
309312
},
310313
jellyfin::apiSimilar, this->seriesId, query);
314+
}
315+
316+
void MediaSeries::doSpecial() {
317+
ASYNC_RETAIN
318+
jellyfin::getJSON<std::vector<jellyfin::Episode>>(
319+
[ASYNC_TOKEN](const std::vector<jellyfin::Episode>& r) {
320+
ASYNC_RELEASE
321+
if (r.size() > 0) {
322+
this->special->setDataSource(new VideoDataSource(r));
323+
this->special->setVisibility(brls::Visibility::VISIBLE);
324+
this->labelSpecial->setVisibility(brls::Visibility::VISIBLE);
325+
} else {
326+
this->special->setVisibility(brls::Visibility::GONE);
327+
this->labelSpecial->setVisibility(brls::Visibility::GONE);
328+
this->special->clearData();
329+
}
330+
},
331+
[ASYNC_TOKEN](const std::string& ex) {
332+
ASYNC_RELEASE
333+
this->special->setVisibility(brls::Visibility::GONE);
334+
this->labelSpecial->setSubtitle(ex);
335+
brls::Application::notify(ex);
336+
},
337+
jellyfin::apiItemSpecial, AppConfig::instance().getUserId(), this->seriesId);
311338
}

app/src/view/video_source.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,16 @@ RecyclingGridItem* VideoDataSource::cellForRow(RecyclingView* recycler, size_t i
5252

5353
if (item.Type == jellyfin::mediaTypeGenre || item.Type == jellyfin::mediaTypeBook) {
5454
cell->labelExt->setVisibility(brls::Visibility::GONE);
55+
} else if (item.Type == jellyfin::mediaTypeVideo || item.ProductionYear == 0) {
56+
cell->labelExt->setText(misc::sec2Time(item.RunTimeTicks / jellyfin::PLAYTICKS));
5557
} else {
56-
cell->labelExt->setText(item.ProductionYear > 0 ? std::to_string(item.ProductionYear) : "");
58+
cell->labelExt->setText(std::to_string(item.ProductionYear));
5759
}
5860

59-
auto it = item.ImageTags.find(jellyfin::imageTypeThumb);
61+
auto it = item.ImageTags.find(jellyfin::imageTypePrimary);
6062
if (it != item.ImageTags.end()) {
61-
Image::load(cell->picture, jellyfin::apiThumbImage, item.Id,
62-
HTTP::encode_form({{"tag", it->second}, {"maxWidth", "325"}}));
63-
} else {
6463
Image::load(cell->picture, jellyfin::apiPrimaryImage, item.Id,
65-
HTTP::encode_form({{"tag", item.ImageTags[jellyfin::imageTypePrimary]}, {"maxWidth", "240"}}));
64+
HTTP::encode_form({{"tag", it->second}, {"maxWidth", "325"}}));
6665
}
6766
}
6867

resources/i18n/cs/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"play": "Přehrát",
6969
"intro": "Přehled/Obsah",
7070
"people": "Lidé",
71+
"special": "Bonusový materiál",
7172
"similar": "Podobné položky",
7273
"date_add": "Data přidání",
7374
"date_played": "Data přehrání",

resources/i18n/en-US/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"play": "Play",
9898
"intro": "Intro",
9999
"people": "People",
100+
"special": "Special Features",
100101
"similar": "More Like This",
101102
"date_add": "Date Add",
102103
"date_played": "Date Played",

resources/i18n/es/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"play": "Reproducir",
9898
"intro": "Introducción",
9999
"people": "Reparto y equipo",
100+
"special": "Características Especiales",
100101
"similar": "Más como esto",
101102
"date_add": "Fecha en que se añadió",
102103
"date_played": "Fecha de reproducción",

resources/i18n/fr/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"play": "Lire",
9898
"intro": "introduire",
9999
"people": "Personnes",
100+
"special": "Bonus",
100101
"similar": "Plus de ce genre",
101102
"date_add": "Date d'ajout",
102103
"date_played": "Date de diffusion",

resources/i18n/ja/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"play": "再生",
9898
"intro": "イントロ",
9999
"people": "ピープル",
100+
"special": "特殊機能",
100101
"similar": "これに似たもの",
101102
"date_add": "追加日",
102103
"date_played": "再生した日付",

resources/i18n/ko/main.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"play": "재생",
9898
"intro": "소개",
9999
"people": "인물",
100+
"special": "부가 영상",
100101
"similar": "비슷한 작품",
101102
"date_add": "추가 날짜",
102103
"date_played": "재생 날짜",

0 commit comments

Comments
 (0)