Update deps with breaking changes

This commit is contained in:
2017-07-20 03:53:08 +02:00
parent bf71909c72
commit 2659093897
4 changed files with 287 additions and 74 deletions

View File

@@ -58,7 +58,11 @@ impl Presentation {
match *self {
Presentation::PublishToGo { ref download_url, .. } => {
let response_res = try_to_get_valid_response(
|client| client.get(download_url).header(construct_cookie()),
|client| {
let mut request_builder = client.get(download_url).unwrap();
request_builder.header(construct_cookie());
request_builder
},
|resp| resp.headers().get::<ContentDisposition>().is_some(),
);
@@ -92,7 +96,7 @@ impl Presentation {
path.push(fix_filename(&filename));
download_to_file_and_check(&mut response, &path, |path| check_zip(path))
.map_err(|e| DownloadError::IoError(e))
.map_err(DownloadError::IoError)
}
Presentation::VideoOnDemand {
ref resource_id,
@@ -112,11 +116,11 @@ impl Presentation {
let url = "https://streams.tum.de/Mediasite/PlayerService/\
PlayerService.svc/json/GetPlayerOptions";
let mut res = try_to_get_response(|client| {
client
.post(url)
.header(construct_cookie())
.header(ContentType::json())
.body(&*payload)
let mut request_builder = client.post(url).unwrap();
request_builder.header(construct_cookie())
.header(ContentType::json())
.body(payload.to_string());
request_builder
});
let json_text = read_response_body(&mut res);
@@ -135,8 +139,12 @@ impl Presentation {
};
for (i, download_url) in videos.iter().enumerate() {
let mut response = try_to_get_valid_response(
|client| client.get(download_url).header(construct_cookie()),
|resp| resp.status() == &StatusCode::Ok,
|client| {
let mut request_builder = client.get(download_url).unwrap();
request_builder.header(construct_cookie());
request_builder
},
|resp| resp.status() == StatusCode::Ok,
).unwrap();
// TODO: Support formats besides mp4
// extract extension from url or somewehre else...
@@ -149,7 +157,7 @@ impl Presentation {
path.push(fix_filename(&filename));
download_to_file_and_check(&mut response, &path, |path| check_video(path))
.map_err(|e| DownloadError::IoError(e))?;
.map_err(DownloadError::IoError)?;
}
Ok(())
}