Beispiel #1
0
def final_cut_pro_xml(request, annot_id):
    "support for http://developer.apple.com/mac/library/documentation/AppleApplications/Reference/FinalCutPro_XML/Topics/Topics.html"
    try:
        from xmeml import VideoSequence
        #http://github.com/ccnmtl/xmeml
        ann = get_object_or_404(SherdNote, pk=annot_id)
        xmeml = ann.asset.sources.get('xmeml', None)
        if xmeml is None:
            return HttpResponse("Not Found: This annotation's asset does not have a Final Cut Pro source XML associated with it", status=404)
        f = urllib2.urlopen(xmeml.url)
        assert f.code == 200
        v = VideoSequence(xml_string=f.read())
        clip = v.clip(ann.range1, ann.range2 ,units='seconds')
        xmldom,dumb_uuid = v.clips2dom([clip])
        res = HttpResponse(xmldom.toxml(), mimetype='application/xml')
        res['Content-Disposition'] = 'attachment; filename="%s.xml"' % ann.title
        return res

    except ImportError:
        return HttpResponse('Not Implemented: No Final Cut Pro Xmeml support', status=503)
Beispiel #2
0
def final_cut_pro_xml(request, asset_id):
    user = request.user
    if not user.is_staff:
        return HttpResponseForbidden()

    "support for http://developer.apple.com/mac/library/documentation/ \
    AppleApplications/Reference/FinalCutPro_XML/Topics/Topics.html"
    try:
        from xmeml import VideoSequence
        # http://github.com/ccnmtl/xmeml
        asset = get_object_or_404(Asset, pk=asset_id)

        xmeml = asset.sources.get('xmeml', None)
        if xmeml is None:
            return HttpResponse("Not Found: This annotation's asset does not \
            have a Final Cut Pro source XML associated with it", status=404)

        f = urllib2.urlopen(xmeml.url)
        assert f.code == 200
        v = VideoSequence(xml_string=f.read())

        clips = []

        keys = request.POST.keys()
        keys.sort(key=lambda x: int(x))
        for key in keys:
            sherd_id = request.POST.get(key)
            ann = asset.sherdnote_set.get(id=sherd_id, range1__isnull=False)
            if ann:
                clip = v.clip(ann.range1, ann.range2, units='seconds')
                clips.append(clip)

        xmldom, dumb_uuid = v.clips2dom(clips)
        res = HttpResponse(xmldom.toxml(), mimetype='application/xml')
        res['Content-Disposition'] = \
            'attachment; filename="%s.xml"' % asset.title
        return res

    except ImportError:
        return HttpResponse('Not Implemented: No Final Cut Pro Xmeml support',
                            status=503)
Beispiel #3
0
def final_cut_pro_xml(request, asset_id):
    user = request.user
    if not user.is_staff:
        return HttpResponseForbidden()

    "support for http://developer.apple.com/mac/library/documentation/AppleApplications/Reference/FinalCutPro_XML/Topics/Topics.html"
    try:
        from xmeml import VideoSequence
        #http://github.com/ccnmtl/xmeml
        asset = get_object_or_404(Asset, pk=asset_id)

        xmeml = asset.sources.get('xmeml', None)
        if xmeml is None:
            return HttpResponse(
                "Not Found: This annotation's asset does not have a Final Cut Pro source XML associated with it",
                status=404)

        f = urllib2.urlopen(xmeml.url)
        assert f.code == 200
        v = VideoSequence(xml_string=f.read())

        clips = []

        keys = request.POST.keys()
        keys.sort(key=lambda x: int(x))
        for key in keys:
            sherd_id = request.POST.get(key)
            ann = asset.sherdnote_set.get(id=sherd_id, range1__isnull=False)
            if ann:
                clip = v.clip(ann.range1, ann.range2, units='seconds')
                clips.append(clip)

        xmldom, dumb_uuid = v.clips2dom(clips)
        res = HttpResponse(xmldom.toxml(), mimetype='application/xml')
        res['Content-Disposition'] = 'attachment; filename="%s.xml"' % asset.title
        return res

    except ImportError:
        return HttpResponse('Not Implemented: No Final Cut Pro Xmeml support',
                            status=503)
Beispiel #4
0
from xmeml import VideoSequence

v1 = VideoSequence(file='examples/Conecta Test XML.xml')
v2 = VideoSequence(file='examples/Mark P XML.xml')
#print len(v1.track_items)

clip1 = v1.clip(1000, 4000, units='frames')
clip2 = v2.clip(300, 500, units='seconds')

xmldom1, dumb_uuid = v1.clips2dom([clip1])
xmldom2, dumb_uuid = v2.clips2dom([clip2])

#print xmldom1.toprettyxml() #probably won't work in Final Cut Pro
#print xmldom2.toxml()
Beispiel #5
0
from xmeml import VideoSequence

v1 = VideoSequence(file='examples/Conecta Test XML.xml')
v2 = VideoSequence(file='examples/Mark P XML.xml')
#print len(v1.track_items)

clip1 = v1.clip(1000, 4000, units='frames')
clip2 = v2.clip(300, 500, units='seconds')

xmldom1,dumb_uuid = v1.clips2dom([clip1])
xmldom2,dumb_uuid = v2.clips2dom([clip2])

#print xmldom1.toprettyxml() #probably won't work in Final Cut Pro
#print xmldom2.toxml()