def _onMakeCacheSuccess(self, cacheType): cachecookie = self._getRepoDataDir() + '/' + 'cachecookie'; if not file_util.remove(cachecookie) or\ not file_util.writeToFile(cachecookie, '') or\ not file_util.chmod(cachecookie, 0666): Log.cout(Log.ERROR, 'Re-touch cachecookie failed') return False repomdTmpFile = self._getRepoDataDir() + '/' + \ self.repomdLocation.split('/')[-1]; if not file_util.rename(repomdTmpFile + '.tmp', repomdTmpFile): return False return self._processTmpFile(cacheType, True)
def _processTmpFile(self, cacheType, success): nameList = [] if cacheType == PRIMARY_TYPE: nameList.append(PRIMARY_FILE) elif cacheType == PRIMARYDB_TYPE: nameList.append(PRIMARYDB_FILE) elif cacheType == ALL_TYPE: nameList.append(PRIMARY_FILE) nameList.append(PRIMARYDB_FILE) for name in nameList: fileName = self._getRepoDataDir() + '/' + name if not file_util.exists(fileName + '.tmp'): continue if success: if not file_util.rename(fileName + '.tmp', fileName): return False else: if not file_util.remove(fileName + '.tmp'): return False if not file_util.remove(fileName + '.gz'): return False return True
if not repoMd.repoMdDatas.has_key(metaName): Log.cout(Log.ERROR, '%s not found in repomd.xml' % metaName) return False metaObj = repoMd.repoMdDatas[metaName] return self._checkSumValid(metaObj, metaFile) def _onMakeCacheSuccess(self, cacheType): cachecookie = self._getRepoDataDir() + '/' + 'cachecookie' if not file_util.remove(cachecookie) or\ not file_util.writeToFile(cachecookie, '') or\ not file_util.chmod(cachecookie, 0666): Log.cout(Log.ERROR, 'Re-touch cachecookie failed') return False repomdTmpFile = self._getRepoDataDir() + '/' + \ self.repomdLocation.split('/')[-1] if not file_util.rename(repomdTmpFile + '.tmp', repomdTmpFile): return False return self._processTmpFile(cacheType, True) def _onMakeCacheFailed(self, cacheType): repomdTmpFile = self._getRepoDataDir() + '/' + \ self.repomdLocation.split('/')[-1] if not file_util.remove(repomdTmpFile + '.tmp'): return False return self._processTmpFile(cacheType, False) def _processTmpFile(self, cacheType, success): nameList = [] if cacheType == PRIMARY_TYPE: nameList.append(PRIMARY_FILE) elif cacheType == PRIMARYDB_TYPE:
import midi_util import audio_util import file_util print("Cleaning up filenames") file_util.rename('.png', '.png.png', '.png') file_util.rename('.mid', '.midi.mid', '.mid') file_util.rename('.PNG', '.PNG', '.png') print("DONE") print("Slowing down MIDI Files") midi_util.slow_down_midi() print("DONE") print("Rendering all MIDI to WAV") audio_util.convert_all_mid_to_wav() print("DONE") print("Converting WAV to MP3 - this takes a while") audio_util.convert_all_wav_to_mp3() print("DONE") print("Deleting all WAV files") file_util.delete_all(".wav") print("DONE")