Update Banshee’s internal audio file URIs after moving

28. August 2010

0 Comments

After moving the audio library to another place, the internal URIs of music known to Banshee has to be updated. There is no perfect way implemented into banshee. But maybe the “Rescan Music Library” works for you. If not, it’s easy to update its database because great sqlite3 is used.

# necessary tool installed?
sudo apt-get install sqlite3
 
# change to config dir and backup
cd ~/.config/banshee-1
cp banshee.db banshee.db.backup
 
# dump track entrys to sql file
sqlite3 banshee.db
> .output CoreTracks.sql
> .dump CoreTracks
> .quit
 
# update sql file
sed 's,file:///old/and/much/too-long/path/to/music/,file:///new/path/music/,' < CoreTracks.sql > NewCoreTracks.sql
 
# change db
sqlite3 banshee.db
> DROP TABLE "CoreTracks";
> .read NewCoreTracks.sql
> .quit

Don’t forget to update the banshee preferences to the new path.

¬ written by gimi in Scripts, Snippets, howto

Peek Tiny URL from bit.ly, tiny.cc, etc

2. July 2010

0 Comments

If you want to see full addresses from URL shortening services like bit.ly (see Twitter), tiny.cc, tinyurl.com or even gimi.name/go I got something for you.

This code just looks up the redirection address and returns it to you. Every service with immediate redirection should work, because they use the same method.

function peekTinyURL($url) {
	$context = stream_context_create(array('http' => array('method' => "HEAD")));	
	$fp = fopen($url, 'r', false, $context);
 
	if(!$fp) {
		 return false;
	}	 
	$header = fHttpHeader($fp, array('Location' => false));
	fclose($fp);
	return $header['Location'];
}
 
// example
$url="http://gimi.name/go/Ns1FO"; // redirects to this article
$location = peekTinyURL($url);
if($location) {
	echo "$url redirects to $location\r\n";
}
else {
	echo "That didn't work. :(\r\n";
}

This code uses the function fHttpHeader from Short HTTP POST function for PHP

Live Demo:

 


¬ written by gimi in Scripts, Snippets

Lighttpd and PHP for Ubuntu

6. May 2010

0 Comments

sudo apt-get install lighttpd php5-cgi
sudo lighty-enable-mod fastcgi
sudo /etc/init.d/lighttpd force-reload

¬ written by gimi in Scripts, Snippets

NFS Mount fails: “RPC Error: Success”

29. April 2010

3 Comments

mount.nfs: mount to NFS server '$host:/$path' failed: RPC Error: Success

Solution:
mount -o nfsvers=2 $host:/$path $dst

¬ written by gimi in Scripts, Snippets, console

Banshee and a “Mass Storage Media Player”

31. January 2010

0 Comments

cd /media/$device
touch .is_audio_player

Works with SD or Phone Cards …
This is more like a hack for standart USB devices.
Thanks to hyperair.

¬ written by gimi in Snippets

Based on a theme by BenediktRB • Top left picture from piqs.de, cc-by • Thanks for donating spare CPU cycles. explain • Powered by WordpressRSS Feed