cargo fmt
This commit is contained in:
parent
c6aa90db3e
commit
990d830f24
@ -93,5 +93,4 @@ rustfmt:
|
|||||||
script:
|
script:
|
||||||
- rustc -Vv && cargo -Vv
|
- rustc -Vv && cargo -Vv
|
||||||
- cargo fmt --version
|
- cargo fmt --version
|
||||||
- cargo fmt --all -- --check
|
- cargo fmt --all -- --check
|
||||||
allow_failure: true
|
|
||||||
@ -110,7 +110,8 @@ pub fn get_episode_widget_from_rowid(ep_id: i32) -> Result<EpisodeWidgetModel, D
|
|||||||
episodes
|
episodes
|
||||||
.select((
|
.select((
|
||||||
rowid, title, uri, local_uri, epoch, length, duration, played, show_id,
|
rowid, title, uri, local_uri, epoch, length, duration, played, show_id,
|
||||||
)).filter(rowid.eq(ep_id))
|
))
|
||||||
|
.filter(rowid.eq(ep_id))
|
||||||
.get_result::<EpisodeWidgetModel>(&con)
|
.get_result::<EpisodeWidgetModel>(&con)
|
||||||
.map_err(From::from)
|
.map_err(From::from)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,9 +14,7 @@ use models::Source;
|
|||||||
|
|
||||||
#[fail(
|
#[fail(
|
||||||
display = "Request to {} returned {}. Context: {}",
|
display = "Request to {} returned {}. Context: {}",
|
||||||
url,
|
url, status_code, context
|
||||||
status_code,
|
|
||||||
context
|
|
||||||
)]
|
)]
|
||||||
#[derive(Fail, Debug)]
|
#[derive(Fail, Debug)]
|
||||||
pub struct HttpStatusError {
|
pub struct HttpStatusError {
|
||||||
@ -67,10 +65,7 @@ pub enum DataError {
|
|||||||
FeedRedirect(Source),
|
FeedRedirect(Source),
|
||||||
#[fail(display = "Feed is up to date")]
|
#[fail(display = "Feed is up to date")]
|
||||||
FeedNotModified(Source),
|
FeedNotModified(Source),
|
||||||
#[fail(
|
#[fail(display = "Error occured while Parsing an Episode. Reason: {}", reason)]
|
||||||
display = "Error occured while Parsing an Episode. Reason: {}",
|
|
||||||
reason
|
|
||||||
)]
|
|
||||||
ParseEpisodeError { reason: String, parent_id: i32 },
|
ParseEpisodeError { reason: String, parent_id: i32 },
|
||||||
#[fail(display = "Episode was not changed and thus skipped.")]
|
#[fail(display = "Episode was not changed and thus skipped.")]
|
||||||
EpisodeNotChanged,
|
EpisodeNotChanged,
|
||||||
|
|||||||
@ -108,7 +108,8 @@ fn batch_insert_episodes(episodes: &[NewEpisode]) {
|
|||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
error!("Failed batch indexng: {}", err);
|
error!("Failed batch indexng: {}", err);
|
||||||
info!("Fallign back to individual indexing.");
|
info!("Fallign back to individual indexing.");
|
||||||
}).unwrap_or_else(|_| {
|
})
|
||||||
|
.unwrap_or_else(|_| {
|
||||||
episodes.iter().for_each(|ep| {
|
episodes.iter().for_each(|ep| {
|
||||||
ep.index()
|
ep.index()
|
||||||
.map_err(|err| error!("Error: {}.", err))
|
.map_err(|err| error!("Error: {}.", err))
|
||||||
@ -174,7 +175,8 @@ mod tests {
|
|||||||
// Create and insert a Source into db
|
// Create and insert a Source into db
|
||||||
let s = Source::from_url(url).unwrap();
|
let s = Source::from_url(url).unwrap();
|
||||||
get_feed(path, s.id())
|
get_feed(path, s.id())
|
||||||
}).collect();
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
// Index the channes
|
// Index the channes
|
||||||
let stream_ = stream::iter_ok(feeds).for_each(|x| x.index());
|
let stream_ = stream::iter_ok(feeds).for_each(|x| x.index());
|
||||||
|
|||||||
@ -332,7 +332,8 @@ mod tests {
|
|||||||
.title("The Super Bowl of Racism")
|
.title("The Super Bowl of Racism")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://traffic.megaphone.fm/PPY6458293736.mp3",
|
"http://traffic.megaphone.fm/PPY6458293736.mp3",
|
||||||
))).guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
|
)))
|
||||||
|
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
|
||||||
.epoch(1505296800)
|
.epoch(1505296800)
|
||||||
.length(Some(66738886))
|
.length(Some(66738886))
|
||||||
.duration(Some(4171))
|
.duration(Some(4171))
|
||||||
@ -345,7 +346,8 @@ mod tests {
|
|||||||
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
|
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://traffic.megaphone.fm/FL5331443769.mp3",
|
"http://traffic.megaphone.fm/FL5331443769.mp3",
|
||||||
))).guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d")))
|
)))
|
||||||
|
.guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d")))
|
||||||
.epoch(1502272800)
|
.epoch(1502272800)
|
||||||
.length(Some(67527575))
|
.length(Some(67527575))
|
||||||
.duration(Some(4415))
|
.duration(Some(4415))
|
||||||
@ -364,7 +366,8 @@ mod tests {
|
|||||||
.title("The Super Bowl of Racism")
|
.title("The Super Bowl of Racism")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://traffic.megaphone.fm/PPY6458293736.mp3",
|
"http://traffic.megaphone.fm/PPY6458293736.mp3",
|
||||||
))).description(Some(String::from(descr)))
|
)))
|
||||||
|
.description(Some(String::from(descr)))
|
||||||
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
|
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
|
||||||
.length(Some(66738886))
|
.length(Some(66738886))
|
||||||
.epoch(1505296800)
|
.epoch(1505296800)
|
||||||
@ -387,7 +390,8 @@ mod tests {
|
|||||||
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
|
.title("Atlas Golfed — U.S.-Backed Think Tanks Target Latin America")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://traffic.megaphone.fm/FL5331443769.mp3",
|
"http://traffic.megaphone.fm/FL5331443769.mp3",
|
||||||
))).description(Some(String::from(descr)))
|
)))
|
||||||
|
.description(Some(String::from(descr)))
|
||||||
.guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d")))
|
.guid(Some(String::from("7c207a24-e33f-11e6-9438-eb45dcf36a1d")))
|
||||||
.length(Some(67527575))
|
.length(Some(67527575))
|
||||||
.epoch(1502272800)
|
.epoch(1502272800)
|
||||||
@ -401,7 +405,8 @@ mod tests {
|
|||||||
.title("The Super Bowl of Racism")
|
.title("The Super Bowl of Racism")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://traffic.megaphone.fm/PPY6458293736.mp3",
|
"http://traffic.megaphone.fm/PPY6458293736.mp3",
|
||||||
))).description(Some(String::from("New description")))
|
)))
|
||||||
|
.description(Some(String::from("New description")))
|
||||||
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
|
.guid(Some(String::from("7df4070a-9832-11e7-adac-cb37b05d5e24")))
|
||||||
.length(Some(66738886))
|
.length(Some(66738886))
|
||||||
.epoch(1505296800)
|
.epoch(1505296800)
|
||||||
@ -415,7 +420,8 @@ mod tests {
|
|||||||
.title("Hacking Devices with Kali Linux | LUP 214")
|
.title("Hacking Devices with Kali Linux | LUP 214")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3",
|
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3",
|
||||||
))).guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D")))
|
)))
|
||||||
|
.guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D")))
|
||||||
.length(Some(46479789))
|
.length(Some(46479789))
|
||||||
.epoch(1505280282)
|
.epoch(1505280282)
|
||||||
.duration(Some(5733))
|
.duration(Some(5733))
|
||||||
@ -428,7 +434,8 @@ mod tests {
|
|||||||
.title("Gnome Does it Again | LUP 213")
|
.title("Gnome Does it Again | LUP 213")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3",
|
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3",
|
||||||
))).guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B")))
|
)))
|
||||||
|
.guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B")))
|
||||||
.epoch(1504670247)
|
.epoch(1504670247)
|
||||||
.length(Some(36544272))
|
.length(Some(36544272))
|
||||||
.duration(Some(4491))
|
.duration(Some(4491))
|
||||||
@ -446,7 +453,8 @@ mod tests {
|
|||||||
.title("Hacking Devices with Kali Linux | LUP 214")
|
.title("Hacking Devices with Kali Linux | LUP 214")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3",
|
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0214.mp3",
|
||||||
))).description(Some(String::from(descr)))
|
)))
|
||||||
|
.description(Some(String::from(descr)))
|
||||||
.guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D")))
|
.guid(Some(String::from("78A682B4-73E8-47B8-88C0-1BE62DD4EF9D")))
|
||||||
.length(Some(46479789))
|
.length(Some(46479789))
|
||||||
.epoch(1505280282)
|
.epoch(1505280282)
|
||||||
@ -467,7 +475,8 @@ mod tests {
|
|||||||
.title("Gnome Does it Again | LUP 213")
|
.title("Gnome Does it Again | LUP 213")
|
||||||
.uri(Some(String::from(
|
.uri(Some(String::from(
|
||||||
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3",
|
"http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/jnite/lup-0213.mp3",
|
||||||
))).description(Some(String::from(descr)))
|
)))
|
||||||
|
.description(Some(String::from(descr)))
|
||||||
.guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B")))
|
.guid(Some(String::from("1CE57548-B36C-4F14-832A-5D5E0A24E35B")))
|
||||||
.length(Some(36544272))
|
.length(Some(36544272))
|
||||||
.epoch(1504670247)
|
.epoch(1504670247)
|
||||||
|
|||||||
@ -200,7 +200,8 @@ mod tests {
|
|||||||
.description(descr)
|
.description(descr)
|
||||||
.image_uri(Some(String::from(
|
.image_uri(Some(String::from(
|
||||||
"http://www.jupiterbroadcasting.com/images/LASUN-Badge1400.jpg",
|
"http://www.jupiterbroadcasting.com/images/LASUN-Badge1400.jpg",
|
||||||
))).source_id(42)
|
)))
|
||||||
|
.source_id(42)
|
||||||
.build()
|
.build()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
@ -256,7 +257,8 @@ mod tests {
|
|||||||
.description(descr)
|
.description(descr)
|
||||||
.image_uri(Some(String::from(
|
.image_uri(Some(String::from(
|
||||||
"http://www.greaterthancode.com/wp-content/uploads/2016/10/code1400-4.jpg",
|
"http://www.greaterthancode.com/wp-content/uploads/2016/10/code1400-4.jpg",
|
||||||
))).source_id(42)
|
)))
|
||||||
|
.source_id(42)
|
||||||
.build()
|
.build()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,14 +4,14 @@ use rss::Channel;
|
|||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use hyper::client::HttpConnector;
|
use hyper::client::HttpConnector;
|
||||||
use hyper::{Client, Body};
|
use hyper::{Body, Client};
|
||||||
use hyper_tls::HttpsConnector;
|
use hyper_tls::HttpsConnector;
|
||||||
|
|
||||||
use http::{Request, Response, StatusCode, Uri};
|
|
||||||
use http::header::{
|
use http::header::{
|
||||||
ETAG, IF_MODIFIED_SINCE, IF_NONE_MATCH, LAST_MODIFIED, LOCATION, USER_AGENT as USER_AGENT_HEADER,
|
HeaderValue, ETAG, IF_MODIFIED_SINCE, IF_NONE_MATCH, LAST_MODIFIED, LOCATION,
|
||||||
HeaderValue,
|
USER_AGENT as USER_AGENT_HEADER,
|
||||||
};
|
};
|
||||||
|
use http::{Request, Response, StatusCode, Uri};
|
||||||
// use futures::future::ok;
|
// use futures::future::ok;
|
||||||
use futures::future::{loop_fn, Future, Loop};
|
use futures::future::{loop_fn, Future, Loop};
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
@ -96,8 +96,14 @@ impl Source {
|
|||||||
fn update_etag(mut self, res: &Response<Body>) -> Result<Self, DataError> {
|
fn update_etag(mut self, res: &Response<Body>) -> Result<Self, DataError> {
|
||||||
let headers = res.headers();
|
let headers = res.headers();
|
||||||
|
|
||||||
let etag = headers.get(ETAG).and_then(|h| h.to_str().ok()).map(From::from);
|
let etag = headers
|
||||||
let lmod = headers.get(LAST_MODIFIED).and_then(|h| h.to_str().ok()).map(From::from);
|
.get(ETAG)
|
||||||
|
.and_then(|h| h.to_str().ok())
|
||||||
|
.map(From::from);
|
||||||
|
let lmod = headers
|
||||||
|
.get(LAST_MODIFIED)
|
||||||
|
.and_then(|h| h.to_str().ok())
|
||||||
|
.map(From::from);
|
||||||
|
|
||||||
if (self.http_etag() != etag) || (self.last_modified != lmod) {
|
if (self.http_etag() != etag) || (self.last_modified != lmod) {
|
||||||
self.set_http_etag(etag);
|
self.set_http_etag(etag);
|
||||||
@ -249,19 +255,20 @@ impl Source {
|
|||||||
) -> impl Future<Item = Response<Body>, Error = DataError> {
|
) -> impl Future<Item = Response<Body>, Error = DataError> {
|
||||||
// FIXME: remove unwrap somehow
|
// FIXME: remove unwrap somehow
|
||||||
let uri = Uri::from_str(self.uri()).unwrap();
|
let uri = Uri::from_str(self.uri()).unwrap();
|
||||||
let mut req = Request::get(uri)
|
let mut req = Request::get(uri).body(Body::empty()).unwrap();
|
||||||
.body(Body::empty())
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Set the UserAgent cause ppl still seem to check it for some reason...
|
// Set the UserAgent cause ppl still seem to check it for some reason...
|
||||||
req.headers_mut().insert(USER_AGENT_HEADER, HeaderValue::from_static(USER_AGENT));
|
req.headers_mut()
|
||||||
|
.insert(USER_AGENT_HEADER, HeaderValue::from_static(USER_AGENT));
|
||||||
|
|
||||||
if let Some(etag) = self.http_etag() {
|
if let Some(etag) = self.http_etag() {
|
||||||
req.headers_mut().insert(IF_NONE_MATCH, HeaderValue::from_str(etag).unwrap());
|
req.headers_mut()
|
||||||
|
.insert(IF_NONE_MATCH, HeaderValue::from_str(etag).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(lmod) = self.last_modified() {
|
if let Some(lmod) = self.last_modified() {
|
||||||
req.headers_mut().insert(IF_MODIFIED_SINCE, HeaderValue::from_str(lmod).unwrap());
|
req.headers_mut()
|
||||||
|
.insert(IF_MODIFIED_SINCE, HeaderValue::from_str(lmod).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
client
|
client
|
||||||
@ -271,7 +278,9 @@ impl Source {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn response_to_channel(res: Response<Body>) -> impl Future<Item = Channel, Error = DataError> + Send {
|
fn response_to_channel(
|
||||||
|
res: Response<Body>,
|
||||||
|
) -> impl Future<Item = Channel, Error = DataError> + Send {
|
||||||
res.into_body()
|
res.into_body()
|
||||||
.concat2()
|
.concat2()
|
||||||
.map(|x| x.into_iter())
|
.map(|x| x.into_iter())
|
||||||
|
|||||||
@ -42,7 +42,8 @@ pub fn import_to_db<R: Read>(reader: R) -> Result<Vec<Source>, reader::Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.ok()
|
s.ok()
|
||||||
}).collect();
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
Ok(feeds)
|
Ok(feeds)
|
||||||
}
|
}
|
||||||
@ -91,7 +92,8 @@ pub fn extract_sources<R: Read>(reader: R) -> Result<HashSet<Opml>, reader::Erro
|
|||||||
}
|
}
|
||||||
Err(err) => Err(err),
|
Err(err) => Err(err),
|
||||||
_ => Ok(()),
|
_ => Ok(()),
|
||||||
}).collect::<Result<Vec<_>, reader::Error>>()?;
|
})
|
||||||
|
.collect::<Result<Vec<_>, reader::Error>>()?;
|
||||||
|
|
||||||
Ok(list)
|
Ok(list)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
// FIXME:
|
// FIXME:
|
||||||
//! Docs.
|
//! Docs.
|
||||||
|
|
||||||
use futures::{lazy, prelude::*, future::ok, stream::FuturesUnordered};
|
use futures::{future::ok, lazy, prelude::*, stream::FuturesUnordered};
|
||||||
use tokio;
|
use tokio;
|
||||||
|
|
||||||
use hyper::client::HttpConnector;
|
use hyper::client::HttpConnector;
|
||||||
use hyper::{Client, Body};
|
use hyper::{Body, Client};
|
||||||
use hyper_tls::HttpsConnector;
|
use hyper_tls::HttpsConnector;
|
||||||
|
|
||||||
use num_cpus;
|
use num_cpus;
|
||||||
@ -23,10 +23,7 @@ type HttpsClient = Client<HttpsConnector<HttpConnector>>;
|
|||||||
/// Messy temp diagram:
|
/// Messy temp diagram:
|
||||||
/// Source -> GET Request -> Update Etags -> Check Status -> Parse `xml/Rss` ->
|
/// Source -> GET Request -> Update Etags -> Check Status -> Parse `xml/Rss` ->
|
||||||
/// Convert `rss::Channel` into `Feed` -> Index Podcast -> Index Episodes.
|
/// Convert `rss::Channel` into `Feed` -> Index Podcast -> Index Episodes.
|
||||||
pub fn pipeline<'a, S>(
|
pub fn pipeline<'a, S>(sources: S, client: HttpsClient) -> impl Future<Item = (), Error = ()> + 'a
|
||||||
sources: S,
|
|
||||||
client: HttpsClient,
|
|
||||||
) -> impl Future<Item = (), Error = ()> + 'a
|
|
||||||
where
|
where
|
||||||
S: Stream<Item = Source, Error = DataError> + Send + 'a,
|
S: Stream<Item = Source, Error = DataError> + Send + 'a,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,7 +25,8 @@ fn download_checker() -> Result<(), DataError> {
|
|||||||
return Some(ep);
|
return Some(ep);
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
}).for_each(|ep| {
|
})
|
||||||
|
.for_each(|ep| {
|
||||||
ep.set_local_uri(None);
|
ep.set_local_uri(None);
|
||||||
ep.save()
|
ep.save()
|
||||||
.map_err(|err| error!("{}", err))
|
.map_err(|err| error!("{}", err))
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
use glob::glob;
|
use glob::glob;
|
||||||
use mime_guess;
|
use mime_guess;
|
||||||
use reqwest;
|
use reqwest;
|
||||||
use reqwest::RedirectPolicy;
|
|
||||||
use reqwest::header::*;
|
use reqwest::header::*;
|
||||||
|
use reqwest::RedirectPolicy;
|
||||||
use tempdir::TempDir;
|
use tempdir::TempDir;
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|||||||
@ -1,17 +1,8 @@
|
|||||||
#![recursion_limit = "1024"]
|
#![recursion_limit = "1024"]
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
#![cfg_attr(
|
#![cfg_attr(feature = "cargo-clippy", allow(blacklisted_name, option_map_unit_fn))]
|
||||||
feature = "cargo-clippy",
|
|
||||||
allow(blacklisted_name, option_map_unit_fn)
|
|
||||||
)]
|
|
||||||
// Enable lint group collections
|
// Enable lint group collections
|
||||||
#![warn(
|
#![warn(nonstandard_style, edition_2018, rust_2018_idioms, bad_style, unused)]
|
||||||
nonstandard_style,
|
|
||||||
edition_2018,
|
|
||||||
rust_2018_idioms,
|
|
||||||
bad_style,
|
|
||||||
unused
|
|
||||||
)]
|
|
||||||
// standalone lints
|
// standalone lints
|
||||||
#![warn(
|
#![warn(
|
||||||
const_err,
|
const_err,
|
||||||
|
|||||||
@ -9,13 +9,7 @@
|
|||||||
)]
|
)]
|
||||||
#![allow(unknown_lints)]
|
#![allow(unknown_lints)]
|
||||||
// Enable lint group collections
|
// Enable lint group collections
|
||||||
#![warn(
|
#![warn(nonstandard_style, edition_2018, rust_2018_idioms, bad_style, unused)]
|
||||||
nonstandard_style,
|
|
||||||
edition_2018,
|
|
||||||
rust_2018_idioms,
|
|
||||||
bad_style,
|
|
||||||
unused
|
|
||||||
)]
|
|
||||||
// standalone lints
|
// standalone lints
|
||||||
#![warn(
|
#![warn(
|
||||||
const_err,
|
const_err,
|
||||||
@ -66,6 +60,7 @@ extern crate html2text;
|
|||||||
extern crate humansize;
|
extern crate humansize;
|
||||||
extern crate libhandy;
|
extern crate libhandy;
|
||||||
extern crate loggerv;
|
extern crate loggerv;
|
||||||
|
extern crate mpris_player;
|
||||||
extern crate open;
|
extern crate open;
|
||||||
extern crate podcasts_data;
|
extern crate podcasts_data;
|
||||||
extern crate podcasts_downloader;
|
extern crate podcasts_downloader;
|
||||||
@ -74,7 +69,6 @@ extern crate regex;
|
|||||||
extern crate reqwest;
|
extern crate reqwest;
|
||||||
extern crate serde_json;
|
extern crate serde_json;
|
||||||
extern crate url;
|
extern crate url;
|
||||||
extern crate mpris_player;
|
|
||||||
|
|
||||||
use log::Level;
|
use log::Level;
|
||||||
|
|
||||||
|
|||||||
@ -62,8 +62,8 @@ impl Prefs {
|
|||||||
i18n("Days"),
|
i18n("Days"),
|
||||||
i18n("Weeks"),
|
i18n("Weeks"),
|
||||||
]
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
{
|
{
|
||||||
let row: &[&dyn ToValue] = &[item];
|
let row: &[&dyn ToValue] = &[item];
|
||||||
if item.to_lowercase() == cleanup_p {
|
if item.to_lowercase() == cleanup_p {
|
||||||
|
|||||||
@ -19,16 +19,16 @@ use podcasts_data::{EpisodeWidgetModel, ShowCoverModel};
|
|||||||
use app::Action;
|
use app::Action;
|
||||||
use utils::set_image_from_path;
|
use utils::set_image_from_path;
|
||||||
|
|
||||||
|
use std::cell::RefCell;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::cell::RefCell;
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use i18n::i18n;
|
use i18n::i18n;
|
||||||
|
|
||||||
|
use mpris_player::{Metadata, MprisPlayer, OrgMprisMediaPlayer2Player, PlaybackStatus};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use mpris_player::{PlaybackStatus, MprisPlayer, Metadata, OrgMprisMediaPlayer2Player};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
enum SeekDirection {
|
enum SeekDirection {
|
||||||
@ -349,7 +349,9 @@ impl PlayerWidget {
|
|||||||
weak.upgrade().map(|p| p.rewind());
|
weak.upgrade().map(|p| p.rewind());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
s.info.mpris.connect_raise(clone!(sender => move || sender.send(Action::RaiseWindow)));
|
s.info
|
||||||
|
.mpris
|
||||||
|
.connect_raise(clone!(sender => move || sender.send(Action::RaiseWindow)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
@ -483,7 +485,7 @@ impl PlayerWidget {
|
|||||||
// Only rewind on pause if the stream position is passed a certain point,
|
// Only rewind on pause if the stream position is passed a certain point,
|
||||||
// and the player has been paused for more than a minute,
|
// and the player has been paused for more than a minute,
|
||||||
// and the episode id is the same
|
// and the episode id is the same
|
||||||
if seconds_passed >= 90 && delta >= 60 && current_id == *last {
|
if seconds_passed >= 90 && delta >= 60 && current_id == *last {
|
||||||
self.seek(ClockTime::from_seconds(5), SeekDirection::Backwards);
|
self.seek(ClockTime::from_seconds(5), SeekDirection::Backwards);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,4 +4,3 @@ newline_style = "Unix"
|
|||||||
format_strings = true
|
format_strings = true
|
||||||
normalize_comments = true
|
normalize_comments = true
|
||||||
use_field_init_shorthand = true
|
use_field_init_shorthand = true
|
||||||
edition = "Edition2018"
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user