diff options
| author | Jokler <jokler@protonmail.com> | 2020-01-07 17:03:00 +0100 |
|---|---|---|
| committer | Jokler <jokler@protonmail.com> | 2020-01-07 17:03:00 +0100 |
| commit | 74e9d2a707f31d99865f9c406893c1221df27db4 (patch) | |
| tree | 159072c508092f28eb860747f8042008fcee930f /src/state.rs | |
| parent | 96406b289ed823d0422f14772399b3e97edb4049 (diff) | |
| download | pokebot-74e9d2a707f31d99865f9c406893c1221df27db4.tar.gz pokebot-74e9d2a707f31d99865f9c406893c1221df27db4.zip | |
Show correct state in the bot's name after loading
Diffstat (limited to 'src/state.rs')
| -rw-r--r-- | src/state.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/state.rs b/src/state.rs index 8c6a290..2797254 100644 --- a/src/state.rs +++ b/src/state.rs @@ -228,11 +228,19 @@ impl State { address: address.to_owned(), }; - if gst::State::Null == self.pipeline.get_state(gst::ClockTime(None)).1 { + let state = self.pipeline.get_state(gst::ClockTime(None)).1; + if gst::State::Null == state { self.set_name("PokeBot - Playing"); self.start_audio(req); } else { - self.set_name("PokeBot - Playing"); + match state { + gst::State::Playing => self.set_name("PokeBot - Playing"), + gst::State::Paused => self.set_name("PokeBot - Paused"), + gst::State::Ready => self.set_name("PokeBot - Stopped"), + gst::State::Null | gst::State::__Unknown(_) | gst::State::VoidPending => { + unreachable!() + } + } let title = req.title.clone(); if self |
