<?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/"
	>

<channel>
	<title>Alex Sleat &#187; google</title>
	<atom:link href="http://alexsleat.co.uk/tag/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexsleat.co.uk</link>
	<description>/home/alex</description>
	<lastBuildDate>Mon, 21 May 2012 22:17:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Python &#8211; Making Use of Google&#8217;s Text To Speech Translation Tool</title>
		<link>http://alexsleat.co.uk/2011/11/14/python-making-use-of-googles-text-to-speech-translation-tool/</link>
		<comments>http://alexsleat.co.uk/2011/11/14/python-making-use-of-googles-text-to-speech-translation-tool/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 00:46:22 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[stream]]></category>
		<category><![CDATA[text to speech]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[tts]]></category>
		<category><![CDATA[voice]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=23542</guid>
		<description><![CDATA[<br/><p>Text to speech (tts) is a difficult task to get right and there are quite a few packages that show just how hard with their terrible tinny voices, these are also usually only limited to English, which for the larger part than most people would like to believe don&#8217;t find it very useful. Nevermind, [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Text to speech (tts) is a difficult task to get right and there are quite a few packages that show just how hard with their terrible tinny voices, these are also usually only limited to English, which for the larger part than most people would like to believe don&#8217;t find it very useful. Nevermind, Google to the rescue, their <a href="http://translate.google.com">Translation tool</a> has had the ability to also voice translations for a while now. So wouldn&#8217;t it be awesome if we could utilize this, stable, constantly developing and ultimately free utlilty? Yes? Well luckly for you it&#8217;s possible. It&#8217;s been done before with the use of JavaScript, like <a href="http://weston.ruter.net/projects/google-tts/">here</a> but those more used to scripting and desktop programming don&#8217;t worry, you can use it too.</p>
<p>Basically it works by sending a request to the Google translate servers which then, pretty much instantly, reply with an MP3 file which contains the requested words in their most sexy of robot voices.</p>
<p>Check this URL for an example of said voice &#8211; <a href="http://translate.google.com/translate_tts?q=check+out+my+sexy+robot+voice">http://translate.google.com/translate_tts?q=check+out+my+sexy+robot+voice</a> (if it doesn&#8217;t load in your browser, open VLC, CTRL+N and paste the URL in)</p>
<h6>First, we want to be able to get python to stream an MP3 file off the web:</h6>
<p>More info on this can be found <a href="http://codeboje.de/playing-mp3-stream-python/">here</a>, the following code was is a stripped down version of the code found at codeboje.de.</p>
<script src="http://gist.github.com/1362973.js?file=playMP3stream.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362973" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">time</span>		<span class="c">#for delay</span></div><div class='line' id='LC4'><span class="kn">import</span> <span class="nn">pygst</span>		<span class="c">#for playing mp3 stream</span></div><div class='line' id='LC5'><span class="kn">import</span> <span class="nn">gst</span>		<span class="c"># &quot; &quot;</span></div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'><span class="c">#Play an .mp3 file from the internet</span></div><div class='line' id='LC8'><span class="n">music_stream_uri</span> <span class="o">=</span> <span class="s">&#39;http://www.sample-url.com/file.mp3&#39;</span></div><div class='line' id='LC9'><span class="n">player</span> <span class="o">=</span> <span class="n">gst</span><span class="o">.</span><span class="n">element_factory_make</span><span class="p">(</span><span class="s">&quot;playbin&quot;</span><span class="p">,</span> <span class="s">&quot;player&quot;</span><span class="p">)</span></div><div class='line' id='LC10'><span class="n">player</span><span class="o">.</span><span class="n">set_property</span><span class="p">(</span><span class="s">&#39;uri&#39;</span><span class="p">,</span> <span class="n">music_stream_uri</span><span class="p">)</span></div><div class='line' id='LC11'><span class="n">player</span><span class="o">.</span><span class="n">set_state</span><span class="p">(</span><span class="n">gst</span><span class="o">.</span><span class="n">STATE_PLAYING</span><span class="p">)</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="c">#requires a delay, if the py process closes before the mp3 has finished it will be cut off.</span></div><div class='line' id='LC14'><span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">12</span><span class="p">)</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362973/bc68a8dd1807586944708fbb24fe09716c8153ae/playMP3stream.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362973#file_play_mp3stream.py" style="float:right;margin-right:10px;color:#666">playMP3stream.py</a>
            <a href="https://gist.github.com/1362973">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript>
<h6>Now we want to make a string to send :</h6>
<p>We&#8217;re going to use command line arguments as the string which wants to be read by the Google TTS engine, the following code will grab those arguments and concatenate them into a string. It also has to be in a format like a usual Google URL, these usually replace white space for the &#8216;+&#8217; sign, that&#8217;s easy to do.</p>
<script src="http://gist.github.com/1362973.js?file=argvURLfriendly.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362973" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">sys</span>		<span class="c">#for cmd line argv</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="c">#take command line args as the input string</span></div><div class='line' id='LC6'><span class="n">input_string</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span></div><div class='line' id='LC7'><span class="c">#remove the program name from the argv list</span></div><div class='line' id='LC8'><span class="n">input_string</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'><span class="c">#convert to google friendly url (with + replacing spaces)</span></div><div class='line' id='LC11'><span class="n">tts_string</span> <span class="o">=</span> <span class="s">&#39;+&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">input_string</span><span class="p">)</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="k">print</span> <span class="n">tts_string</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362973/f3480729df33a3ff5cf17899a0a6354b49d86ad1/argvURLfriendly.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362973#file_argv_ur_lfriendly.py" style="float:right;margin-right:10px;color:#666">argvURLfriendly.py</a>
            <a href="https://gist.github.com/1362973">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript>
<p>Now let&#8217;s just pass this URL to the bit we wrote to stream an MP3 and watch it go:</p>
<h6>Full Source Code:</h6>
<p>(Uses command line arguments as it&#8217;s input, run like &#8216;<em>python ttsString.py Hello World</em>&#8216;)<br />
<script src="http://gist.github.com/1362973.js?file=ttsString.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362973" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">sys</span>		<span class="c">#for cmd line argv</span></div><div class='line' id='LC4'><span class="kn">import</span> <span class="nn">time</span>		<span class="c">#for delay</span></div><div class='line' id='LC5'><span class="kn">import</span> <span class="nn">pygst</span>		<span class="c">#for playing mp3 stream</span></div><div class='line' id='LC6'><span class="kn">import</span> <span class="nn">gst</span>		<span class="c"># &quot; &quot;</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><span class="c">#take command line args as the input string</span></div><div class='line' id='LC9'><span class="n">input_string</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span></div><div class='line' id='LC10'><span class="c">#remove the program name from the argv list</span></div><div class='line' id='LC11'><span class="n">input_string</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="c">#convert to google friendly url (with + replacing spaces)</span></div><div class='line' id='LC14'><span class="n">tts_string</span> <span class="o">=</span> <span class="s">&#39;+&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">input_string</span><span class="p">)</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'><span class="k">print</span> <span class="n">tts_string</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="c">#use string in combination with the translate url as the stream to be played</span></div><div class='line' id='LC19'><span class="n">music_stream_uri</span> <span class="o">=</span> <span class="s">&#39;http://translate.google.com/translate_tts?q=&#39;</span> <span class="o">+</span> <span class="n">tts_string</span></div><div class='line' id='LC20'><span class="n">player</span> <span class="o">=</span> <span class="n">gst</span><span class="o">.</span><span class="n">element_factory_make</span><span class="p">(</span><span class="s">&quot;playbin&quot;</span><span class="p">,</span> <span class="s">&quot;player&quot;</span><span class="p">)</span></div><div class='line' id='LC21'><span class="n">player</span><span class="o">.</span><span class="n">set_property</span><span class="p">(</span><span class="s">&#39;uri&#39;</span><span class="p">,</span> <span class="n">music_stream_uri</span><span class="p">)</span></div><div class='line' id='LC22'><span class="n">player</span><span class="o">.</span><span class="n">set_state</span><span class="p">(</span><span class="n">gst</span><span class="o">.</span><span class="n">STATE_PLAYING</span><span class="p">)</span></div><div class='line' id='LC23'><br/></div><div class='line' id='LC24'><span class="c">#requires a delay, if the py process closes before the mp3 has finished it will be cut off.</span></div><div class='line' id='LC25'><span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">12</span><span class="p">)</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362973/2616de7115260a45b45ec55d84050a4dc39e8613/ttsString.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362973#file_tts_string.py" style="float:right;margin-right:10px;color:#666">ttsString.py</a>
            <a href="https://gist.github.com/1362973">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript></p>
<p>That&#8217;s pretty much how easy it is to use Google&#8217;s free online TTS engine, one main thing to watch out for is the 100 character limit to the use of this service in this way along with the API call limits which apply to each IP address. There are loads of cool things this can be used for and I&#8217;d love to see what anyone comes up with, keep me posted and have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/11/14/python-making-use-of-googles-text-to-speech-translation-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://translate.google.com/translate_tts?q=check+out+my+sexy+robot+voice" length="10272" type="audio/mpeg" />
		</item>
		<item>
		<title>Downloading all your Facebook Photos for Google Plus &#8211; In Linux</title>
		<link>http://alexsleat.co.uk/2011/07/16/downloading-all-your-facebook-photos-for-google-plus-in-linux/</link>
		<comments>http://alexsleat.co.uk/2011/07/16/downloading-all-your-facebook-photos-for-google-plus-in-linux/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 11:49:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[albums]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[export]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google plus]]></category>
		<category><![CDATA[grabber]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[move]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[pictures]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tagged]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[webapp]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=16916</guid>
		<description><![CDATA[<br/><p>Okay so, with Google Plus just being released to a select few (and invites) you might be wanting to export all your Facebook photos, tagged and albums you&#8217;ve uploaded to Google+. There are several ways of going about this, a few webapps, apps and through Facebook itself, the problem is that most of these [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Okay so, with Google Plus just being released to a select few (and invites) you might be wanting to export all your Facebook photos, tagged and albums you&#8217;ve uploaded to Google+. There are several ways of going about this, a few webapps, apps and through Facebook itself, the problem is that most of these don&#8217;t work in Linux making it a little more tricky to do without switching to Windows or OSX or borrowing some ones laptop for a while.</p>
<h4>Through Facebook Route:</h4>
<p>This way is actually pretty easy, which came as a surprise to me since I would have though it be in Facebooks best interest to keep users there just because it&#8217;s too much hassle to change.</p>
<p>First head over to Facebook.com, login and make your way through the labrynth that is Facebook settings to<br />
&#8216;Account Settings&#8217; &gt; Next to &#8216;Download Your Information&#8217; click ‘Learn more’ &gt; click &#8216;Download&#8217;.</p>
<p>This way you&#8217;re going to have to wait for Facebook to process all your data, they&#8217;ll then send you an e-mail once it&#8217;s done to a download link. This is a compressed (ZIP) file which contains all your information from Facebook, in the Photos folder you&#8217;ll find all your pictures which can then be uploaded to Google Plus.</p>
<p>The problem with this way is that it can take a reasonable amount of time (a couple of days depending on how much information you have..) and I&#8217;ve had it fail on a couple of occasions.</p>
<p>Alternatively you can use the following:</p>
<h4>The PhotoGrabber Option:</h4>
<p>For this you&#8217;ll need a couple of dependencies installed, it&#8217;s a desktop app that downloads the files for you.</p>
<p>Install dependencies:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> apt-get <span class="kw2">install</span> python python-tk</div>
<p>Install PhotoGrabber:</p>
<div class="dean_ch" style="white-space: wrap;">svn checkout http://photograbber.googlecode.com/svn/trunk/ photograbber-read-only<br />
<span class="kw3">cd</span> photograbber-read-only/<br />
./pg.py</div>
<p>Once you&#8217;ve ran all that and the ./pg.py bit it should load up with the following:</p>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/07/Screenshot-8.png"><img src="http://alexsleat.co.uk/wp-content/uploads/2011/07/Screenshot-8.png" alt="" title="Screenshot-8" width="318" height="118" class="aligncenter size-full wp-image-16919" /></a></p>
<p>Click Login and then proceed to login and allow PhotoGrabber to do its thing, once you&#8217;ve done that you&#8217;ll get to a screen similar to below with a code:</p>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/07/Screenshot-9.png"><img src="http://alexsleat.co.uk/wp-content/uploads/2011/07/Screenshot-9.png" alt="" title="Screenshot-9" width="937" height="741" class="aligncenter size-full wp-image-16920" /></a></p>
<p>Copy and paste that into the PhotoGrabber window (you&#8217;ll need to use Ctrl+V no right click to paste) and then it&#8217;ll let you choose which photos to take. Once you&#8217;ve picked, hit Download and watch them download to the folder you specify. There&#8217;ll be a lot folders, one for each place you were tagged. Once it&#8217;s done you can upload them however you want to Google Plus otherwise just keep them.</p>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/07/Screenshot-10.png"><img src="http://alexsleat.co.uk/wp-content/uploads/2011/07/Screenshot-10.png" alt="" title="Screenshot-10" width="319" height="454" class="aligncenter size-full wp-image-16921" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/07/16/downloading-all-your-facebook-photos-for-google-plus-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HowTo: Simple Tesseract Usage Guide (OCR)</title>
		<link>http://alexsleat.co.uk/2010/04/12/howto-simple-tesseract-usage-guide-ocr/</link>
		<comments>http://alexsleat.co.uk/2010/04/12/howto-simple-tesseract-usage-guide-ocr/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 09:56:43 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[ocr]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[tesseract]]></category>
		<category><![CDATA[use]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=17</guid>
		<description><![CDATA[<br/><p>Install:</p> <p>(Ubuntu 9.10)</p> <p>sudo apt-get install tesseract-ocr tesseract-ocr-eng</p> <p>Preparing Images for Tesseract with GIMP:</p> Load an image with text into GIMP Image &#62; Mode &#62; make the image RGB or Grayscale. Tools &#62; Color Tools &#62; Threshold &#62; pick a value which best shows the text Image &#62; Mode &#62; Indexed &#62; choose 1-bit &#38; [...]]]></description>
			<content:encoded><![CDATA[<br/><p><strong>Install:</strong></p>
<p>(Ubuntu 9.10)</p>
<p><code>sudo apt-get install tesseract-ocr tesseract-ocr-eng</code></p>
<p><strong>Preparing Images for Tesseract with GIMP:</strong></p>
<ol>
<li>Load an image with text into GIMP</li>
<li>Image &gt; Mode &gt; make the image RGB or Grayscale.</li>
<li>Tools &gt; Color Tools &gt; Threshold &gt; pick a value which best shows the text</li>
<li>Image &gt; Mode &gt; Indexed &gt; choose 1-bit &amp; no dithering.</li>
<li>Save the image as .tif (TIFF but make sure the extension is only .tif and not .tiff)</li>
</ol>
<p><strong>Use:</strong></p>
<p>The input file MUST be .tif (not .tiff) and the output will be a .txt (extension is automatically added by tesseract) so simply typing the following should export the input image (input.tif) as a text file (output.txt).</p>
<p><code>tesseract input.tif output</code></p>
<p><strong>Example:</strong></p>
<p><strong><br />
</strong><br />
Example Output:<br />
Hello World<br />
Alex Sleat<br />
Testing test<br />
All this information was found on the following Ubuntu documentation, I just had some trouble finding it so I have re-wrote as a clean simple guide for anyone else having the same trouble. All thanks goes to whoever wrote the following link. :)</p>
<p>https://help.ubuntu.com/community/OCR</p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2010/04/12/howto-simple-tesseract-usage-guide-ocr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

