首页 > 其他 > 详细

ccttp图片处理过程

时间:2014-03-01 22:17:47      阅读:825      评论:0      收藏:0      [点我收藏+]

1.python输出404的图片

bubuko.com,布布扣
 1 #!/usr/bin/python
 2 # coding: utf-8
 3 
 4 import psycopg2
 5 import sys
 6 from datetime import *
 7 import time
 8 import urllib
 9 import urllib2
10 import httplib 
11 import json
12 from jinja2 import Template
13 from jinja2 import Environment, PackageLoader
14 import codecs
15 import smtplib
16 from email.MIMEText import MIMEText
17 
18 
19 def getImageFromPath(imgPath):
20  try:
21   conn = httplib.HTTPConnection("img111.com") 
22   conn.request("GET", "/ttttn/"+imgPath)
23   r1 = conn.getresponse() 
24   if r1.status == 404:
25     output = open(/tmp/data1, a)
26     output.write(imgPath[5:]+"\r\n")
27     output.close()
28     print "not find " + imgPath
29   conn.close()
30  except:
31   print "get url Exp"
32   return
33 
34 def queryDb():
35  conn = psycopg2.connect(database="", user="", password="", host="", port="5432")
36  cur = conn.cursor()
37 
38  offset = 0;
39  while(1):
40    time.sleep(2)
41    exeSql="SELECT id,image from aaa where type=‘cccc‘ and image like ‘tttt%‘ order by id limit 100 offset " + str(offset)
42    cur.execute(exeSql)
43    rows = cur.fetchall()
44    offset += 100
45    if(len(rows) <= 0):
46      break
47    for row in rows:
48     #print str(row[0]) + ":" + row[1]
49     imgPath = row[1]
50     imgPathItems = imgPath.split(/)
51     if(len(imgPathItems) >=4 ):
52      lasts = imgPathItems[3].split(.)
53      strItem = imgPathItems[0] + "/" +imgPathItems[1] + "/" + imgPathItems[2] + "/4_" + lasts[0] + "_index.jpg"
54      getImageFromPath(strItem)
bubuko.com,布布扣

 

2.touch相关的文件

bubuko.com,布布扣
DIR1=/home
for line in `cat /tmp/data1`
do
    echo "touch ${DIR1}/${line}"
    touch ${DIR1}/${line}
    sleep 3
done
bubuko.com,布布扣

ccttp图片处理过程,布布扣,bubuko.com

ccttp图片处理过程

原文:http://www.cnblogs.com/strikebone/p/3574654.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!