Skip to content

Commit

Permalink
feat: add actors in item/movie page
Browse files Browse the repository at this point in the history
feat: add overview/links/mediainfo in movie page
fix: some fixes
  • Loading branch information
tsukinaha committed Mar 30, 2024
1 parent 087d0d0 commit 18e6ad6
Show file tree
Hide file tree
Showing 7 changed files with 591 additions and 16 deletions.
33 changes: 33 additions & 0 deletions resources/ui/item.ui
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,39 @@
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="actorrevealer">
<property name="transition-type">crossfade</property>
<property name="transition-duration">700</property>
<property name="reveal-child">False</property>
<child>
<object class="GtkExpander">
<property name="expanded">True</property>
<child type="label">
<object class="GtkLabel">
<property name="label" translatable="yes">Actors</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
<property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="actorscrolled">
<property name="overlay-scrolling">true</property>
<property name="vscrollbar-policy">never</property>
<property name="margin-bottom">3</property>
<child>
<object class="GtkListView" id="actorlist">
<property name="orientation">horizontal</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="overviewrevealer">
<property name="transition-type">crossfade</property>
Expand Down
145 changes: 139 additions & 6 deletions resources/ui/movie.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<property name="hexpand">true</property>
<property name="vexpand">true</property>
<property name="opacity">0.7</property>
<property name="height-request">700</property>
</object>
</child>
<child type="overlay">
Expand Down Expand Up @@ -51,13 +52,145 @@
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="vscrollbar-policy">never</property>
<property name="valign">fill</property>
<property name="margin-bottom">3</property>
<object class="GtkRevealer" id="actorrevealer">
<property name="transition-type">crossfade</property>
<property name="transition-duration">700</property>
<property name="reveal-child">False</property>
<child>
<object class="GtkListView" id="itemlist">
<property name="orientation">horizontal</property>
<object class="GtkExpander">
<property name="expanded">True</property>
<child type="label">
<object class="GtkLabel">
<property name="label" translatable="yes">Actors</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
<property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="actorscrolled">
<property name="overlay-scrolling">true</property>
<property name="vscrollbar-policy">never</property>
<property name="margin-bottom">3</property>
<child>
<object class="GtkListView" id="actorlist">
<property name="orientation">horizontal</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="overviewrevealer">
<property name="transition-type">crossfade</property>
<property name="transition-duration">700</property>
<property name="reveal-child">False</property>
<child>
<object class="GtkExpander">
<property name="expanded">True</property>
<child type="label">
<object class="GtkLabel" id="expander-label">
<property name="label" translatable="yes">Overview</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
<property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<child>
<object class="AdwBin">
<child>
<object class="GtkBox">
<property name="hexpand">False</property>
<property name="width-request">600</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
<property name="halign">start</property>
<property name="label">Season</property>
<property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkInscription" id="itemoverview">
<property name="min-lines">8</property>
<property name="yalign">0.00</property>
<property name="hexpand">true</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="linksrevealer">
<property name="transition-type">crossfade</property>
<property name="transition-duration">700</property>
<property name="reveal-child">False</property>
<child>
<object class="GtkExpander">
<property name="expanded">True</property>
<child type="label">
<object class="GtkLabel">
<property name="label" translatable="yes">Links</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
<property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="linksscrolled">
<property name="overlay-scrolling">true</property>
<property name="vscrollbar-policy">never</property>
<property name="margin-bottom">3</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkRevealer" id="mediainforevealer">
<property name="transition-type">crossfade</property>
<property name="transition-duration">700</property>
<property name="reveal-child">False</property>
<child>
<object class="GtkExpander">
<property name="expanded">True</property>
<child type="label">
<object class="GtkLabel">
<property name="label" translatable="yes">MediaInfo</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
<property name="use-markup">True</property>
</object>
</child>
<child>
<object class="GtkBox" id="mediainfobox">
<property name="orientation">vertical</property>
<property name="spacing">6</property>
</object>
</child>
</object>
</child>
</object>
Expand Down
5 changes: 4 additions & 1 deletion src/ui/moviedrop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ pub fn newmediadropsel(playbackinfo: network::Media, info: SearchResult) -> gtk:
leftvbox.set_margin_bottom(20);
leftvbox.set_halign(gtk::Align::Start);
leftvbox.set_valign(gtk::Align::End);
let label = gtk::Label::new(Some(&info.Name));
let label = gtk::Label::builder()
.label(format!("<b>{}</b>", info.Name))
.use_markup(true)
.build();
leftvbox.append(&label);
hbox.append(&leftvbox);
let vbox = gtk::Box::new(Orientation::Vertical, 5);
Expand Down
15 changes: 13 additions & 2 deletions src/ui/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ pub struct SeriesInfo {
pub UserData: Option<UserData>,
}



pub async fn get_series_info(id: String) -> Result<Vec<SeriesInfo>, Error> {
let server_info = get_server_info();
let client = reqwest::Client::new();
Expand Down Expand Up @@ -336,10 +338,19 @@ pub fn mpv_play_withsub(url: String, suburl: String, name: String) {
let _ = command.spawn().expect("mpv failed to start").wait();
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[derive(Deserialize, Debug, Clone)]
pub struct Item {
pub ExternalUrls: Option<Vec<Urls>>,
pub Overview: Option<String>,
pub People: Option<Vec<People>>,
}

#[derive(Deserialize, Debug, Clone)]
pub struct People {
pub Name: String,
pub Id: String,
pub Role: Option<String>,
pub Type: String,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down Expand Up @@ -464,7 +475,7 @@ pub async fn get_image(id: String) -> Result<String, Error> {
let server_info = get_server_info();

let result = reqwest::get(&format!(
"{}:{}/emby/Items/{}/Images/Primary?maxHeight=300",
"{}:{}/emby/Items/{}/Images/Primary?maxHeight=400",
server_info.domain, server_info.port, id
))
.await;
Expand Down
7 changes: 4 additions & 3 deletions src/ui/new_dropsel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use super::network;
use super::network::SeriesInfo;
use gtk::prelude::*;
use gtk::Orientation;
use gtk::glib;

pub fn newmediadropsel(playbackinfo: network::Media, info: SeriesInfo) -> gtk::Box {
let hbox = gtk::Box::new(Orientation::Horizontal, 5);
Expand All @@ -15,18 +14,20 @@ pub fn newmediadropsel(playbackinfo: network::Media, info: SeriesInfo) -> gtk::B
leftvbox.set_halign(gtk::Align::Start);
leftvbox.set_valign(gtk::Align::End);
let markup = format!(
"<b> Season {} : Episode {} - {} </b>",
info.ParentIndexNumber, info.IndexNumber, info.Name
"<b>{}\n\nSeason {} : Episode {}</b>",
info.Name, info.ParentIndexNumber, info.IndexNumber
);
let label = gtk::Label::new(Some(&info.Name));
label.set_markup(markup.as_str());
label.set_ellipsize(gtk::pango::EllipsizeMode::End);
leftvbox.append(&label);
hbox.append(&leftvbox);
let vbox = gtk::Box::new(Orientation::Vertical, 5);
vbox.set_margin_start(20);
vbox.set_margin_end(80);
vbox.set_margin_bottom(20);
vbox.set_halign(gtk::Align::End);
vbox.set_valign(gtk::Align::End);
vbox.set_hexpand(true);
let namelist = gtk::StringList::new(&[]);

Expand Down
Loading

0 comments on commit 18e6ad6

Please sign in to comment.