-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimg.py
More file actions
33 lines (28 loc) · 762 Bytes
/
img.py
File metadata and controls
33 lines (28 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# -*-coding:utf-8-*-
#
# Author: liuzhida - zhida@wandoujia.com
# Blog: http://liuzhida.com
# Last modified: 2014-04-10 18:51
# Filename: img.py
# Description:
import glob
import os
from config import c
def rename():
for file in glob.glob("static/pic/*"):
print file
name = file.split("_")[0]
jpg = file.split(".")[-1]
new = name + "." + jpg
print new
os.rename(file,new)
def into():
for file in glob.glob("static/img/*"):
pic = file.split("/")[-1]
name = pic.split(".")[0]
print name
if c.exists("person:"+name):
c.hset("person:" + name, "img", "http://who.wandoulabs.com/static/img/"+pic)
if __name__ == "__main__":
into()