当前位置: 首页>>代码示例>>Python>>正文


Python Element.writexml方法代码示例

本文整理汇总了Python中xml.dom.minidom.Element.writexml方法的典型用法代码示例。如果您正苦于以下问题:Python Element.writexml方法的具体用法?Python Element.writexml怎么用?Python Element.writexml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xml.dom.minidom.Element的用法示例。


在下文中一共展示了Element.writexml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check

# 需要导入模块: from xml.dom.minidom import Element [as 别名]
# 或者: from xml.dom.minidom.Element import writexml [as 别名]

#.........这里部分代码省略.........
            if producer=="black_track":
                print "skipping black track"
            else:
                # measn this is video track
                videoTrackId=videoTrackId+1
                
            
                print "not a black track"
                print "TRACK: Video"+str(videoTrackId)
                # lets look for playlist of such name
                playlist=k.getGivenPlaylist(producer)

                [fcp_video_track, fcp_audio_track] = parse_playlist(k, playlist)
                if fcp_video_track!=None:
                    o_video.appendChild(fcp_video_track)
                for track in range(0,2):
                    o_audio.appendChild(fcp_audio_track[track])
    for t in audio_tracks_for_later:
        print 'doing audio track postponed'
        producer=t.getAttribute("producer")
        # lets look for playlist of such name
        playlist=k.getGivenPlaylist(producer)

        [fcp_video_track, fcp_audio_track] = parse_playlist(k, playlist)
        print "after parsing returned video_track="+str(fcp_video_track)+" audio_track="+str(fcp_audio_track)
        for ch in range(0,2):
            o_audio.appendChild(fcp_audio_track[ch])
                
                
#                 entries=playlist.childNodes
#                 print entries
#                 for e in entries:
#                     if e.nodeType!=e.ELEMENT_NODE:
#                         continue
#                     tagName=e.tagName
#                     if tagName=="blank":
#                         blank_len=e.getAttribute("length")
#                         playlist_current_frame = playlist_current_frame + int(blank_len)
#                         continue
#                     else:
#                         e_in = int(e.getAttribute("in"))
#                         e_out = int(e.getAttribute("out"))
#                         e_len=e_out-e_in
#                         e_p = e.getAttribute("producer")
#                         clip = k.getGivenProducer(e_p)
#                         print "producer for this entry found"
#                         properties = clip.getElementsByTagName("property")
#                         clip_resource=""
#                         clip_len="1"
#                         for my_prop in properties:
#                             n=my_prop.getAttribute("name")
#                             if n=="resource":
#                                 clip_resource=get_first_value(my_prop)
#                             if n=="length":
#                                 clip_len=get_first_value(my_prop)
#                         clip_resource_basename=os.path.basename(clip_resource)
#                         
#                         o_clipitem = Element("clipitem")
#                         o_clipitem.appendChild(create_simple_element("name", clip_resource_basename))
#                         o_clipitem.appendChild(create_simple_element("duration", str(e_len)))
#                         o_clipitem.appendChild(create_rate())
#                         o_clipitem.appendChild(create_simple_element("start", str(playlist_current_frame)))
#                         o_clipitem.appendChild(create_simple_element("end", str(playlist_current_frame+e_len)))
#                         o_clipitem.appendChild(create_simple_element("in", str(e_in)))
#                         o_clipitem.appendChild(create_simple_element("out", str(e_out)))
#                         
#                         o_file = Element("file")
#                         o_file.appendChild(create_simple_element("name", clip_resource_basename))
#                         o_pathurl=create_simple_element("pathurl", clip_resource)
#                         o_file.appendChild(o_pathurl)
#                         o_file.appendChild(create_simple_element("duration", clip_len))
#                         o_file_media = Element("media")
#                         o_file_media_video = Element("video")
#                         o_file_media_video.appendChild(create_simple_element("duration", clip_len))
#                         o_file_media_audio = Element("audio")
#                         o_file_media_audio_channelcount = create_simple_element("channelcount", producer_get_audio_channels_from_properties(properties))
#                         o_file_media_audio.appendChild(o_file_media_audio_channelcount)
#                         o_file_media.appendChild(o_file_media_video)
#                         o_file_media.appendChild(o_file_media_audio)
#                         o_file.appendChild(o_file_media)
# 
#                         o_clipitem.appendChild(o_file)
#                         o_sourcetrack = Element("sourcetrack")
#                         o_sourcetrack.appendChild(create_simple_element("mediatype", "video"))
#                         o_clipitem.appendChild(o_sourcetrack)
#                         o_track.appendChild(o_clipitem)
#                         playlist_current_frame = playlist_current_frame+e_len
#                 o_track.appendChild(create_simple_element("enabled", "TRUE"))
#                 o_track.appendChild(create_simple_element("locked", "FALSE"))
#                 o_video.appendChild(o_track)
    o_media.appendChild(o_video)
    o_media.appendChild(o_audio)
    o_sequence.appendChild(o_media)
    #print o_sequence.toprettyxml("  ")
    o_xmeml=Element("xmeml")
    o_xmeml.setAttribute("version", "5")
    o_sequence.appendChild(create_simple_element("ismasterclip", "FALSE"))
    o_xmeml.appendChild(o_sequence)
    f=file('fcp.xml','w')
    o_xmeml.writexml(f,"","  ","\n")
开发者ID:pnikiel,项目名称:KdenliveToFcp,代码行数:104,代码来源:kdenlive_to_fcp.py


注:本文中的xml.dom.minidom.Element.writexml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。