linux下保存firefox的缓存图片
2013-03-07 18:17
369 查看
这是一个学习linuxshell编程过程中制作的小工具,废话不说。开始:
这个工具一共有两个shellscript。第一个是webimage.bash这个script的作用就是在firefox的缓存目录下递归查找JPEG文件。第二个是test_image_size.bash这个文件的作用是对webimage.bash找到的图片进行筛选。小于60000B的文件不保存。
第一个文件:webimage.bash
#!/bin/bash
#copyright by lingbofeiyun
#This shell script is to search for firefox Cache and save film to~/Videos
#change to firefox Cache directory,this may different to you ownsystem
cd /home/yxy/.mozilla/firefox/700doz1r.default/Cache
#the loops function
loops() {
for film in *
do
if [ -d $film ] #if film is directory change tothis directory and recursion run loops
then
cd $film
loops
cd .. #change backto parent directory
elif [ -f $film ]
then
exitcode=0
#first test the file is image or not after that calltest_image_size.bash with ll parameter
message=$(file $film|grep "JPEG") &&exitcode=$(test_image_size.bash $(ls -l$film))
if [ "$exitcode" = 1 ]
then
cp $film /home/yxy/Pictures/Webcam
fi
fi
done
}
loops #shellstart running
exit 0
第二个文件:test_image_size.bash
#!/bin/bash
#copyright by lingbofeiyun
#This shell script is test image file's size. If image bigger than50KB return 1,else return 0
#test the fifth parameter is greater than 60000 or not.
if [ $5 -gt 60000 ]
then
echo 1
else
echo 0
fi
这样的话运行第一个文件就会调用第二个文件。浏览完图片后运行webimage.bash图片就会保存。稍加修改就会变成保存网上的flash电影,也就是网页上看的电影。下一篇我回给出代码。
这个工具一共有两个shellscript。第一个是webimage.bash这个script的作用就是在firefox的缓存目录下递归查找JPEG文件。第二个是test_image_size.bash这个文件的作用是对webimage.bash找到的图片进行筛选。小于60000B的文件不保存。
第一个文件:webimage.bash
#!/bin/bash
#copyright by lingbofeiyun
#This shell script is to search for firefox Cache and save film to~/Videos
#change to firefox Cache directory,this may different to you ownsystem
cd /home/yxy/.mozilla/firefox/700doz1r.default/Cache
#the loops function
loops() {
for film in *
do
if [ -d $film ] #if film is directory change tothis directory and recursion run loops
then
cd $film
loops
cd .. #change backto parent directory
elif [ -f $film ]
then
exitcode=0
#first test the file is image or not after that calltest_image_size.bash with ll parameter
message=$(file $film|grep "JPEG") &&exitcode=$(test_image_size.bash $(ls -l$film))
if [ "$exitcode" = 1 ]
then
cp $film /home/yxy/Pictures/Webcam
fi
fi
done
}
loops #shellstart running
exit 0
第二个文件:test_image_size.bash
#!/bin/bash
#copyright by lingbofeiyun
#This shell script is test image file's size. If image bigger than50KB return 1,else return 0
#test the fifth parameter is greater than 60000 or not.
if [ $5 -gt 60000 ]
then
echo 1
else
echo 0
fi
这样的话运行第一个文件就会调用第二个文件。浏览完图片后运行webimage.bash图片就会保存。稍加修改就会变成保存网上的flash电影,也就是网页上看的电影。下一篇我回给出代码。
相关文章推荐
- linux下保存firefox的缓存flash
- [分享黑科技]纯js突破localstorage存储上线,远程抓取图片,并转码base64保存本地,最终实现整个网站所有静态资源离线到用户手机效果却不依赖浏览器的缓存机制,单页应用最新黑科技
- Linux下Firefox无法保存书签(Can not save bookmark)的解决办法
- kindeditor 扩充,粘贴图片时,将图片保存,支持 ie和firefox
- ueditor在linux中遇到的图片保存出错的问题
- Android_Glide_保存已经缓存的图片
- webview中图片的获取、保存、展示、缓存处理
- Linux下获取显存一帧数据并保存为bmp图片
- Linux下获取显存一帧数据并保存为pnm格式图片
- 保存Volley的缓存图片到本地,当网络不通的时候,访问本地的图片
- Firefox保存网页预览模式下的图片方法
- lua中Sprite读取图片,缓存问题,会读取到上次保存的图片
- Android从Internet获取图片并保存到缓存
- 异步加载图片,保存本地缓存
- GCD下载保存图片 缓存
- 根据请求生成缩略图片保存到Linux图片服务器
- 利用gtk函数 linux桌面截图 保存成图片
- R语言——在linux环境下如何画图或保存图片
- 保存Volley的缓存图片到本地,当网络不通的时候,访问本地的图片
- Firefox截取页面保存为图片,页面截图,在线编辑图片,注释图片