PORT = '1983'
BASE = 'http://%s:%s' % (HOST, PORT)
USERNAME = 'zope'
-#DESTDIR = 'crfpa/formations/formations-en-ligne/cours-audio/'
-DESTDIR = 'crfpa/test/'
+DESTDIR = 'CRFPA/formations/formations-en-ligne/cours-audio/'
+#DESTDIR = 'CRFPA/'
TITLE = 'Pre-barreau_-_Augustins_-_CRFPA_-_'
SOURCEDIR = '/home/augustins/audio/media/CRFPA/2008/'
#PASSWORD = sys.argv[1]
PASSWORD = 'wasncellar;z'
+COURSES = 'pre-barreau_courses_crfpa.txt'
f = open(source_dir + os.sep +_dir + os.sep + file,'r')
_dav().put(base+'/'+_dest_dir+'/'+file,f.read(),None,None,auth_dict)
+def init(base, title, dest_dir, source_dir, username, password, encodeduserpass):
+ _dav().setauth(username, password)
+ auth_dict = {"Authorization":"Basic %s" % encodeduserpass}
+ auth = auth_dict['Authorization']
+ print auth
+ f = open(COURSES, 'r')
+ courses = f.readlines()
+ for course in courses:
+ _dav().mkcol(base+'/'+dest_dir+course.lower()+'/'+'Archives_Audio',auth)
if __name__ == '__main__':
if HOST == 'FILL THIS IN':
sys.exit(1)
encodedUSERPASS = base64.encodestring(USERNAME+":"+PASSWORD)
- upload(BASE, TITLE, DESTDIR, SOURCEDIR, USERNAME, PASSWORD, encodedUSERPASS)
+ #upload(BASE, TITLE, DESTDIR, SOURCEDIR, USERNAME, PASSWORD, encodedUSERPASS)
+ init(BASE, TITLE, DESTDIR, SOURCEDIR, USERNAME, PASSWORD, encodedUSERPASS)
+
site_list = open(site_list_file,'r')
for site in site_list.readlines():
site = site[0:len(site)-1]
- print site
- file = site.replace('/','_')
- file = img_dir+os.sep+site+'.png'
- get_thumbnail('http://'+site, file,'large')
- #command = 'webthumb http://'+ site +' | pnmscale -xysize 650 400 | ' + \
- # 'pnmtopng | convert -crop 510x275+5+60 - ' + img_dir + os.sep + site +'.png'
- #print command
- #os.system(command)
+ if site:
+ print site
+ file = site.replace('/','_')
+ file = img_dir+os.sep+file+'.png'
+ print file
+ get_thumbnail('http://'+site, file,'large')
site_list.close()
print 'Webthumbs created !'