比这篇新的文章:
Codee#16988
比这篇旧的文章: Poj-2407 Algorithm:欧拉函数
作者: 半瓶墨水, 点击518次, 评论(0), 收藏者(0), , 打分:
所有评论,共0条:( 我也来说两句)
比这篇旧的文章: Poj-2407 Algorithm:欧拉函数
Export all stared photos in Picasa once
语言: Python, 标签: Picasa 2011/02/22发布 1年前更新作者: 半瓶墨水, 点击518次, 评论(0), 收藏者(0), , 打分:
Python语言: Export all stared photos in Picasa once
01 #! /usr/bin/env python
02 # -*- coding: utf-8 -*-
03 #
04 #Purpose: export all picasa stared photos under a folder and it's subfolders
05 # because Picasa doesn't support - it only can export one folder once
06 #
07 # Reach me via: realfun AT gmail DOT com
08 #
09 # http://2maomao.com/blog/py-script-export-all-stared-photos-in-picasa/
10 # http://www.google.com/profiles/realfun
11 # 2011-02-22, 22:26:28
12
13 from os import walk
14 from os.path import join
15
16 #damn python encoding hack
17 import sys
18 reload(sys)
19 sys.setdefaultencoding("gb2312")
20
21 PICASA = '.picasa.ini'
22 PICASA_OLD = 'Picasa.ini'
23 TARGET = 'G:\\ipad\\sync\\temp\\'
24
25 def get_stars(dir, picasa):
26 stars = []
27 last = None
28 for line in open(join(dir, picasa)).readlines():
29 line = line.rstrip("\n")
30 if line.startswith("[") and line.endswith("]"):
31 last = line[1:-1].decode("utf-8")
32 elif line.startswith("star=yes"):
33 stars.append(last)
34 return stars
35
36 out = open("copystar_go.bat", "wb")
37 for root, dirs, files in walk("."):
38 picasa = None
39 if PICASA in files:
40 picasa = PICASA
41 elif PICASA_OLD in files:
42 picasa = PICASA_OLD
43 if picasa:
44 stars = get_stars(root, picasa)
45 for star in stars:
46 line = 'robocopy "%s" "%s" "%s"\r' % (root, join(TARGET, root), star)
47 print >>out, line
02 # -*- coding: utf-8 -*-
03 #
04 #Purpose: export all picasa stared photos under a folder and it's subfolders
05 # because Picasa doesn't support - it only can export one folder once
06 #
07 # Reach me via: realfun AT gmail DOT com
08 #
09 # http://2maomao.com/blog/py-script-export-all-stared-photos-in-picasa/
10 # http://www.google.com/profiles/realfun
11 # 2011-02-22, 22:26:28
12
13 from os import walk
14 from os.path import join
15
16 #damn python encoding hack
17 import sys
18 reload(sys)
19 sys.setdefaultencoding("gb2312")
20
21 PICASA = '.picasa.ini'
22 PICASA_OLD = 'Picasa.ini'
23 TARGET = 'G:\\ipad\\sync\\temp\\'
24
25 def get_stars(dir, picasa):
26 stars = []
27 last = None
28 for line in open(join(dir, picasa)).readlines():
29 line = line.rstrip("\n")
30 if line.startswith("[") and line.endswith("]"):
31 last = line[1:-1].decode("utf-8")
32 elif line.startswith("star=yes"):
33 stars.append(last)
34 return stars
35
36 out = open("copystar_go.bat", "wb")
37 for root, dirs, files in walk("."):
38 picasa = None
39 if PICASA in files:
40 picasa = PICASA
41 elif PICASA_OLD in files:
42 picasa = PICASA_OLD
43 if picasa:
44 stars = get_stars(root, picasa)
45 for star in stars:
46 line = 'robocopy "%s" "%s" "%s"\r' % (root, join(TARGET, root), star)
47 print >>out, line
所有评论,共0条:( 我也来说两句)
代码
