January 14, 2010, 6:35 PM
When it comes to music, I get FLAC versions of my favourite songs and listen to these on my desktop with my Audio Technica ATH-A900′s. However, it becomes troublesome when syncing my music to my iPod (which sadly lacks FLAC support). Until funds become available, in which case I can upgrade to a better media player, I have been working to try and find an easy way to convert from FLAC to MP3, using freely available tools.
Ultimately, I would like to find a solution that works with foobar2000 and the iPod manager plugin, which would allow it to transparently convert from FLAC to MP3 when syncing to my ipod. Until I work out how that would be possible, I’ve found a way to quickly convert individual songs using FLAC and LAME, whilst preserving tags using TAG.
Place flac.exe, tag.exe and lame.exe in the same folder, and use the following commands:
FLAC --decode --stdout song.flac | LAME -V2 --vbr-new - song.mp3
TAG --fromfile song.flac song.mp3
January 9, 2010, 12:51 PM
Below is a script I occasionally use to transfer log files from my server to my desktop. This scripts works with Net::FTP and Perl 5.10.0.
#!/usr/bin/perl
use Net::FTP;
# Basic Settings
my $host="ftp.example.com"; # Remote FTP Server
my $directory="/Server/wamp/logs/"; # Navigate to this directory on remote FTP.
my $username="user"; # FTP Username
my $password="pass"; # FTP Password
#Advanced settings.
my $timeout=1000; # FTP Timeout
$ftp=Net::FTP->new($host,Timeout=>$timeout) or $newerr=1;
push @ERRORS, "Can't ftp to $host: $!\n" if $newerr;
myerr() if $newerr;
print "Connected\n";
$ftp->login($username,$password) or $newerr=1;
print "Getting file list";
push @ERRORS, "Can't login to $host: $!\n" if $newerr;
$ftp->quit if $newerr;
myerr() if $newerr;
print "Logged in\n";
$ftp->cwd($directory) or $newerr=1;
push @ERRORS, "Can't cd $!\n" if $newerr;
myerr() if $newerr;
$ftp->quit if $newerr;
$ftp->get("access2.log"); #Rename/duplicate as you need it.
$ftp->quit;
sub myerr {
print "Error: \n";
print @ERRORS;
exit 0;
}
Note: I may have built this script based on some internet examples, so I don’t take *complete* credit for this script.
January 4, 2010, 10:30 PM
When using the Facebook Events calendar feed within Google Calendar, many events show up only as “busy” instead of their proper name. This is because Google Calendar does not handle events with “CLASS:PRIVATE” properly.
The following PHP script is something that was thrown together quickly that grabs the feed from Facebook, replaces “CLASS:PRIVATE” with “CLASS:PUBLIC” and outputs it. Just edit the script to match your personal URL, then upload it on a PHP enabled server. Point Google Calendar to this file, and you should be able to view all your events properly again.
<?php
header('Content-type: text/calendar');
$url = "YOUR_FACEBOOK_URL_HERE"; //starts with http://www.facebook.com/ical/...
$pagetext = file_get_contents($url);
$pagetext = str_replace("CLASS:PRIVATE", "CLASS:PUBLIC", $pagetext);
echo $pagetext;
?>