def METHOD_NAME(recording):
    recording.comment = ""
    recording.save()
    add_comment(recording.id, "Start at %s\n--\n" % datetime.datetime.now())
    try:
        xmldoc = minidom.parse(recording.source_file)
    except KeyError as e:
        add_comment(recording.id, "Error : %s" % e)
        return -1
    videos = getElementsByName(xmldoc, "track")
    catalogs = getElementsByName(xmldoc, "catalog")
    title = ""
    clip_begin = None
    clip_end = None
    att_presenter = getAttributeByName(xmldoc, "mediapackage", "presenter")
    presenter = (
        att_presenter
        if (att_presenter in ["mid", "piph", "pipb"])
        else OPENCAST_DEFAULT_PRESENTER
    )
    for catalog in catalogs:
        xmldoc = minidom.parse(catalog.get("src"))
        if catalog.get("type") == "dublincore/episode":
            title = getElementValueByName(xmldoc, "dcterms:title")
            change_title(recording, title)
        if catalog.get("type") == "smil/cutting":
            beginDefault = getAttributeByName(xmldoc, "video", "clipBegin")
            endDefault = getAttributeByName(xmldoc, "video", "clipEnd")
            clip_begin = (
                str(round(float(beginDefault.replace("s", "")), 2))
                if (beginDefault)
                else None
            )
            clip_end = (
                str(round(float(endDefault.replace("s", "")), 2))
                if (endDefault)
                else None
            )
    if clip_begin or clip_end or len(videos) > 1:
        msg = "*** generate_intermediate_video (%s) %s ***" % (
            videos[0].get("type"),
            videos[0].get("src"),
        )
        add_comment(recording.id, msg)
        generate_intermediate_video(recording, videos, clip_begin, clip_end, presenter)
    else:
        msg = "*** Management of basic video file (%s) %s ***" % (
            videos[0].get("type"),
            videos[0].get("src"),
        )
        add_comment(recording.id, msg)
        video = save_basic_video(
            recording,
            os.path.join(settings.MEDIA_ROOT, OPENCAST_FILES_DIR, videos[0].get("src")),
        )
        # encode video
        encode_video = getattr(encode, ENCODE_VIDEO)
        encode_video(video.id)