Line 67: |
Line 67: |
| | | |
| Due to: [http://bugs.sugarlabs.org/ticket/4345 SL#4345] | | Due to: [http://bugs.sugarlabs.org/ticket/4345 SL#4345] |
| + | |
| + | New Gst.TagList: |
| + | |
| + | '''Replace:''' |
| + | |
| + | taglist = self._get_tags(constants.TYPE_AUDIO) |
| + | |
| + | if self._audio_pixbuf: |
| + | pixbuf_b64 = utils.getStringFromPixbuf(self._audio_pixbuf) |
| + | taglist[gst.TAG_EXTENDED_COMMENT] = "coverart=" + pixbuf_b64 |
| + | |
| + | vorbis_enc = audioline.get_by_name('audioVorbisenc') |
| + | vorbis_enc.merge_tags(taglist, gst.TAG_MERGE_REPLACE_ALL) |
| + | |
| + | '''With:''' |
| + | |
| + | taglist = self._get_tags(constants.TYPE_AUDIO) |
| + | |
| + | if self._audio_pixbuf: |
| + | pixbuf_b64 = utils.getStringFromPixbuf(self._audio_pixbuf) |
| + | |
| + | taglist.add_value( |
| + | Gst.TagMergeMode.REPLACE, |
| + | Gst.TAG_EXTENDED_COMMENT, |
| + | "coverart=" + pixbuf_b64) |
| + | |
| + | vorbis_enc = audioline.get_by_name('audioVorbisenc') |
| + | vorbis_enc.merge_tags(taglist, Gst.TagMergeMode.REPLACE_ALL) |
| + | |
| + | '''Replace:''' |
| + | |
| + | taglist = self._get_tags(constants.TYPE_VIDEO) |
| + | vorbis_enc = muxline.get_by_name('muxVorbisenc') |
| + | vorbis_enc.merge_tags(taglist, gst.TAG_MERGE_REPLACE_ALL) |
| + | |
| + | '''With:''' |
| + | |
| + | taglist = self._get_tags(constants.TYPE_VIDEO) |
| + | vorbis_enc = muxline.get_by_name('muxVorbisenc') |
| + | vorbis_enc.merge_tags(taglist, Gst.TagMergeMode.REPLACE_ALL) |
| + | |
| + | '''Replace:''' |
| + | |
| + | def _get_tags(self, type): |
| + | tl = gst.TagList() |
| + | tl[gst.TAG_ARTIST] = self.model.get_nickname() |
| + | tl[gst.TAG_COMMENT] = "olpc" |
| + | #this is unfortunately, unreliable |
| + | #record.Record.log.debug("self.ca.metadata['title']->" + str(self.ca.metadata['title']) ) |
| + | tl[gst.TAG_ALBUM] = "olpc" #self.ca.metadata['title'] |
| + | tl[gst.TAG_DATE] = utils.getDateString(int(time.time())) |
| + | stringType = constants.MEDIA_INFO[type]['istr'] |
| + | |
| + | # Translators: photo by photographer, e.g. "Photo by Mary" |
| + | tl[gst.TAG_TITLE] = _('%(type)s by %(name)s') % {'type': stringType, |
| + | 'name': self.model.get_nickname()} |
| + | return tl |
| + | |
| + | '''With:''' |
| + | |
| + | def _get_tags(self, type): |
| + | |
| + | taglist = Gst.TagList.new_empty() |
| + | |
| + | taglist.add_value( |
| + | Gst.TagMergeMode.REPLACE, |
| + | Gst.TAG_ARTIST, |
| + | self.model.get_nickname()) |
| + | |
| + | taglist.add_value( |
| + | Gst.TagMergeMode.REPLACE, |
| + | Gst.TAG_COMMENT, |
| + | "olpc") |
| + | |
| + | #this is unfortunately, unreliable |
| + | #record.Record.log.debug("self.ca.metadata['title']->" + str(self.ca.metadata['title']) ) |
| + | |
| + | taglist.add_value( |
| + | Gst.TagMergeMode.REPLACE, |
| + | Gst.TAG_ALBUM, |
| + | "olpc") #self.ca.metadata['title'] |
| + | |
| + | taglist.add_value( |
| + | Gst.TagMergeMode.REPLACE, |
| + | Gst.TAG_DATE, |
| + | utils.getDateString(int(time.time()))) |
| + | |
| + | stringType = constants.MEDIA_INFO[type]['istr'] #self.ca.metadata['title'] |
| + | |
| + | taglist.add_value( |
| + | Gst.TagMergeMode.REPLACE, |
| + | Gst.TAG_TITLE, |
| + | _('%(type)s by %(name)s') % {'type': stringType, |
| + | 'name': self.model.get_nickname()}) |
| + | |
| + | return taglist |
| | | |
| =From Pixmap to Pixbuf= | | =From Pixmap to Pixbuf= |