Push a file to your Smartphone

This is a quick tip. If you need to push a notification to your smartphone, or even send a file, I recently stumbled upon "Pushbullet".
I was looking for a solution to send a file (with automatic download) to my phone, via bash script on my raspberry pi. I've been using pushover for a while, but as far as I know, it doesn't support files

I have read the Pushbullet API, and came to realise that sending a file have 3 steps

1. Getting credentials to send the file
2. Upload the file to a remote server
3. Send a notification of "file" type with the download url

Of course, you can do 1 and 2 youself if you have access to a place which stores the file (I also managed to send a dropbox download link)

You need to sign up for Pushbullet via web, to get the api key, and also install the app on your smartphone (obviously)

So here is the bash script (It's not elegant - but it works)
Continue reading "Push a file to your Smartphone"


Share NFS from Windows

I recently bought a second raspberry pi, for the purpose of making it a "dumb" media center running XBMC (Raspbmc to be exact). I already have a media center PC running XBMC on Windows 7, and I wanted to connect my raspberry pi to the downloaded media, stored remotely on the Win7.

First, of course, I tried SMB (windows share). It worked… ok. But after installing a new HP Wireless printer, it seemed to disconnect a lot. I don't fully understand why, but it appears that the printer publishes itself as SMB master thus disconnecting my other SMB connections (or maybe only Linux ones)

Anyways, I have spent almost two days, understanding how to connect the Raspberry pi to Windows 7 using NFS. It was not easy, because it seems Microsoft has dropped support for it on home OS (even Win7 ultimate) since Windows XP.

I ended up doing it with Cygwin (which gives powerful Linux capabilities to windows machines).

I want to outline what I have done in order for this to work. This process could be very easy and it could be frustrating. I really hope it will help you do it yourself.

So it might do the trick as step-by-step, and you might come some obstacles on the way

The original guide I used can be found in this link, however it did not work at once and I had to tweak a bit. Also, it is referring to Windows XP.

As this is not step-by-step in full, with screenshots, it might help you on your journey. This can also help you with any windows share to be exported to linux

Here it is: Continue reading "Share NFS from Windows"


The Raspberry Pi is Here

A few months back I placed an order for a raspberry pi. For those who don't know what it is, it is a really cool project which is basically a computer for 35$ (Shipping for me almost doubled it, but that's to be expected). It is a board, which as 256MB Ram, SD-Card slot, 2 USB Slots, an RCA Slot for analog video, and a headphone jack for analog audio.

It is originally a project for schools, to help today's kids get started with (python, but not only) programming.

To be exact with what the project guys are describing it:

The Raspberry Pi is a credit-card sized computer board that plugs into a TV and a keyboard. It's a miniature ARM-based PC which can be used for many of the things that a desktop PC does, like spreadsheets, word-processing and games. It also plays High-Definition video.
Here are some FAQs

The OS of this board is stored on an SD Card. I have bought a class 10 16gb SD Card off of eBay for this purpose.

So few days ago, the board arrived! I finally found myself playing with it, and it's so much fun

Here are some common suggestions for usages: Continue reading "The Raspberry Pi is Here"


Download all your Last.fm loved tracks in two simple steps

I'm a fan of Last.fm online radio, and I have a habit of marking every good song that I hear as a "loved track". Over the years I got quite a list, and so I decided to turn it into my jogging playlist. But for that, I need all the songs downloaded to my computer so I can put them on my mobile. While Last.fm does link to Amazon for downloading all the loved songs for pay, I'm going to walk the fine moral line here and suggest how you can download every song from existing free YouTube videos.
If it really bothers you, think of it as if I created a YouTube playlist and now I'm using my data plan to stream the songs off YT itself..
Moral issues resolved, we can move on to the scripting.

Update (4/27/12): youtube-dl.py has moved: https://github.com/rg3/youtube-dl/, and also added a very neat --extract-audio option so you can get the songs in audio right away (it basically does a conversion in a second step).
Continue reading "Download all your Last.fm loved tracks in two simple steps"


Showing video with Qt toolbox and ffmpeg libraries

I recently had to build a demo client that shows short video messages for Ubuntu environment.
After checking out GTK+ I decided to go with the more natively OOP Qt toolbox (GTKmm didn't look right to me), and I think i made the right choice.

So anyway, I have my video files encoded in some unknown format and I need my program to show them in a some widget. I went around looking for an exiting example, but i couldn't find anything concrete, except for a good tip here that led me here for an example of using ffmpeg's libavformat and libavcodec, but no end-to-end example including the Qt code.

The ffmpeg example was simple enough to just copy-paste into my project, but the whole painting over the widget's canvas was not covered. Turns out painting video is not as simple as overriding paintEvent()...

Firstly, you need a separate thread for grabbing frames from the video file, because you won't let the GUI event thread do that.
That makes sense, but when the frame-grabbing thread (I called VideoThread) actually grabbed a frame and inserted it somewhere in the memory, I needed to tell the GUI thread to take that buffered pixels and paint them over the widget's canvas.

This is the moment where I praise Qt's excellent Signals/Slots mechanism. So I'll have my VideoThread emit a signal notifying some external entity that a new frame is in the buffer.
Here's a little code:

Continue reading "Showing video with Qt toolbox and ffmpeg libraries"