Skip to content

Instantly share code, notes, and snippets.

@ikolar
Created August 12, 2009 12:12
Show Gist options
  • Save ikolar/166469 to your computer and use it in GitHub Desktop.
Save ikolar/166469 to your computer and use it in GitHub Desktop.
mk_kaltura_includes_table.sh
#! /bin/bash
#
# Create a simple html table with html include codes ("<object ...>") for all batch-uploaded kaltura.com videos.
# Assist ppl in migrating a large number of videos to kaltura.
#
# Copyright 2009 Igor Kolar <igor.kolar@gmail.com>
# Licensed under the EUPL, Version 1.1 or – as soon they
# will be approved by the European Commission -
# subsequent versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the
# Licence.
# You may obtain a copy of the Licence at:
# => http://ec.europa.eu/idabc/eupl 5
#
# Unless required by applicable law or agreed to in
# writing, software distributed under the Licence is
# distributed on an "AS IS" basis,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied.
# See the Licence for the specific language governing
# permissions and limitations under the Licence.
# from the flash administration console
UPLOAD_LOGS="http://cdn.kaltura.com/content/batchfiles/35562/log_211694_2009-08-11_18-18-30.csv (luksuz)
http://cdn.kaltura.com/content/batchfiles/35562/log_211664_2009-08-11_17-43-23.csv (etnografija)
http://cdn.kaltura.com/content/batchfiles/35562/log_211477_2009-08-11_07-10-54.csv (test)"
# header
cat <<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Include codes for all indiescreen.org videos at kaltura.org</title>
</head>
<body>
<h1>Include codes for all indiescreen.org videos at kaltura.org</h1>
<p>Last change: $(date)</p>
<p>Included upload logs:
<pre>
$UPLOAD_LOGS
</pre>
</p>
<p>Notes:
<ul>
<li>To embed these videos, just copy the include code into a wordpress post. Examples <a href="#example">bellow</a> and one on my <a href="http://www.kiberpipa.org/~ike/blog/?p=11">would-be makeshift blog</a>.</li>
<li>Non- Latin-1 chars are missing, but that is Kaltura's fault :(.</li>
</ul>
</p>
<table border="1">
<tr>
<th>Video title</th>
<th>Include code</th>
</tr>
EOD
# body = one big table
for LOG in $UPLOAD_LOGS; do
# "Ajda Es: Vizualna predstavitev uspavanja otrok","Iz zbirke Oddelka za etnologijo in kulturno antropologijo, Filozofska fakulteta v Ljubljani","ETNO, ETNO-Ajda_Es-Vizualna_predstavitev_uspavanja_otrok",http://ike.kiberpipa.org/media/neodvisnifilm/ETNO-Ajda_Es-Vizualna_predstavitev_uspavanja_otrok.mp4,Video,nww2jfmqjo,Ready
# Need two fields - first (video title) and last (video id)
wget -q $(echo "$LOG" | awk '{print $1}') -O - | sed -nre 's/,[^,]+$//; s@^"([^"]+)",.*,([^,]*)$@<tr>\
<td valign="top">\1</td>\
<td>\
<textarea cols="100" rows="12">\
<object name="kaltura_player" id="kaltura_player" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" height="335" width="400" data="http://www.kaltura.com/index.php/kwidget/cache_st/1250019402/wid/_35562/uiconf_id/48410/entry_id/\2"><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="bgcolor" value="#000000" /><param name="movie" value="http://www.kaltura.com/index.php/kwidget/cache_st/1250019402/wid/_35562/uiconf_id/48410/entry_id/\2"/><param name="flashVars" value=""/><param name="wmode" value="opaque"/><a href="http://corp.kaltura.com">video platform</a><a href="http://corp.kaltura.com/technology/video_management">video management</a><a href="http://corp.kaltura.com/solutions/overview">video solutions</a><a href="http://corp.kaltura.com/technology/video_player">free video player</a></object></textarea>\
</td>\
</tr>@p'
done
# footer, with an example
cat <<EOD
</table>
<p>Example:<br/>
<a name="example"/>
<object name="kaltura_player" id="kaltura_player" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" height="335" width="400" data="http://www.kaltura.com/index.php/kwidget/cache_st/1250019402/wid/_35562/uiconf_id/48410/entry_id/py4k6jqzfw"><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="bgcolor" value="#000000" /><param name="movie" value="http://www.kaltura.com/index.php/kwidget/cache_st/1250019402/wid/_35562/uiconf_id/48410/entry_id/py4k6jqzfw"/><param name="flashVars" value=""/><param name="wmode" value="opaque"/><a href="http://corp.kaltura.com">video platform</a><a href="http://corp.kaltura.com/technology/video_management">video management</a><a href="http://corp.kaltura.com/solutions/overview">video solutions</a><a href="http://corp.kaltura.com/technology/video_player">free video player</a></object>
</p>
</body>
</html>
EOD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment