1 | from zope.app.event import objectevent |
---|
2 | from p4a.audio.atct import _atct |
---|
3 | from p4a.audiopatch.interfaces import IAudioEncoded |
---|
4 | |
---|
5 | class AudioEncodingChangedEvent(objectevent.ObjectEvent): |
---|
6 | """Audio encoding changed. |
---|
7 | """ |
---|
8 | |
---|
9 | #event handler for IObjectModifiedEvent, |
---|
10 | #which repeats all functionality of _atct.sync_audio_metadata |
---|
11 | #but adds some neccesary assignment |
---|
12 | def sync_audio_metadata(obj, evt): |
---|
13 | __doc__ = _atct.sync_audio_metadata.__doc__ |
---|
14 | |
---|
15 | _atct.sync_audio_metadata(obj, evt) |
---|
16 | |
---|
17 | #audio._save_audio_metadata() stores id3 tag in 2.4 version |
---|
18 | #and converts tag's text frames to 'utf-8'. That's why original_encoding |
---|
19 | #will be different, also encoding isn't useful now. |
---|
20 | #And we must set encoding and original_encoding to "". |
---|
21 | # |
---|
22 | #raised AttributeError: can't set attribute, but I don't know why |
---|
23 | # |
---|
24 | audio_encoded = IAudioEncoded(obj) |
---|
25 | audio_encoded.original_encoding = "" |
---|
26 | audio_encoded.encoding = "" |
---|
27 | |
---|
28 | #from zope.app.annotation.interfaces import IAnnotations |
---|
29 | #from p4a.audiopatch.adapters import _ATCTFileAudioEncoded |
---|
30 | # |
---|
31 | #encoding_data = IAnnotations(obj).get(_ATCTFileAudioEncoded.ENCODING_KEY) |
---|
32 | #encoding_data["encoding"] = encoding_data["original_encoding"] = "" |
---|