def __call__(self, abctext, uuid, makeMP3): # need to remove 'view' at the end if present abctune = uuidToObject(uuid) sm = getSecurityManager() if not sm.checkPermission(ModifyPortalContent, abctune): return abctune.abc = abctext addTuneType(abctune) addOrigins(abctune) addKeys(abctune) _make_midi(abctune) _make_score(abctune) # _make_PDFscore(abctune) if makeMP3 != '0': _make_mp3(abctune) logger.info('lance _make_mp3') # import pdb;pdb.set_trace() abctune.modification_date = DateTime() logger.info(abctune.modified()) logger.info('"' + abctune.title + '" updated') parent = abctune.aq_parent if parent.portal_type == 'abctuneset': # logger.info('in updateTune.updateTune') updateTuneSet(parent) site = getSite() catalog = site.portal_catalog catalog.reindexObject(abctune) return 1
def updateTuneSet(context): logger.info('abctuneset.updateTuneSet : ' + context.portal_type) partsTags = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'] num_parts = 0 P_header = 'P:' abcTunes = [abctune for abctune in context.objectValues() if abctune.portal_type == 'abctune'] abc = '' combinedTitle = '' for tune in abcTunes: combinedTitle += getFirstTitle(tune.abc) nbtunes = len(abcTunes) - 1 if abcTunes.index(tune) < nbtunes: combinedTitle += ' / ' # aff (tune.abc) # return abcreorgenized, parts = reorgenize(tune.abc, partsTags[num_parts]) num_parts += 1 P_header += parts abc += abcreorgenized context.combinedTitle = 'T: ' + combinedTitle context.abc = 'X:1\n' + context.combinedTitle + '\n' context.abc += P_header + '\n' context.abc += abc _make_midi(context) _make_score(context) site = getSite() catalog = site.portal_catalog catalog.reindexObject(context) logger.info('"' + context.title + '" updated')
def updateTuneSet(context): logger.info('abctuneset.updateTuneSet : ' + context.portal_type) partsTags = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'] num_parts = 0 P_header = 'P:' abcTunes = [ abctune for abctune in context.objectValues() if abctune.portal_type == 'abctune' ] abc = '' combinedTitle = '' for tune in abcTunes: combinedTitle += getFirstTitle(tune.abc) nbtunes = len(abcTunes) - 1 if abcTunes.index(tune) < nbtunes: combinedTitle += ' / ' # aff (tune.abc) # return abcreorgenized, parts = reorgenize(tune.abc, partsTags[num_parts]) num_parts += 1 P_header += parts abc += abcreorgenized context.combinedTitle = 'T: ' + combinedTitle context.abc = 'X:1\n' + context.combinedTitle + '\n' context.abc += P_header + '\n' context.abc += abc _make_midi(context) _make_score(context) site = getSite() catalog = site.portal_catalog catalog.reindexObject(context) logger.info('"' + context.title + '" updated')
def newAbcTune(context, event): try: context.abc = removeNonAscii(context.abc) addQ(context) addTuneType(context) addOrigins(context) addKeys(context) _make_midi(context) _make_score(context) # _make_mp3(context) logger.info("abc created !") except: logger.info("abctune not created...")
def updateAbcTune(context, event): try: context.abc = removeNonAscii(context.abc) addQ(context) addTuneType(context) addOrigins(context) addKeys(context) _make_midi(context) _make_score(context) parent = context.aq_parent if parent.portal_type == 'abctuneset': log = '(IObjectModifiedEvent)abctune.updateAbcTune ' log += parent.portal_type logger.info(log) notify(TuneInTuneSetModified(context)) # _make_mp3(context) except: logger.info("updateAbcTune : abctune not modified...")