note_string=(self.current.path+' | '+self.current.notes+'\n')
f.write(note_string)
f.close()
-
- def help_notelog(self):
- print '''
-NOTELOG
-Writes a log of the notes taken during the session for the current
-playlist
---------------
-Syntax notelog [filename]
-'''
- def do_notelog(self,args):
-
- if len(args)==0:
- args=linp.safeinput('Notelog filename?',['notelog.txt'])
-
- note_lines='Notes taken at '+time.asctime()+'\n'
- for item in self.current_list:
- if len(item.notes)>0:
- #FIXME: log should be justified
- #FIXME: file path should be truncated...
- note_string=(item.path+' | '+item.notes+'\n')
- note_lines+=note_string
-
- try:
- f=open(args,'a+')
- f.write(note_lines)
- f.close()
- except IOError, (ErrorNumber, ErrorMessage):
- print 'Error: notes cannot be saved. Catched exception:'
- print ErrorMessage
-
- self.notes_saved=1
-
- def help_copylog(self):
- print '''
-COPYLOG
-Moves the annotated curves to another directory
------------
-Syntax copylog [directory]
- '''
- def do_copylog(self,args):
-
- if len(args)==0:
- args=linp.safeinput('Destination directory?') #TODO default
-
- mydir=os.path.abspath(args)
- if not os.path.isdir(mydir):
- print 'Destination is not a directory.'
- return
-
- for item in self.current_list:
- if len(item.notes)>0:
- try:
- shutil.copy(item.path, mydir)
- except (OSError, IOError):
- print 'Cannot copy file. '+item.path+' Perhaps you gave me a wrong directory?'