Remove debug logging from skin fetching
This commit is contained in:
parent
698c0d9dda
commit
ea23219993
|
@ -541,10 +541,7 @@ impl Renderer {
|
|||
let mut tex = self.textures.write().unwrap();
|
||||
while let Ok((hash, img)) = self.skin_reply.try_recv() {
|
||||
if let Some(img) = img {
|
||||
debug!("Got completed skin: {:?}", hash);
|
||||
tex.update_skin(hash, img);
|
||||
} else {
|
||||
debug!("Failed to get skin for {:?}", hash);
|
||||
}
|
||||
}
|
||||
let mut old_skins = vec![];
|
||||
|
@ -847,20 +844,16 @@ impl TextureManager {
|
|||
use std::path::Path;
|
||||
let client = hyper::Client::new();
|
||||
loop {
|
||||
// TODO: Cache
|
||||
let hash = recv.recv().unwrap();
|
||||
trace!("Fetching skin {:?}", hash);
|
||||
let path = format!("skin-cache/{}/{}.png", &hash[..2], hash);
|
||||
let cache_path = Path::new(&path);
|
||||
fs::create_dir_all(cache_path.parent().unwrap()).unwrap();
|
||||
let mut buf = vec![];
|
||||
if fs::metadata(cache_path).is_ok() {
|
||||
debug!("Loading skin {} from cache", hash);
|
||||
// We have a cached image
|
||||
let mut file = fs::File::open(cache_path).unwrap();
|
||||
file.read_to_end(&mut buf).unwrap();
|
||||
} else {
|
||||
debug!("Downloading skin {}", hash);
|
||||
// Need to download it
|
||||
let url = format!("http://textures.minecraft.net/texture/{}", hash);
|
||||
let mut res = client.get(&url).send().unwrap();
|
||||
|
|
Loading…
Reference in New Issue