feat: yank magnet without metadata and trackers#40
feat: yank magnet without metadata and trackers#40Beastwick18 merged 2 commits intoBeastwick18:mainfrom
Conversation
Beastwick18
left a comment
There was a problem hiding this comment.
LGTM 👍, just would make sure to handle errors with Url::parse instead of unwrapping
310ea71 to
978ccb2
Compare
|
Hello, Thanks for your complete review, I just had to copy-paste and test :) |
978ccb2 to
efea4e0
Compare
There was a problem hiding this comment.
This can be done in a different PR, but want to mention anyway, this bool should be applied to client handlers as well as yanks. Either the bool should be renamed more generically, and used for both, or 2 bools can be made.
nyaa/src/client/transmission.rs
Line 117 in c496c50
Line 80 in c496c50
nyaa/src/client/default_app.rs
Line 26 in c496c50
Line 40 in c496c50
|
I can improve it, it shouldn't be difficult |
|
I was beginning to implement per client but: impl DownloadClient for RqbitClient {
async fn download(
item: Item,
conf: ClientConfig,
client: reqwest::Client,
) -> SingleDownloadResult {
let conf = match conf.rqbit.clone() {
Some(q) => q,
None => {
return SingleDownloadResult::error("Failed to get rqbit config");
}
};
let link = match conf.use_magnet.unwrap_or(true) {
true => {
if let Some(full) = conf.yank_full_magnet {
if full {
item.magnet_link.to_owned()
} else {
match minimal_magnet_link(item.magnet_link.clone()){
Ok(magnet) => magnet.to_owned(),
Err(_) => todo!(), // context not available here
}
}
} else {
item.magnet_link.to_owned()
}
}
false => item.torrent_link.to_owned(),
};
// ...
}
}But, in case of error, I don't have the context (to do something like |
I'm no rust expert, but it sounds pretty ok to me. There's not much of a chance for error. At that point it's an issue with nyaa sending non-compliant magnet links (I don't think it's possible for any listings to not have one in the first place). The most I can say about saftey's that it may be good to add a BTMH magnet v2 URI test case, for forwards compatibility. |
45095f5 to
d6f10db
Compare
Beastwick18
left a comment
There was a problem hiding this comment.
Everything LGTM functionality wise, so I can implement the changes mentioned after merging if that sounds good!
d6f10db to
9f37186
Compare
Ref: Beastwik18#40
9f37186 to
674ba69
Compare
|
Everything looks good, thanks for adding this! |
|
Whoops, just noticed the condition is backwards for keycombo 'ym'. It yanks the minimal link when |
Close: #37