Skip to content

Commit

Permalink
feat(wait): wait for the server to map with MyPlex in full mode
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-yantsen committed Mar 12, 2023
1 parent 105a2e3 commit 9c72e26
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/plex-cli/src/wait.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::flags;
use plex_api::HttpClientBuilder;
use plex_api::{HttpClientBuilder, ServerMappingState};
use std::time::{Duration, SystemTime};

impl flags::Wait {
Expand All @@ -22,7 +22,13 @@ impl flags::Wait {
let server_result = plex_api::Server::new(host, client.clone()).await;
if let Ok(server) = server_result {
// The `start_state` is None when the server has finished loading.
if server.media_container.start_state.is_none() || !wait_full_start {
if server.media_container.start_state.is_none()
|| matches!(
&server.media_container.my_plex_mapping_state,
ServerMappingState::Unknown | ServerMappingState::Mapped
)
|| !wait_full_start
{
let prefs = server.preferences().await;
if prefs.is_ok() {
println!(
Expand Down

0 comments on commit 9c72e26

Please sign in to comment.