Skip to content

Commit

Permalink
mk_mlt functional.
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlFK committed May 16, 2015
1 parent 4702467 commit 2c9c567
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 108 deletions.
3 changes: 2 additions & 1 deletion dj/main/templates/show_anomalies.html
Expand Up @@ -88,9 +88,10 @@ <h1>Duplicate slugs</h1>
<hr>

<h1>Long strings</h1>
max name: #{{max_name_ep.id}} <a href="E/{{max_name_ep.id}}/">{{ max_name_ep.name }}</a><br/>
max name: #{{max_name_ep.id}} <a href="E/{{max_name_ep.id}}/">{{ max_name_ep.name |upper }}</a><br/>
<hr>
max authors: # {{max_authors_ep.id}} <a href="E/{{max_authors_ep.id}}/">{{ max_authors_ep.authors }}</a>
max authors: # {{max_authors_ep.id}} <a href="E/{{max_authors_ep.id}}/">{{ max_authors_ep.authors|upper }}</a>

<hr>

Expand Down
40 changes: 21 additions & 19 deletions dj/scripts/mk_mlt.py
Expand Up @@ -25,8 +25,9 @@ def set_text(node,prop_name,value=None):
# grab nodes we are going to store values into
nodes={}
for id in [
'pi_title_img', 'tl_title',
'pi_foot_img', 'tl_foot',
'pi_title_img', 'ti_title',
'pi_foot_img', 'ti_foot',
# 'spacer',
'pl_vid0', 'pi_vid0', # Play List and Item
'tl_vid2', 'ti_vid2', # Time Line and Item
'audio_fade_in', 'audio_fade_out',
Expand All @@ -37,6 +38,11 @@ def set_text(node,prop_name,value=None):
print(id,node)
nodes[id] = node

# special case because Shotcut steps on the id='spacer'
# <playlist id="playlist1">
# <blank id="spacer" length="00:00:00.267"/>
nodes['spacer'] = tree.find("./playlist[@id='playlist1']blank")

# remove all placeholder nodes
mlt = tree.find('.')

Expand All @@ -51,7 +57,6 @@ def set_text(node,prop_name,value=None):
# <playlist id="playlist0">
# <entry producer="tl_vid1" in="00:00:00.667" out="00:00:03.003" sample="1" />
time_line = tree.find("./playlist[@id='playlist0']")
# import code; code.interact(local=locals())
for te in time_line.findall("./entry[@sample]"):
print("te",te)
producer = te.get('producer')
Expand Down Expand Up @@ -79,14 +84,15 @@ def set_text(node,prop_name,value=None):
pi.set("id", node_id)
del pi.attrib["in"]
del pi.attrib["out"]
# set_text(pi,'length')
set_text(pi,'length')
mlt.insert(0,pi)

set_text(pi,'resource',clip['filename'])

# add each cut to the timeline
# apply audio fade in/out to first/last cut
first = True
total_length = 0
for cut in params['cuts']:

node_id = "ti_vid{}".format(cut['id'])
Expand All @@ -102,7 +108,7 @@ def set_text(node,prop_name,value=None):
ti.set("id", node_id)
del ti.attrib["in"]
del ti.attrib["out"]
set_text(pi,'length')
set_text(ti,'length')
set_text(ti,'resource',clip['filename'])

if first:
Expand All @@ -111,28 +117,23 @@ def set_text(node,prop_name,value=None):

mlt.insert(0,ti)

total_length += cut['length']

# ti is left over from the above loop
ti.insert(0,nodes['audio_fade_out'])


# find first cut:
cut = params['cuts'][0]
node_id = "ti_vid{}".format(cut['id'])


print("checking...")

for pe in play_list.findall("./entry[@sample]"):
producer = pe.get('producer')
print(producer)

# set title screen image
set_text(nodes['pi_title_img'],'resource',params['title_img'])
set_text(nodes['tl_title'],'resource',params['title_img'])
set_text(nodes['ti_title'],'resource',params['title_img'])

# set footer image
set_text(nodes['pi_foot_img'],'resource',params['foot_img'])
set_text(nodes['tl_foot'],'resource',params['foot_img'])
set_text(nodes['ti_foot'],'resource',params['foot_img'])

# set the lenght of the spacer so it puts the footer image to end-5sec
# Duration: 27mn 53s
# nodes['ti_foot'].set("in",str(total_length))
nodes['spacer'].set("length","00:27:46.00")

tree.write(output)

Expand Down Expand Up @@ -160,6 +161,7 @@ def test():
'filename':'/home/carl/Videos/veyepar/dot_net_fringe/dot_net_fringe_2015/dv/main_stage/2015-04-14/09_02_51.dv',
'in':1,
'out':None,
'length':1673, # Duration: 27mn 53s
},],
'audio_level': None,
'channel_copy': None,
Expand Down
10 changes: 5 additions & 5 deletions dj/scripts/template.mlt
Expand Up @@ -192,7 +192,7 @@
<entry id="tl_vid2" producer="ti_vid2" in="00:00:00.000" out="00:00:03.003" sample="2" />
<entry producer="ti_vid3" in="00:00:00.000" out="00:00:01.902" sample="3" />
</playlist>
<producer id="tl_title" title="Anonymous Submission" in="00:00:00.000" out="00:09:59.960">
<producer id="ti_title" title="Anonymous Submission" in="00:00:00.000" out="00:09:59.960">
<property name="mlt_type">producer</property>
<property name="length">00:09:59.993</property>
<property name="eof">pause</property>
Expand All @@ -216,7 +216,7 @@
<property name="alpha">0=1; 89=0</property>
</filter>
</producer>
<producer id="tl_foot" title="Anonymous Submission" in="00:00:00.000" out="00:09:59.960">
<producer id="ti_foot" title="Anonymous Submission" in="00:00:00.000" out="00:09:59.960">
<property name="mlt_type">producer</property>
<property name="length">00:09:59.993</property>
<property name="eof">pause</property>
Expand All @@ -242,9 +242,9 @@
<playlist id="playlist1">
<property name="shotcut:video">1</property>
<property name="shotcut:name">V2</property>
<entry producer="tl_title" in="00:00:00.000" out="00:00:03.937"/>
<blank length="00:00:00.267"/>
<entry producer="tl_foot" in="00:00:00.000" out="00:00:04.805"/>
<entry producer="ti_title" in="00:00:00.000" out="00:00:03.937"/>
<blank id="spacer" length="00:00:00.267"/>
<entry producer="ti_foot" in="00:00:00.000" out="00:00:04.805"/>
</playlist>
<tractor id="tractor0" title="Anonymous Submission" global_feed="1" in="00:00:00.000" out="00:00:09.042">
<property name="shotcut">1</property>
Expand Down
83 changes: 0 additions & 83 deletions tests/melt/shotcut/xmlsplunk.py

This file was deleted.

0 comments on commit 2c9c567

Please sign in to comment.