Skip to content

Commit

Permalink
Merge pull request #96 from hguandl/dev
Browse files Browse the repository at this point in the history
进一步解决server以外部分的warning
  • Loading branch information
haha114514 committed Jul 14, 2023
2 parents 2787fd3 + 9af79e2 commit 46d165a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions crates/biliup/src/downloader/extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Display for Site {
}
}

enum Extension {
pub enum Extension {
Flv,
Ts,
}
Expand All @@ -64,14 +64,14 @@ impl Site {
println!("{}", self);
match self.extension {
Extension::Flv => {
let mut file: LifecycleFile = LifecycleFile::new(&fmt_file_name, "flv", hook);
let file = LifecycleFile::new(&fmt_file_name, "flv", hook);
let response = self.client.retryable(&self.direct_url).await?;
let mut connection = Connection::new(response);
connection.read_frame(9).await?;
httpflv::parse_flv(connection, file, segment).await?
}
Extension::Ts => {
let mut file: LifecycleFile = LifecycleFile::new(&fmt_file_name, "ts", hook);
let file = LifecycleFile::new(&fmt_file_name, "ts", hook);
hls::download(&self.direct_url, &self.client, &file.fmt_file_name, segment).await?
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biliup/src/downloader/httpflv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl Connection {
loop {
if chunk_size <= self.buffer.len() {
let bytes = Bytes::copy_from_slice(&self.buffer[..chunk_size]);
self.buffer.advance(chunk_size as usize);
self.buffer.advance(chunk_size);
return Ok(bytes);
}
// BytesMut::with_capacity(0).deref_mut()
Expand Down
4 changes: 2 additions & 2 deletions crates/bin/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use biliup::downloader::flv_parser::{
use biliup::downloader::flv_writer;
use biliup::downloader::flv_writer::{FlvTag, TagDataHeader};
use biliup::downloader::httpflv::map_parse_err;
use biliup::downloader::util::{LifecycleFile, Segmentable};
use biliup::downloader::util::Segmentable;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use std::io::{BufReader, BufWriter, ErrorKind, Read};
use std::path::PathBuf;
Expand Down Expand Up @@ -171,7 +171,7 @@ impl<T: Read> Reader<T> {
loop {
if chunk_size <= self.buffer.len() {
let bytes = Bytes::copy_from_slice(&self.buffer[..chunk_size]);
self.buffer.advance(chunk_size as usize);
self.buffer.advance(chunk_size);
return Ok(bytes);
}
// BytesMut::with_capacity(0).deref_mut()
Expand Down
1 change: 1 addition & 0 deletions crates/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod server;
mod uploader;

use anyhow::Result;
use time::macros::format_description;

use crate::cli::{Cli, Commands};
use crate::downloader::{download, generate_json};
Expand Down
4 changes: 2 additions & 2 deletions crates/stream-gears/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ fn upload(
desc: String,
dynamic: String,
cover: String,
dtime: Option<u32>,
dolby: u8,
lossless_music: u8,
no_reprint: u8,
open_elec: u8,
line: Option<UploadLine>,
limit: usize,
desc_v2: Vec<PyCredit>,
dtime: Option<u32>,
line: Option<UploadLine>,
) -> PyResult<()> {
py.allow_threads(|| {
let rt = tokio::runtime::Builder::new_current_thread()
Expand Down
12 changes: 6 additions & 6 deletions crates/stream-gears/src/uploader.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::{Context, Result};
use biliup::client::StatelessClient;
use biliup::error::Kind;
use biliup::uploader::bilibili::{Credit,ResponseData, Studio};
use biliup::uploader::bilibili::{Credit, ResponseData, Studio};
use biliup::uploader::credential::login_by_cookies;
use biliup::uploader::line::Probe;
use biliup::uploader::{line, VideoFile};
Expand Down Expand Up @@ -53,7 +53,7 @@ pub async fn upload(
lossless_music: u8,
no_reprint: u8,
open_elec: u8,
desc_v2_PyCredit: Vec<PyCredit>,
desc_v2_credit: Vec<PyCredit>,
) -> Result<ResponseData> {
// let file = std::fs::File::options()
// .read(true)
Expand Down Expand Up @@ -107,11 +107,11 @@ pub async fn upload(
videos.push(video);
}
let mut desc_v2 = Vec::new();
for pyCredit in desc_v2_PyCredit {
for credit in desc_v2_credit {
desc_v2.push(Credit {
type_id: pyCredit.type_id,
raw_text: pyCredit.raw_text,
biz_id: pyCredit.biz_id,
type_id: credit.type_id,
raw_text: credit.raw_text,
biz_id: credit.biz_id,
});
}
let mut studio: Studio = Studio::builder()
Expand Down

0 comments on commit 46d165a

Please sign in to comment.