#! /usr/bin/env python """ This program will allow annotating without taking your fingers off of the keyboard. Copyright (C) 2006 Scott Shawcroft This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. This program will allow annotating without taking your fingers off of the keyboard. It will automatically store start and stop times along with the text. """ from time_converter import * class clip: __start = 0 #an int in milliseconds __end = 0 #an int in milliseconds __text = "" __track = "" __speaker = "" def __init__(self,start,end,text,track=None,speaker=""): """This constructor takes 4 arguments with an optional fifth. Argument(s): start - start time in milliseconds end - end time in milliseconds text - string track - string speaker - string - default="" """ self.__start = start self.__end = end self.__text = text self.__speaker = speaker self.__track = track def set_start(self,time): """Sets the start time. Argument(s): time - time in milliseconds. """ self.__start = time def get_start(self): """Returns the start time in milliseconds.""" return self.__start def set_end(self,time): """Sets the end time. Argument(s): time - time in milliseconds. """ self.__end = time def get_end(self): """Returns the end time in milliseconds.""" return self.__end def set_text(self,text): """Sets the text. Argument(s): text - string. """ self.__text = text def get_text(self): """Returns the text.""" return self.__text def set_track(self,track): """Sets the track. Argument(s): track - string """ self.__track = track def get_track(self): """Returns the track.""" return self.__track def set_speaker(self,speaker): """Sets the speaker. Argument(s): speaker - string """ self.__speaker = speaker def get_speaker(self): """Returns the speaker as a string.""" return self.__speaker def get_duration(self): """Returns the duration in milliseconds.""" return self.__end - self.__start def __str__(self): return format_time(self.get_start()) + "-" + format_time(self.get_end()) + " : " + self.get_text()