def make_new_properties_list(self, verbose = False): """ make_new_properties_list: write a new csv file where you can assign title and captions to photos 20130103/RB: started the function The property list can be found in 'album_path + resources_dir + event_dir + 'props.csv''. To prevent overwriting old files with all captions, new files will always have a number appended. You have to manually change it to 'props.csv', as this file is used. """ HBFUN.verbose("HBevent/make_new_properties_list()", verbose) # get the list with photos source_list = os.listdir(self.source_path + self.event_dir_src) source_list = [n for n in source_list if n[-4:] == ".jpg"] # create a save filename prop_fn = "props" prop_ext = "txt" path_and_filename = HBFUN.file_numbering(self.album_path + self.resources_dir + self.event_dir, prop_fn, prop_ext) # write the properties csvfile = open(path_and_filename, "wb") csvwriter = csv.writer(csvfile, delimiter = ";") for i in range(len(source_list)): csvwriter.writerow([source_list[i], " ", " "]) csvfile.close()
def save_events_in_csv(self, verbose = False): """ 20130105/RB: started the function """ # create a save filename prop_ext = "txt" path_and_filename = HBFUN.file_numbering(self.album_path + self.resources_dir, self.events_csv_filename, prop_ext) # write the properties csvfile = open(path_and_filename, "wb") csvwriter = csv.writer(csvfile, delimiter = ";") for i in range(len(self.event_array)): ev = self.event_array[i] csvwriter.writerow([i, ev.event_title, ev.event_dir, ev.event_dir_src, ev.source_path, ev.event_thumb]) csvfile.close()