Add YouTube titles to Google spreadsheet through Apps Script

I wanted to get a list of all the videos uploaded on YouTube by a specific user. A nice feature of Google Docs (Spreadsheet) is the abbility to add and run apps scripts to get data based from an external source like YouTube. So I changed a already existing script (http://ctrlq.org/code/19561-youtube-google-apps-script) and it works perfectly for me. Open a new Google Spreadsheet. The click “Tools > Script editor…” and copy past the code below. The you can run the script from within the “Script editor”. You probably need to authorise using YouTube within Google Spreadsheet.

function init() {
  retrieveUploads("allerhande",1);
}
function retrieveUploads(playlistID,start) {

var startpoint = start, options, titles = [], descriptions = [], videos = [], duration = [], uploaded = [], result, json, title="";
options = {
};

Logger.log('start');

do {
// Run in a loop since YouTube Data API only returns 50 videos in a batch
result = UrlFetchApp.fetch("http://gdata.youtube.com/feeds/api/users/" + playlistID + "/uploads?v=2&max-results=50&alt=json&start-index="+startpoint, options);
json = Utilities.jsonParse(result.getContentText());

// if there are no entries, stop do while loop
if (!json.feed.entry)
break;

// add certain data from entries to array
for (var i=0; i<json.feed.entry.length; i++) {
  titles.push(json.feed.entry[i].title.$t);
  descriptions.push(json.feed.entry[i].media$group.media$description.$t);
  duration.push(json.feed.entry[i].media$group.yt$duration.seconds);
  uploaded.push(json.feed.entry[i].media$group.yt$uploaded.$t);
  videos.push("http://youtu.be/"+json.feed.entry[i].media$group.yt$videoid.$t);
}

// increase the start-index by 50
startpoint += 50;
} while (startpoint < json.feed.openSearch$totalResults.$t);

// get active spreadsheet by name
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName(playlistID);

// add sheet if non exists with the given playlistID
if(sheet === null) sheet = ss.insertSheet(playlistID,2);

// add Youtube data to spreadsheet
for(var i=0;i<videos.length;i++) {
  sheet.getRange((i+start), 1, 1, 5).setValues([[titles[i],descriptions[i],duration[i],uploaded[i],videos[i]]]);
}
Logger.log('done');
}

Fixing the locale error on Debian Wheezy

When you get errors with running commands on your Raspberry Pi like “warning: Setting locale failed.” you can fix this by updating the locale file in the OS. You can do this by typing:

pi@raspberrypi ~ $sudo nano /etc/default/locale

on your Raspberry Pi command line or in your Terminal window from your Mac when connected to the Raspberry Pi.

Next you have to change the following lines within the editor that just opened:

LANG = (unset),
LC_ALL = (unset),
LANG = en_GB.UTF-8

and change this into

LANG = en_GB.UTF-8,
LC_ALL = en_GB.UTF-8,
LANG = en_GB.UTF-8

Now you’ve edited the locale file and you need to save the file. You do this by exiting the nano environment by using the shortcut “CTRL + x”. And press “Yes” to save.

Access files on your Raspberry Pi from your Mac

To access the files on your Raspberry Pi on your Mac Finder you can install the appletalk protocol on the Pi by typing the following commands on the Raspberry Pi.

pi@raspberrypi ~ $sudo apt-get install netatalk

This lets you use the following (in the terminal on your Mac) to connect to the Pi

yourmac:~ username$ open afp:/10.1.1.10

Now you will see the Raspberry Pi appearing in your Mac Network where you will need to login on (default user/pass), to see access the files and folders.

Next up is http://www.derkbraakman.com/fixing-locale-error-debian-wheezy/

Connecting with a remote desktop (VNC, Debian Wheezy)

You don’t need to connect to a external monitor when the Raspberry Pi is connected to a network. You can use Virtual Network Computing by installing tightvnc on your Raspberry Pi and using the pre installed “screen sharing” on your Mac.

First you need to install tightvnc on your Pi:

pi@raspberrypi ~ $sudo apt-get install tightvncserver

and run it

pi@raspberrypi ~ $tightvncserver

If you have a Mac you need to go to the “Finder” and select “Go > Connect to Server…” or use the Shortcut “CMD + K”

Continue reading

Raspberry Pi Camera (Mac)

Recently I ordered a Raspberry Pi camera module and I going to share the some I made for getting the camera and the Pi working for me. The Hardware I have is a Mac (OS version 10.9 – Mavericks), a Raspberry Pi module B 2012 and a Raspberry Pi Camera Module v3.

Connecting and installing the camera

Follow the steps on http://www.raspberrypi.org/camera. Don’t forget to use the connector behind the Ethernet port and not the other one.

Next up http://www.derkbraakman.com/connecting-with-a-remote-desktop-vnc-debian-wheezy/

Trakt.tv – movies you and your friends have seen

Trakt.tv - movie page

When I was searching for the best app for keeping track of my watched movies/series I found trakt.tv to be the best one. Months ago I already started adding movies that I wanted to see on imdb.com. But this was not a very nice listing system for keeping track of my movies I wanted to see or have seen. I’ve also looked at a similar service called follw.it, but I think the interface is less cool.

Continue reading

IKEA Asks Volunteers To Help Them Move Their Store

Strange_But_True_5-_716045t

IKEA moved its store location in Bergen, Norway, and they decided to ask for volunteers to help with the opening to engage with the community. Creativity reports that the agency SMFB used press, outdoor, banner ads, and social media to call them to action. Volunteers could sign up on its website to do favors such as making a speech during the opening, assisting the mayor at the ceremony, planting the first tree outside the entrance, hosting the customer radio, etc. More….