<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Revolución Movie Library</title>
	<atom:link href="http://revolucionlibrary.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://revolucionlibrary.wordpress.com</link>
	<description>Clean, simple, easy and it works</description>
	<lastBuildDate>Mon, 13 Jun 2011 22:48:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='revolucionlibrary.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Revolución Movie Library</title>
		<link>http://revolucionlibrary.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://revolucionlibrary.wordpress.com/osd.xml" title="Revolución Movie Library" />
	<atom:link rel='hub' href='http://revolucionlibrary.wordpress.com/?pushpress=hub'/>
		<item>
		<title>SecreTwit: Social Steganography</title>
		<link>http://revolucionlibrary.wordpress.com/2011/06/12/secretwit-social-steganography/</link>
		<comments>http://revolucionlibrary.wordpress.com/2011/06/12/secretwit-social-steganography/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 18:58:03 +0000</pubDate>
		<dc:creator>Željko</dc:creator>
				<category><![CDATA[secretwit]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[For developers]]></category>
		<category><![CDATA[Steganography]]></category>

		<guid isPermaLink="false">http://revolucionlibrary.wordpress.com/?p=139</guid>
		<description><![CDATA[Here is another project I would like to share. As before, this is a project for faculty course Security in computer networks. I read several good articles about steganography and got an idea to use tweets on Twitter to hide secret messages. Also, this was a great opportunity to do a little UI design in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=139&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://revolucionlibrary.files.wordpress.com/2011/06/secretwit_logo2.png"><img class="aligncenter size-full wp-image-159" title="SecreTwit Logo" src="http://revolucionlibrary.files.wordpress.com/2011/06/secretwit_logo2.png?w=447&#038;h=125" alt="SecreTwit Logo" width="447" height="125" /></a></p>
<p>Here is another project I would like to share. As <a title="cljMovieIndexer: Revolución’s baby brother" href="http://revolucionlibrary.wordpress.com/2010/06/26/cljmovieindexer-revolucions-baby-brother/" target="_blank">before</a>, this is a project for faculty course <em>Security in computer networks</em>.</p>
<p>I read <a href="http://blog.rlr-uk.com/2010/06/twitter-steganography.html" target="_blank">several</a> <a href="http://www.sci-pr0n.com/2010/08/steganography-hidden-at-plain-sight.html" target="_blank">good</a> <a href="http://www.zephoria.org/thoughts/archives/2010/08/23/social-steganography-learning-to-hide-in-plain-sight.html" target="_blank">articles</a> about <strong>steganography</strong> and got an idea to use tweets on Twitter to hide secret messages. Also, this was a great opportunity to do a little UI design in Swing after long time :)<span id="more-139"></span></p>
<h2>What is steganography ?</h2>
<blockquote><p>Steganography is the art and science of writing hidden messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity.</p></blockquote>
<p>There are many steganography techniques and you can find more about them in <a title="Steganography" href="http://en.wikipedia.org/wiki/Steganography" target="_blank">Wikipedia article</a>.</p>
<h2>How SecreTwit works ?</h2>
<p><strong>SecreTwit</strong> uses several steganography techniques to hide secret message inside a tweet. For the ordinary eye tweet will look just like any other. Only <strong>SecreTwit</strong> users can see hidden message.</p>
<h5>Whitespace steganography</h5>
<p><strong>SecreTwit</strong> conceals message in tweet by appending whitespaces to the end of the tweet. Each bit of a character is represented with a whitespace – 0 is a tab and 1 is an empty space. Web browsers replace multiple whitespaces with a single space so this will be invisible in the browser. Depending on the length of original message, over 100 bits can be used to hide secret message.</p>
<h5>URL steganography</h5>
<p>Relying on the fact that people usually won’t look very hard, <strong>SecreTwit</strong> uses fake <em>bit.ly</em> and <em>twitpic.com</em> URLs to hide parts of the message. Those two services are often used on Twitter so they won’t look strange. Part of the message is Base64 encoded and used to make up URL, so this makes 6 bytes per URL available for hiding messages.</p>
<h5>Image steganography</h5>
<p>Traditional image steganography technique is used to embed tag within user’s profile image. Tag is later used to determine whether the tweet has a secret message embedded with <strong>SecreTwit</strong>. Steganography method used here is the most common and simplest form of digital steganography called Least Significant Bit (LSB) method. Binary representation of the message that&#8217;s to be hidden is written into the LSB of the bytes of the image. The overall change to the image is so minor that it can&#8217;t be seen by the human eye.</p>
<h4>Implementation</h4>
<p>You can find the source code of these three techniques at <a href="http://code.google.com/p/secretwit/source/browse/#svn%2Ftrunk%2Fsrc%2Fcom%2Frevolucion%2Fsecretwit%2Fstego" target="_blank">SecreTwit project page</a>.</p>
<h2><a href="http://revolucionlibrary.files.wordpress.com/2011/06/how.png"><img class="aligncenter size-full wp-image-146" title="How it works" src="http://revolucionlibrary.files.wordpress.com/2011/06/how.png?w=614&#038;h=204" alt="How it works" width="614" height="204" /></a>SecreTwit UI</h2>
<p>Now the more interesting part :) The UI of <strong>SecreTwit</strong> is inspired by <a title="Metro" href="http://en.wikipedia.org/wiki/Metro_(design_language)" target="_blank">Metro</a> design language and <a title="MetroTwit" href="http://www.metrotwit.com/" target="_blank">MetroTwit</a> Twitter client. I liked the elegant and clean look, so my goal was to replicate the parts I liked using Swing and Java.</p>
<p>The trickiest part was the animation of the timeline with tweets. Each time new tweet appears it&#8217;s added to the top of the timeline, with slide from left and fade in effect. In order to achieve this I made a <a title="TimelineListUI" href="http://code.google.com/p/secretwit/source/browse/trunk/src/com/revolucion/secretwit/ui/timeline/TimelineListUI.java" target="_blank">custom implementation</a> of <em>BasicListUI</em>, which uses TimingFramework to animate list cells.</p>
<pre class="brush: java;">
dataListener = new ListDataListener() {
  @Override
  public void intervalAdded(ListDataEvent e) {
    if (!animator.isRunning()) {
    minAnimIndex = e.getIndex0();
    maxAnimIndex = e.getIndex1();
    cellAlpha = 1.0f;
    animator.start();
  }
}
</pre>
<pre class="brush: java;">
@Override
protected void paintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer cellRenderer, ListModel dataModel, ListSelectionModel selModel, int leadIndex) {
 // The effect is applied for all cells if it's the first time they
 // appear, and always for newly inserted first cell
 if (animator.isRunning() &amp;&amp; row &gt;= minAnimIndex &amp;&amp; row &lt;= maxAnimIndex) {
 // Calculate cell position, set offset and paint it
 Rectangle newRowBounds = new Rectangle(rowBounds);
 newRowBounds.x = (int) (-newRowBounds.width * cellAlpha);

 super.paintCell(g, row, newRowBounds, cellRenderer, dataModel, selModel, leadIndex);

 // Paint overlay for fade in effect
 Graphics2D g2 = (Graphics2D) g.create();
 g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, cellAlpha));
 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 g2.setColor(Color.white);
 g2.fillRect(rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height);
 g2.dispose();
 }
 else
 super.paintCell(g, row, rowBounds, cellRenderer, dataModel, selModel, leadIndex);
}
</pre>
<p><a href="http://revolucionlibrary.files.wordpress.com/2011/06/scr1.png"><img class="aligncenter size-full wp-image-155" title="Timeline" src="http://revolucionlibrary.files.wordpress.com/2011/06/scr1.png?w=508&#038;h=227" alt="Timeline" width="508" height="227" /></a></p>
<p>There is one more interesting custom component &#8211; <a title="MessagePane" href="http://code.google.com/p/secretwit/source/browse/trunk/src/com/revolucion/secretwit/ui/MessagePane.java" target="_blank">MessagePane</a>, which is a JTextArea with remaining chars counter in background, and a progress bar which shows when you submit a tweet.</p>
<p><a href="http://revolucionlibrary.files.wordpress.com/2011/06/scr2.png"><img class="aligncenter size-full wp-image-158" title="MessagePane" src="http://revolucionlibrary.files.wordpress.com/2011/06/scr2.png?w=508&#038;h=211" alt="MessagePane" width="508" height="211" /></a></p>
<h2></h2>
<h2>Conclusion</h2>
<p>Full source code of <strong>SecreTwit</strong> is available at <a title="SecreTwit Project" href="http://secretwit.googlecode.com/" target="_blank">SecreTwit project page</a>, and also an executable version which you can <a title="Download SecreTwit" href="http://code.google.com/p/secretwit/downloads/detail?name=secretwit-1.0-beta.jar" target="_blank">try right away</a>.</p>
<p>Please note that this is not intended to replace your everyday Twitter client &#8211; it&#8217;s <strong>just a demo</strong> of what can be done with Swing and Java and showcase of some interesting steganography techniques.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/revolucionlibrary.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/revolucionlibrary.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/revolucionlibrary.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/revolucionlibrary.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/revolucionlibrary.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/revolucionlibrary.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/revolucionlibrary.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/revolucionlibrary.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/revolucionlibrary.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/revolucionlibrary.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/revolucionlibrary.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/revolucionlibrary.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/revolucionlibrary.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/revolucionlibrary.wordpress.com/139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=139&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://revolucionlibrary.wordpress.com/2011/06/12/secretwit-social-steganography/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318d2dac59262f521e229eb3ac41cb4f?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Željko</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2011/06/secretwit_logo2.png" medium="image">
			<media:title type="html">SecreTwit Logo</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2011/06/how.png" medium="image">
			<media:title type="html">How it works</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2011/06/scr1.png" medium="image">
			<media:title type="html">Timeline</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2011/06/scr2.png" medium="image">
			<media:title type="html">MessagePane</media:title>
		</media:content>
	</item>
		<item>
		<title>cljMovieIndexer: Revolución&#8217;s baby brother</title>
		<link>http://revolucionlibrary.wordpress.com/2010/06/26/cljmovieindexer-revolucions-baby-brother/</link>
		<comments>http://revolucionlibrary.wordpress.com/2010/06/26/cljmovieindexer-revolucions-baby-brother/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 22:44:04 +0000</pubDate>
		<dc:creator>Željko</dc:creator>
				<category><![CDATA[cljMovieIndexer]]></category>
		<category><![CDATA[Clojure]]></category>
		<category><![CDATA[For developers]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://revolucionlibrary.wordpress.com/?p=112</guid>
		<description><![CDATA[As a task for exam I had to make something in Clojure. My idea was to do something similar to Revolución, just much simpler. Clojure is a modern variant of Lisp that runs on the Java Virtual Machine. It&#8217;s designed for concurrent programming, has Lisp-like syntax, it&#8217;s built for Java Platform and it&#8217;s a functional [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=112&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As a task for exam I had to make something in Clojure. My idea was to do something similar to <strong>Revolución</strong>, just much simpler.</p>
<p><a href="http://clojure.org/">Clojure</a> is a modern variant of Lisp that runs on the Java Virtual Machine. It&#8217;s designed for concurrent programming, has Lisp-like syntax, it&#8217;s built for Java Platform and it&#8217;s a functional language so it&#8217;s completely different style from Java, C#, C++ and similar languages. For me it wasn&#8217;t easy to switch to this style and logic, but once you are there it&#8217;s pretty much easy and fun :) Documentation could be more detailed. But there are few blogs/forums where you can find examples (now there is one more ;)).</p>
<h2>The Idea</h2>
<p><em>(&#8230; or how it works)</em></p>
<p><strong>cljMovieIndexer</strong> runs from console. You specify the directory where your movies are, and it scans the directory and extracts movie names from sub-directory names. It will ignore unnecessary words like resolution, scene names, dots, release types etc. Using the extracted movie names <strong>cljMovieIndexer</strong> downloads movie info (stuff like release year, plot, actors, cover image) from <a href="http://www.themoviedb.org/">TMDb</a> and creates a movie description file (<a href="http://en.wikipedia.org/wiki/MHTML">web archive</a> format) which is saved in each movie directory.<span id="more-112"></span></p>
<p>The look of the description page can be changed by editing the template file (actually a css file).  Also it&#8217;s written with multithreading in mind, so it will use as many cores your CPU has when downloading movie info and creating description files.</p>
<h2>The Code</h2>
<p>And now some examples and interesting parts &#8230;</p>
<p><strong>TMDb client</strong></p>
<p><a href="http://api.themoviedb.org/">TMDb</a> is a great open movie database and it has a pretty nice API to search for movies and get movie info and images. Requests are made using simple HTTP GET, and the results are in XML form.</p>
<p>First of all, we need to be able to search TMDb for movies:</p>
<pre class="brush: java;">
(defn search
	&quot;Search TMDB for movies with specified name.&quot;
	[movie-name]
		(when-not (nil? movie-name)
			(logger/info (str &quot;Searching for '&quot; movie-name &quot;'&quot;))
			(process-tmdb-search-response
				(httpa/stream
					(httpa/http-agent
						(str @tmdb-api-url &quot;Movie.search/en/xml/&quot; @tmdb-key &quot;/&quot; (URLEncoder/encode movie-name &quot;UTF-8&quot;))
						:connect-timeout 10000
						:read-timeout 10000)))))
</pre>
<p>For making HTTP requests there is an agent-based asynchronous <a href="http://richhickey.github.com/clojure-contrib/http.agent-api.html">HTTP client</a>, so we create a request URL, start a request and pass it to <em>stream</em> method which return an InputStream of the HTTP response body. Then <em>process-tmdb-search-response</em> is used to read the stream.</p>
<pre class="brush: java;">
(defn process-tmdb-search-response
	&quot;Extracts movie id from search response.&quot;
	[response]
		(let [movie-xml (zzip/xml-zip (xxml/parse response))]
			(zipf/xml1-&gt; movie-xml :movies :movie :id zipf/text)))
</pre>
<p><em>response</em> stream is passed to <em>parse</em> method which <a href="http://richhickey.github.com/clojure/clojure.xml-api.html">parses the XML</a> and returns a tree of elements. <em>movie-xml</em> is set to be <a href="http://richhickey.github.com/clojure/clojure.zip-api.html#clojure.zip/xml-zip">zipper</a> for xml elements. To extract data from xml there is a <a href="http://richhickey.github.com/clojure-contrib/zip-filter-api.html">zip-filter</a> system for filtering trees, and <em>xml1-&gt;</em> method which gets the first item that meets the specified query predicates. So now we have TMDb id of the first movie from the search result.</p>
<p>Using the movie id we can get movie information like plot, cast, genre, images etc.</p>
<pre class="brush: java;">
(defn info
	&quot;Get movie info from TMDB for movie with specified id.&quot;
	[movie-id]
		(when-not (nil? movie-id)
			(logger/info (str &quot;Get details for &quot; movie-id))
			(process-tmdb-info-response
				(httpa/stream
					(httpa/http-agent
						(str @tmdb-api-url &quot;Movie.getInfo/en/xml/&quot; @tmdb-key &quot;/&quot; movie-id)
						:connect-timeout 10000
						:read-timeout 10000)))))
</pre>
<p>Like before, response is passed to another method, <em>process-tmdb-info-response</em>, for processing &#8230;</p>
<pre class="brush: java;">
(defstruct movie :name :released :imdb :tagline :plot :rating :trailer :genres :images :actors :directors)

(defn process-tmdb-info-response
	&quot;Create movie struct with data extracted from XML response.&quot;
	[response]
		(let [movie-xml (zzip/xml-zip (xxml/parse response))]
			(reduce
				(fn [current-movie mapping]
					(assoc current-movie
						(key mapping)
						(cond
							(= (key mapping) :directors) (extract-directors movie-xml)
							(= (key mapping) :actors) (extract-actors movie-xml)
							(= (key mapping) :images) (extract-covers movie-xml)
							(= (key mapping) :genres) (extract-genres movie-xml)
							:default (extract-value movie-xml (val mapping)))))
				(struct movie)
				{:name :name, :released :released, :imdb :imdb_id, :rating :rating, :trailer :trailer, :tagline :tagline, :plot :overview, :genres nil, :images nil, :actors nil, :directors nil})))
</pre>
<p>This is a little more complicated :), but I&#8217;ll try to explain. First we parse xml and then extract some of the info (I didn&#8217;t need all that is available) and store it in <em>movie</em> struct. <em>reduce</em> method &#8230;</p>
<blockquote><p>&#8230; returns the result of applying function to value and the first item in collection, then applying function to that result and the 2nd item, etc.</p></blockquote>
<p>In this particular case, supplied function receives two params &#8211; <em>movie</em> struct instance and pair of keys (one is a key in <em>movie</em> struct and another matches element in xml). In &#8220;first step&#8221;, empty <em>movie</em> struct instance is passed to function with first pair from the map (<em>:name :name</em>), and the function will extract the value of the name element in the xml and set it as a value for the name key in the <em>movie</em> struct. Then (&#8220;second step&#8221;) resulting <em>movie</em> struct is passed again with the next pair (<em>:released :released</em>), value is extracted and set, and so on. At the end <em>process-tmdb-info-response</em> method returns instance of <em>movie</em> struct with all movie info that is found.</p>
<p><strong>HTML &amp; MHT</strong></p>
<p>There is a great library for working with HTML in Clojure called <a href="http://github.com/weavejester/hiccup">Hiccup</a>. I used it to create HTML page with movie info from <em>movie</em> struct. It&#8217;s very simple to create html, so as a result of this:</p>
<pre class="brush: java; light: true;">(html [:html [:body [:p &quot;Some text&quot;]]])</pre>
<p>&#8230; you&#8217;ll get:</p>
<pre class="brush: xml; light: true;">&lt;html&gt;&lt;body&gt;&lt;p&gt;Some text&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</pre>
<p>When we have the page html string, then we need to embed the images and CSS, and create a web archive. That can be done using the classes from <em>javax.mail</em> package since you can use standard Java libraries, classes etc. from Clojure. You can <a href="http://code.google.com/p/cljmovieindexer/source/browse/trunk/movieindexer/src/com/revolucion/movieindexer/mht.clj">see how</a> at <strong>cljMovieIndexer</strong> project page @ googlecode. There is also an example of how to <a href="http://code.google.com/p/cljmovieindexer/source/browse/trunk/movieindexer/src/com/revolucion/movieindexer/pdf.clj">create a PDF</a> document.</p>
<p><strong>Make executable application</strong></p>
<p>This was a little tricky to work out, but here it is, step by step:</p>
<ol>
<li>Download <a href="http://github.com/technomancy/leiningen">Leiningen</a> (a build tool for Clojure) and run <em>lein self-install</em></li>
<li>Write a <em>-main</em> method:
<pre class="brush: java; light: true;">(defn -main [&amp; args] ( ... ))</pre>
</li>
<li>Make a project.clj file in project root directory where you write project dependencies and path to clj file with main method</li>
<li>Run <em>lein uberjar</em> to create a single standalone jar file</li>
</ol>
<p>You can find complete source code and executable <strong>cljMovieIndexer</strong> application on the project page: <a href="http://code.google.com/p/cljmovieindexer/">http://code.google.com/p/cljmovieindexer/</a>.</p>
<h3>Note</h3>
<p>As I said at the beginning, I made this just for practice, learning new stuff and good grade on the exam :), so it certainly is not 100% stable and bugs-free, but I hope it&#8217;ll be useful to someone who is learning Clojure or is looking for examples.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/revolucionlibrary.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/revolucionlibrary.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/revolucionlibrary.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/revolucionlibrary.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/revolucionlibrary.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/revolucionlibrary.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/revolucionlibrary.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/revolucionlibrary.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/revolucionlibrary.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/revolucionlibrary.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/revolucionlibrary.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/revolucionlibrary.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/revolucionlibrary.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/revolucionlibrary.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=112&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://revolucionlibrary.wordpress.com/2010/06/26/cljmovieindexer-revolucions-baby-brother/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318d2dac59262f521e229eb3ac41cb4f?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Željko</media:title>
		</media:content>
	</item>
		<item>
		<title>Revolución is here !</title>
		<link>http://revolucionlibrary.wordpress.com/2009/07/21/revolucion-is-here/</link>
		<comments>http://revolucionlibrary.wordpress.com/2009/07/21/revolucion-is-here/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 02:06:42 +0000</pubDate>
		<dc:creator>Željko</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Beta release]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Revolucion]]></category>

		<guid isPermaLink="false">http://revolucionlibrary.wordpress.com/?p=59</guid>
		<description><![CDATA[Introduction Revolución Movie Library is a database software for organizing personal collection of movies. Simple and very easy to use with many advanced features, with accent on rich user interface. The goal was and still is to make software that is simple and easy to use, that makes user feel good and that it does [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=59&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:center;"><img class="size-full wp-image-62 aligncenter" title="Revolucion Movie Library" src="http://revolucionlibrary.files.wordpress.com/2009/07/splash1.png?w=460&#038;h=338" alt="" width="460" height="338" /></p>
<h2>Introduction</h2>
<p>Revolución Movie Library is a database software for organizing personal collection of movies. Simple and very easy to use with many advanced features, with accent on rich user interface.<br />
The goal was and still is to make software that is simple and easy to use, that makes user feel good and that it does what it is supposed to be doing.</p>
<p>This is the first publicly available version. It&#8217;s a <strong>beta</strong> release of version 0.7 and it&#8217;s intended for testing purposes. I encourage you to <strong>download</strong> and <strong>try it</strong>. You can use this beta version for 30 days. Please feel free to leave a comment here or write me an email of what you think about it &#8211; what should be improved, what isn&#8217;t working as expected, is there some new feature that you would like to see in Revolución Movie Library etc. Any comments and suggestions would be greatly appreciated.</p>
<h2>Features</h2>
<ul>
<li>Simple and easy to use</li>
<li>Get <strong>movie info</strong> and <strong>movie covers</strong> from online movie databases and link to the <strong>HD trailer</strong> from few movie trailer sites</li>
<li>Add movie in three steps</li>
<li>Easy catalogize all movies stored on your hard drive</li>
<li>Browse movies in three views (list view, table view and cover show)</li>
<li>Fast searching</li>
<li>Advanced filtering</li>
<li>Search and view movie trailers from Youtube</li>
<li>Capture frames from movies (so you can quickly remind without playing the movie)</li>
<li>Easily export to HTML, PDF, Excel or XML format or upload to Google Docs</li>
<li>View movie news like most popular upcoming movies and weekend box office</li>
<li>Automatically translate movie info to language you choose</li>
<li>Backup and restore database</li>
<li>… and many more :)</li>
</ul>
<h2>System requirements</h2>
<ul>
<li>Windows XP or Vista <em>(May work on other Windows editions)</em></li>
<li>Java JRE 1.6 update 10 or newer <em>(I suggest <strong>Java 1.6 update 14</strong>)</em></li>
<li><strong>Good</strong> graphics card</li>
<li>At least 512MB RAM</li>
<li>Internet</li>
</ul>
<h2>Download</h2>
<p style="text-align:center;"><strong>Revolución Movie Library 0.7 Beta</strong><br />
<strong><span style="color:#808080;">~ 17MB</span></strong><br />
<a href="http://www.mediafire.com/?13ml32lhftvglq2" target="_blank"><img class="aligncenter size-full wp-image-65" style="margin-bottom:40px;" title="Download !" src="http://revolucionlibrary.files.wordpress.com/2009/07/download-icon.png?w=84&#038;h=84" alt="download-icon" width="84" height="84" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/revolucionlibrary.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/revolucionlibrary.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/revolucionlibrary.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/revolucionlibrary.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/revolucionlibrary.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/revolucionlibrary.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/revolucionlibrary.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/revolucionlibrary.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/revolucionlibrary.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/revolucionlibrary.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/revolucionlibrary.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/revolucionlibrary.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/revolucionlibrary.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/revolucionlibrary.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=59&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://revolucionlibrary.wordpress.com/2009/07/21/revolucion-is-here/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318d2dac59262f521e229eb3ac41cb4f?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Željko</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/07/splash1.png" medium="image">
			<media:title type="html">Revolucion Movie Library</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/07/download-icon.png" medium="image">
			<media:title type="html">Download !</media:title>
		</media:content>
	</item>
		<item>
		<title>How It’s Made: Cover Gallery</title>
		<link>http://revolucionlibrary.wordpress.com/2009/03/20/how-it%e2%80%99s-made-cover-gallery/</link>
		<comments>http://revolucionlibrary.wordpress.com/2009/03/20/how-it%e2%80%99s-made-cover-gallery/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 17:29:19 +0000</pubDate>
		<dc:creator>Željko</dc:creator>
				<category><![CDATA[How It's Made]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[For developers]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Revolucion]]></category>
		<category><![CDATA[Swing]]></category>

		<guid isPermaLink="false">http://revolucionlibrary.wordpress.com/?p=51</guid>
		<description><![CDATA[Cover gallery or List View in Revolucion Library is a JList which dispays cover images. You can see it at the beginning of the Revolucion Library screencast. First of all, we need to extend JList to achieve a selection change animation. In Revolucion Library I used TimingFramework, but here is the example of how to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=51&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Cover gallery</strong> or <strong>List View</strong> in Revolucion Library is a JList which dispays cover images. You can see it at the beginning of the Revolucion Library <a title="Revolucion Library Screencast" href="http://www.vimeo.com/3373420" target="_blank">screencast</a>.</p>
<p>First of all, we need to extend JList to achieve a selection change animation. In Revolucion Library I used <a title="TimingFramework" href="https://timingframework.dev.java.net/" target="_blank">TimingFramework</a>, but here is the example of how to do the same with a great <a title="Trident" href="http://kenai.com/projects/trident" target="_blank">Trident</a> animation library by <a href="http://www.pushing-pixels.org/" target="_blank">Kirill</a>.</p>
<p><em>ListSelectionListener</em> is used to listen for changes in lists selection value, so we can start the animation when a cover is selected.<br />
<em>selectionBounds</em> represent the current bounds of a selection rectangle, and <em>selectionAlpha</em> is used to control the visibility of the selection rectangle &#8211; when there is no items in the list, value is 0.0f.<br />
<em>timeline</em> is the main timeline for animations. <em>animationSpeed</em> is actually a duration of the animation in milliseconds.</p>
<pre class="brush: java;">
public class AnimatedList extends JList implements ListSelectionListener, ComponentListener {

	private float selectionAlpha = 0.0f;
	private float newSelectionAlpha = 1.0f;

	private Rectangle selectionBounds = new Rectangle(0, 0, 0, 0);
	private Rectangle currentSelectionBounds = new Rectangle(0, 0, 0, 0);
	private Rectangle newSelectionBounds = new Rectangle(0, 0, 0, 0);

	private Timeline timeline;
	private int animationSpeed = 400;

	private int selectionBorderWidth = 1;
	private int selectionBorderRoundness = 10;
	private Color selectionBorderColor = Color.gray;

	public AnimatedList() {
		setSelectionBackground(new Color(255, 255, 255, 60));
		setSelectionForeground(Color.black);
		setOpaque(false);
		setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		setLayoutOrientation(JList.HORIZONTAL_WRAP);
		setVisibleRowCount(-1);

		addListSelectionListener(this);
		addComponentListener(this);

		initAnimation();
	}
</pre>
<p>Next we need to setup the Timeline &#8230;<br />
Every time <em>timeline.play()</em> is called, <em>selectionBounds</em> will change from <em>currentSelectionBounds</em> to <em>newSelectionBounds</em>, and <em>selectionAlpha</em> from it&#8217;s current value to a <em>newSelectionAlpha</em> value. And we add <em>Repaint</em> callback so JList is repainted when these properties change.</p>
<pre class="brush: java;">

private void initAnimation() {
 	timeline = new Timeline(this);
 	timeline.setDuration(animationSpeed);
 	timeline.addPropertyToInterpolate(&quot;selectionBounds&quot;, currentSelectionBounds, newSelectionBounds);
 	timeline.addPropertyToInterpolateTo(&quot;selectionAlpha&quot;, newSelectionAlpha);
 	timeline.setEase(new Spline(0.8f));
 	timeline.addCallback(new Repaint(this));
 	timeline.addCallback(new TimelineCallbackAdapter() {
 		@Override
 		public void onTimelineStateChanged(TimelineState oldState, TimelineState newState, float durationFraction, float timelinePosition) {
 			if (newState.equals(TimelineState.DONE))
 				currentSelectionBounds.setBounds(newSelectionBounds);
 		}
 	});
 }
</pre>
<p>Then we implement ListSelectionListener and ComponentListener.</p>
<pre class="brush: java;">

 @Override
 public void valueChanged(ListSelectionEvent e) {
 	if (!e.getValueIsAdjusting())
 		updateSelectionBounds();
 }

 @Override
 public void componentHidden(ComponentEvent e) {}

 @Override
 public void componentMoved(ComponentEvent e) {
 	updateSelectionBounds();
 }

 @Override
 public void componentResized(ComponentEvent e) {
 	updateSelectionBounds();
 }

 @Override
 public void componentShown(ComponentEvent e) {
 	updateSelectionBounds();
 }
</pre>
<p>And here is what <em>updateSelectionBounds()</em> method does:</p>
<pre class="brush: java;">

 public void updateSelectionBounds() {
 	int index = getSelectedIndex();
 	// If there is something selected we set the selection bounds to the bounds of the selected cell ...
 	if (index &gt; -1) {
 		newSelectionBounds.setBounds(getCellBounds(index, index));
 		newSelectionAlpha = 1.0f;
 	}
 	// ... or if there is no selection, we do this to simulate rectangle dissapearing ...
 	else {
 		newSelectionBounds.setBounds(getX() + getWidth() / 2, getY() + getHeight() / 2, 0, 0);
 		newSelectionAlpha = 0.0f;
 	}

 	// ... and than start the animation
 	if (!timeline.isDone())
 		timeline.cancel();
 	timeline.play();
 }
</pre>
<p>And finally, override the <em>paintComponent()</em> to do the selection rectangle painting.</p>
<pre class="brush: java;">

@Override
 protected void paintComponent(Graphics g) {
 	super.paintComponent(g);

 	Graphics2D g2 = (Graphics2D) g.create();
 	g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, selectionAlpha));
 	g2.setColor(getSelectionBackground());
 	g2.fillRoundRect(selectionBounds.x, selectionBounds.y, selectionBounds.width, selectionBounds.height, selectionBorderRoundness, selectionBorderRoundness);
 	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 	g2.setColor(selectionBorderColor);
 	g2.setStroke(new BasicStroke(selectionBorderWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
 	g2.drawRoundRect(selectionBounds.x, selectionBounds.y, selectionBounds.width, selectionBounds.height, selectionBorderRoundness, selectionBorderRoundness);
 	g2.dispose();
 }
</pre>
<p>Add getters and setters for selectionBounds and selectionAlpha, and that&#8217;s it with animations.</p>
<p>To speed up image painting in the JList, I wrote a ListCellRenderer that will cache cover images.</p>
<pre class="brush: java;">

public class CoverListCellRendererTest extends DefaultListCellRenderer {

 // http://java.sun.com/javase/6/docs/api/java/lang/ref/SoftReference.html
 private HashMap&lt;String, SoftReference&lt;ImageIcon&gt;&gt; thumbnails;

 public CoverListCellRendererTest() {
 	thumbnails = new HashMap&lt;String, SoftReference&lt;ImageIcon&gt;&gt;();

 	setOpaque(false);
 	setHorizontalAlignment(JLabel.CENTER);
 	setHorizontalTextPosition(JLabel.CENTER);
 	setVerticalTextPosition(JLabel.BOTTOM);
 }

 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
 	Movie movie = (Movie) value;

 	setText(movie.getTitle());

 	String coverFileName = movie.getCover();
 	if (coverFileName != null)
 		setIcon(getThumbnail(coverFileName));

 	return this;
 }

 private ImageIcon getThumbnail(String coverFileName) {
 	ImageIcon icon = null;

 	SoftReference&lt;ImageIcon&gt; reference = thumbnails.get(coverFileName);
 	if (reference != null)
 		icon = reference.get();

 	if (icon == null) {
 		try {
 			BufferedImage image = ImageUtils.getCoverThumb(coverFileName);
 			icon = new ImageIcon(image);
 			thumbnails.put(coverFileName, new SoftReference&lt;ImageIcon&gt;(icon));
 		}
 		catch (IOException e) {
 			icon = new ImageIcon(ImageUtils.getEmptyCover());
 		}
 	}

 	return icon;
 }
}
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/revolucionlibrary.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/revolucionlibrary.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/revolucionlibrary.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/revolucionlibrary.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/revolucionlibrary.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/revolucionlibrary.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/revolucionlibrary.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/revolucionlibrary.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/revolucionlibrary.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/revolucionlibrary.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/revolucionlibrary.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/revolucionlibrary.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/revolucionlibrary.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/revolucionlibrary.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=51&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://revolucionlibrary.wordpress.com/2009/03/20/how-it%e2%80%99s-made-cover-gallery/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318d2dac59262f521e229eb3ac41cb4f?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Željko</media:title>
		</media:content>
	</item>
		<item>
		<title>How It&#8217;s Made: Youtube player in Java</title>
		<link>http://revolucionlibrary.wordpress.com/2009/03/04/how-its-made-youtube-player-in-java/</link>
		<comments>http://revolucionlibrary.wordpress.com/2009/03/04/how-its-made-youtube-player-in-java/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 02:20:19 +0000</pubDate>
		<dc:creator>Željko</dc:creator>
				<category><![CDATA[How It's Made]]></category>
		<category><![CDATA[For developers]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Revolucion]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[Youtube]]></category>

		<guid isPermaLink="false">http://revolucionlibrary.wordpress.com/?p=44</guid>
		<description><![CDATA[Few of you asked, so here is how &#8230; First of all, you need a way to search Youtube and get url of some video. And that is really simple since there is an official Google Data API for using some of the services Google offers, and there is an open source GData Java Client [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=44&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Few of you asked, so here is how &#8230;</p>
<p>First of all, you need a way to search Youtube and get url of some video. And that is really simple since there is an official Google Data API for using some of the services Google offers, and there is an open source <a title="GData Java Client Library" href="http://code.google.com/p/gdata-java-client/" target="_blank">GData Java Client Library</a>, and great <a title="Developers guide for Youtube API" href="http://code.google.com/intl/sr-CS/apis/youtube/2.0/developers_guide_java.html" target="_blank">tutorials and examples</a> of how to use it.</p>
<p>So, for example, from a query for &#8216;Revolucion Movie Library&#8217; you will get a List of VideoEntries. And from VideoEntry you can get stuff like video title, location, type, url, duration, thumbnails etc. Video location is a string like &#8220;http://www.youtube.com/v/9yi9EdbYaFc&amp;&#8230;&#8221;. Remember that :)</p>
<p>Now we need to play that somehow &#8230;</p>
<p>If you have a right codec, youtube video can be played in probably any video player &#8211; try opening above url (that you remembered :)) in Windows Media Player. But there are problems, at least I had them. First, that seems now is gone (probably fixed in newer versions of WMP or Flash), you couldn&#8217;t interact with a video, so you couldn&#8217;t click &#8216;Play&#8217;. That can be resolved by appending &#8220;&amp;autoplay=1&#8243; to url, but than you can&#8217;t stop it. And, there comes a second problem &#8211; you can&#8217;t even really stop it with &#8220;Stop&#8221; button in your player. I first written a wrapper around WMP so I can use it in Swing, but that did&#8217;t work quite well. Also I tried JMC, but it crashed from time to time.</p>
<p>Other solution is playing Youtube videos in web browser. And this way you can even use a <a title="Chromeless player example" href="http://code.google.com/apis/youtube/chromeless_example_1.html" target="_blank">chromeless player</a> (&#8220;&#8230; by definition, a YouTube video with no controls&#8221;), and control it using JavaScript. And if we had JWebPane this would be excellent. But since it isn&#8217;t finished yet &#8230; there are alternatives: WebBrowser from JDIC project, WebBrowser from JDICplus, &#8230;, and JWebBrowser from the <a title="DJ Project" href="http://djproject.sourceforge.net/ns/index.html" target="_blank">DJ project</a>. In Revolucion Library I used latter. It&#8217;s an SWT-based implementation of web browser component and under Windows it uses Internet Explorer or Mozilla and Mozilla on other platforms. Features that I liked &#8211; you can call JavaScript function in current page from Java, and can send commands from html page to Java application. And it works pretty good.</p>
<p>So I made a simple html page with chromeless Youtube player and, among few others, it contains following JavaScript functions:</p>
<pre class="brush: jscript;">

function onYouTubePlayerReady(playerId) {
          ytplayer = document.getElementById(&quot;myytplayer&quot;);
  ...
          sendCommand(&quot;loaded&quot;);
        }

function loadNewVideo(id, startSeconds) {
          if (ytplayer) {
            ytplayer.loadVideoById(id, parseInt(startSeconds));
          }
        }

function closePlayer() {
            stop();
            clearVideo();
          	sendCommand('close');
        }
function sendCommand(command) {
          var s = 'command://' + encodeURIComponent(command);
          for(var i=1; i&lt;arguments.length; s+='&amp;'+encodeURIComponent(arguments[i++]));
          window.location = s;
        }
</pre>
<p>Also I written a YouTube player component:</p>
<pre class="brush: java;">

 public class YouTubePlayer extends JPanel {

 private JWebBrowser webBrowser;
 private String videoId;

 public YouTubePlayer(String videoId) {
 	this.videoId = videoId;

 	init();
 }

 private void init() {
 	webBrowser = new JWebBrowser();
 	webBrowser.setBarsVisible(false);
 	webBrowser.setButtonBarVisible(false);
 	webBrowser.setLocationBarVisible(false);
 	webBrowser.setMenuBarVisible(false);
 	webBrowser.setStatusBarVisible(false);
 	webBrowser.setBackground(Color.black);
 	webBrowser.getNativeComponent().setBackground(Color.black);
 	webBrowser.setFocusable(false);

 	webBrowser.setHTMLContent(generateHtmlPlayer());

 	webBrowser.addWebBrowserListener(new WebBrowserAdapter() {
 		@Override
 		public void commandReceived(WebBrowserEvent e, String command, String[] args) {
 			if (command.equals(&quot;close&quot;))
 				firePropertyChange(&quot;action&quot;, null, &quot;close&quot;);
 			else if (command.equals(&quot;loaded&quot;))
 				webBrowser.executeJavascript(&quot;loadNewVideo(\&quot;&quot; + videoId + &quot;\&quot;, \&quot;0\&quot;)&quot;);
 		}
 	});

 	setBackground(Color.black);
 	setLayout(new BorderLayout());

 	add(webBrowser, BorderLayout.CENTER);
 }

 private String generateHtmlPlayer() {
 	String html = null;
 	try {
 		html = FileUtils.readFileToString(new File(getClass().getResource(&quot;resources/player_html.html&quot;).toURI()));
 	}
 	catch (Exception e) {}

 	return html;
 }
}
</pre>
<p>Explanation:</p>
<p>When the &#8220;player_html.html&#8221; page is opened in the browser and then Youtube player is loaded it will invoke the <em>onYouTubePlayerReady</em> function and it will send command to my YouTubePlayer component. WebBrowserListener receives the command and using the <em>executeJavascript</em> method calls the <em>loadNewVideo</em> function with videoId as a parameter. VideoId is a part of video url after &#8220;/v/&#8221; that you might remember from above :) When user clicks &#8220;close&#8221; button in the html page, <em>closePlayer()</em> function is called and command sent to application.</p>
<p>So, this is it. All in all, this is not the best solution, you must include SWT jar with your application, but it works for now.</p>
<p>I&#8217;m desperately waiting for JWebPane &#8230;</p>
<p><strong>Added day later: </strong></p>
<p>I forgot to mention <a title="WebKit4Java" href="http://www.genuitec.com/about/labs.html" target="_blank">WebKit4Java</a> by Genuitec which is currently available for SWT, but there is also going to be a Swing version.</p>
<p><span style="color:#808080;">P.S. My english isn&#8217;t excellent so I&#8217;m sorry for grammatical and other mistakes I made.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/revolucionlibrary.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/revolucionlibrary.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/revolucionlibrary.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/revolucionlibrary.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/revolucionlibrary.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/revolucionlibrary.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/revolucionlibrary.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/revolucionlibrary.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/revolucionlibrary.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/revolucionlibrary.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/revolucionlibrary.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/revolucionlibrary.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/revolucionlibrary.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/revolucionlibrary.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=44&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://revolucionlibrary.wordpress.com/2009/03/04/how-its-made-youtube-player-in-java/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318d2dac59262f521e229eb3ac41cb4f?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Željko</media:title>
		</media:content>
	</item>
		<item>
		<title>Begin the Revolución &#8230;</title>
		<link>http://revolucionlibrary.wordpress.com/2009/02/22/begin-the-revolucion/</link>
		<comments>http://revolucionlibrary.wordpress.com/2009/02/22/begin-the-revolucion/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 00:51:06 +0000</pubDate>
		<dc:creator>Željko</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Features]]></category>
		<category><![CDATA[First post]]></category>
		<category><![CDATA[Revolucion]]></category>
		<category><![CDATA[Screenshots]]></category>

		<guid isPermaLink="false">http://revolucionlibrary.wordpress.com/?p=3</guid>
		<description><![CDATA[Two years ago I started writing a program that will allow me to catalog my movies. I called it Revolucion Movie Library ...<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=3&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Two years ago I started writing a program that will allow me to catalog my movies. I called it <strong>Revolucion Movie Library</strong>.</p>
<p>There are many programs out there that can do this, but non of them suited me. Some are too complicated, have many useless features and make simple things hard to do. And most of them are &#8230; ugly.</p>
<p>In meantime I changed it many times, optimized, polished the interface, added few interesting features that friends requested and improved it and improved it again. And, of course, fixed bugs I created. The goal was and still is to make software that is simple and easy to use, that makes user feel good and that it does what it is supposed to be doing.</p>
<p style="text-align:center;"><a href="http://revolucionlibrary.files.wordpress.com/2009/02/main1.png"><img class="size-full wp-image-22 aligncenter" title="Revolucion Library" src="http://revolucionlibrary.files.wordpress.com/2009/02/main1.png?w=386&#038;h=254" alt="Revolucion Library - Main view" width="386" height="254" /></a></p>
<p style="text-align:center;">
<p>So, it&#8217;s not completely finished yet, but here are some of the current features and screenshots.</p>
<h2>Features:</h2>
<ul>
<li>Simple and easy to use</li>
<li>Get movie info and movie covers from online movie databases</li>
<li>Add movie in three steps</li>
<li>Easy catalogize all movies stored on your hard drive</li>
<li>Browse movies in three views (list view, table view and cover show)</li>
<li>Fast searching</li>
<li>Advanced filtering</li>
<li>Search and view movie trailers from Youtube</li>
<li>Capture frames from movies (so you can quickly remind without playing the movie)</li>
<li>Easily export to HTML, PDF or Excel format</li>
<li>View movie news like most popular upcoming movies and weekend box office</li>
<li>Automatically translate movie info to language you choose</li>
<li>Backup and restore database</li>
<li>&#8230; and other that I currently can&#8217;t remember &#8230;</li>
</ul>
<h2>Demonstration video:</h2>
<p>Watch in HD: <a href="http://www.vimeo.com/3373420" target="_blank">http://www.vimeo.com/3373420</a> (use full screen option).</p>
<span style="text-align:center; display: block;"><a href="http://revolucionlibrary.wordpress.com/2009/02/22/begin-the-revolucion/"><img src="http://img.youtube.com/vi/9yi9EdbYaFc/2.jpg" alt="" /></a></span>
<h2>Screenshots:</h2>
<table style="text-align:center;" border="0" cellspacing="0" cellpadding="5" width="300px">
<tbody>
<tr>
<td align="center" valign="middle"><a href="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion1.png"><img class="size-thumbnail wp-image-4" title="Main View" src="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion1.png?w=128&#038;h=85" alt="Revolucion Library - Main View" width="128" height="85" /></a></td>
<td align="center" valign="middle"><a href="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion2.png"><img class="size-thumbnail wp-image-5" title="Cover Show" src="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion2.png?w=128&#038;h=85" alt="Revolucion Library - Cover Show" width="128" height="85" /></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion3.png"><img class="size-thumbnail wp-image-6" title="List View" src="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion3.png?w=128&#038;h=85" alt="Revolucion Library - List View" width="128" height="85" /></a></td>
<td align="center" valign="middle"><a href="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion4.png"><img class="size-thumbnail wp-image-7" title="Table View" src="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion4.png?w=128&#038;h=85" alt="Revolucion Library - Table View - Details" width="128" height="85" /></a></td>
</tr>
<tr>
<td align="center" valign="middle"><a href="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion5.png"><img class="size-thumbnail wp-image-8" title="Trailer View" src="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion5.png?w=128&#038;h=85" alt="Revolucion Library - Trailer View" width="128" height="85" /></a></td>
<td align="center" valign="middle"><a href="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion6.png"><img class="size-thumbnail wp-image-9" title="Edit movie" src="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion6.png?w=71&#038;h=96" alt="Revolucion Library - Edit movie" width="71" height="96" /></a></td>
</tr>
</tbody>
</table>
<p>The <strong>Revolucion Library</strong> is still in development, but the first beta version will probably be available in next few weeks.</p>
<p>For all developers out there, <strong>Revolucion Library</strong> is written completely in Java with custom Swing components and few open source libraries, backed by Hibernate and HSQL database. For details, ask.</p>
<p>Please do tell me what you think about all this. Do you like it or not, and why ? What features do you think this type of software needs to have ? Any comments and suggestions would be greatly appreciated.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/revolucionlibrary.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/revolucionlibrary.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/revolucionlibrary.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/revolucionlibrary.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/revolucionlibrary.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/revolucionlibrary.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/revolucionlibrary.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/revolucionlibrary.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/revolucionlibrary.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/revolucionlibrary.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/revolucionlibrary.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/revolucionlibrary.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/revolucionlibrary.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/revolucionlibrary.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=revolucionlibrary.wordpress.com&amp;blog=5276335&amp;post=3&amp;subd=revolucionlibrary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://revolucionlibrary.wordpress.com/2009/02/22/begin-the-revolucion/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/318d2dac59262f521e229eb3ac41cb4f?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Željko</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/02/main1.png" medium="image">
			<media:title type="html">Revolucion Library</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion1.png?w=128" medium="image">
			<media:title type="html">Main View</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion2.png?w=128" medium="image">
			<media:title type="html">Cover Show</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion3.png?w=128" medium="image">
			<media:title type="html">List View</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion4.png?w=128" medium="image">
			<media:title type="html">Table View</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion5.png?w=128" medium="image">
			<media:title type="html">Trailer View</media:title>
		</media:content>

		<media:content url="http://revolucionlibrary.files.wordpress.com/2009/02/revolucion6.png?w=71" medium="image">
			<media:title type="html">Edit movie</media:title>
		</media:content>
	</item>
	</channel>
</rss>
