def finedecompress(name, verbose):
     Logger.log("FineDecompress "+name)
     
     audacity_data = File.datadirectoryFromName(name)
     verbose_arg = "v" if verbose else ""
     
     filelist = File.allFiles(audacity_data)
     if any(s.endswith(".au") for s in filelist):
         raise LogicError("existing .au file found during decompress")    
     
     Logger.log("Decompressing files")
     for compressedfile in filter(lambda x: x.endswith(".bz2"), filelist):
         Logger.log("Decompress "+compressedfile)
         output = subprocess.check_output(["bzip2", "-dk"+verbose_arg, compressedfile])
 def decompress(name, verbose, keep = False):
     Logger.log("Decompress "+name)
     
     archive = File.archiveFromName(name)
     audacity_data = File.datadirectoryFromName(name)
     verbose_arg = "v" if verbose else ""
     
     if os.path.isfile(archive) == False:
         raise LogicError("audio archive " + archive + " does not exist.")
     
     if os.path.isdir(audacity_data):
         raise LogicError("audio data directory " + audacity_data + " does already exist. Will not overwrite existing files.")
     
     Logger.log(" Decompressing")
     output = subprocess.check_output(["tar", "-xj"+verbose_arg+"f", archive, audacity_data])
     Logger.log(output)
     
     if keep is False:
         Logger.log(" Deleting old data")
         os.remove(archive)
Esempio n. 3
0
 def setData(self, index, value, role=Qt.EditRole):
     row = index.row()
     col = index.column()
     
     project = File.allProjects(os.getcwd())[row]
     metadatakey = Metadata.listUsedAnnotations(os.getcwd())[col]
     value = str(value.toPyObject())
     
     Metadata.setMetadata(project, metadatakey, value)
     
     return True
 def finecompress(name, verbose):
     Logger.log("FineCompress "+name)
     
     audacity_data = File.datadirectoryFromName(name)
     verbose_arg = "v" if verbose else ""
     
     Logger.log("Deleting .bz2 files with no matching .au files")
     for compressedfile in filter(lambda x: x.endswith(".bz2"), File.allFiles(audacity_data)):
         audiofile = os.path.splitext(compressedfile)[0]
 
         if not os.path.exists(audiofile):
             Logger.log(compressedfile + " should match " + audiofile + " but does not exist anymore. Deleting.")
             os.remove(compressedfile)
     
     Logger.log("Compressing modified audio files")
     for audiofile in filter(lambda x: x.endswith(".au"), File.allFiles(audacity_data)):     
         compressedfile=audiofile+".bz2"
         if not os.path.exists(compressedfile) or File.fileModificationTimestamp(audiofile) > File.fileModificationTimestamp(compressedfile):
             Logger.log("Compress "+audiofile)
             output = subprocess.check_output(["bzip2", "-zf"+verbose_arg, audiofile])
         else:
             os.remove(audiofile)
Esempio n. 5
0
 def data(self, index, role):
     if not index.isValid():
         return QVariant()
     elif role != Qt.DisplayRole and role != Qt.EditRole:
         return QVariant()
     
     project = File.allProjects(os.getcwd())[index.row()]
     metadatakey = Metadata.listUsedAnnotations(os.getcwd())[index.column()]
     annotations = Metadata.getAnnotations(project)
     if annotations.has_key(metadatakey):
         metadatavalue = annotations[metadatakey]
     else:
         metadatavalue = "<NOT SET>"
         
     return QVariant(metadatavalue)
Esempio n. 6
0
    def headerData(self, section, orientation, role = QtCore.Qt.DisplayRole):
        if role == Qt.DisplayRole:
            if orientation == Qt.Horizontal:
                listUsedAnnotations = Metadata.listUsedAnnotations(os.getcwd())
                key = listUsedAnnotations[section]
            
                return QString(key)
            
            elif orientation == Qt.Vertical:
                project = File.allProjects(os.getcwd())[section]

                return QVariant(project)
            
        else:
            return QVariant()
Esempio n. 7
0
 def rowCount(self, parent):
     return len(File.allProjects(os.getcwd()))