Planet LUG Manipal

March 11, 2010

Auto album name fill in amarok

Here's a small piece of code i wrote ages ago, never really published it anywhere. Get it from here https://code.google.com/p/albumtagger/

Run the script externally with amarok running in the background. Download all the modules required, especially the ID3 module which can be found on sf. This script uses last.fm api. Keep it rocking with Amarok.


# albumtagger_amarok by kunal kerkar (aka tsudot)
#
# simple script which fetches album tag and inserts in the ID3 metadata

__module_name__ = "albumtagger_amarok"
__module_version__ = "0.1"

import urllib
import time
import commands
from ID3 import *
from xml.dom import minidom

basic_url = "http://ws.audioscrobbler.com/2.0/?"
method = "track.getinfo"
api_key = "1895a6ef7a8783052dc011f6ed747964"

def isPlaying():
return commands.getoutput('dcop amarok player isPlaying')

def countDown(seconds):
sleep(seconds)

def getTrackDetails():
global artist
global track
artist = commands.getoutput('dcop amarok player artist')
track = commands.getoutput('dcop amarok player title')

def getAlbum():
global artist
global track
global method
global api_key
global basic_url

url = 'http://ws.audioscrobbler.com/2.0/?method=track.getinfo&api_key=1895a6ef7a8783052dc011f6ed747964&artist='+artist+'&track='+track
feed = urllib.urlopen(url)
xml = minidom.parse(feed)
lfm = xml.childNodes[0]
track = lfm.childNodes[1]
album = track.childNodes[19]
album_title = album.childNodes[3]
album_title_data = album_title.firstChild.data
putid3tag(album_title_data)

def putid3tag(album_title):
if(album_title== 0):
return 0
else:
path = commands.getoutput('dcop amarok player path')
print "Album: "+album_title+ " has been appended to the track"
id3info = ID3(path)
id3info.album = album_title

def findTime():
totalTime = commands.getoutput('dcop amarok player trackTotalTime')
currentTime = commands.getoutput('dcop amarok player trackCurrentTime')
leftTime = int(totalTime) - int(currentTime)
print "Time left for the next check: "+leftTime
return leftTime

if __name__ == "__main__":

while True:
if(isPlaying()):
getTrackDetails()
getAlbum()
countDown(findTime())

else:

print "No tracks playing"
countDown()

Ankur Shrivastava (BE-2k7)

Weekend Project

In Dec 2009 at foss.in at the maemo stall i saw a guy control a small toy car through accelerometer on his N900, i thought of replicating that but it just remained in my mind, so last Saturday i finally decided to implement it and went straight to a toy store and bought a toy RF car, one hour of hacking and i was able to control the small car through by phone (Nokia E61i) here is the video of it working.

the concept is simple, i send commands through my phone over wifi to my laptop which controls the car remote, controlling a toy car remote is very easy with a Parallel port and few transistors but laptops don’t have parallel ports, so i used a micro-controller in between to sort that out, so now micro controller controls the car remote by acting on signals received over UART from laptop.
the working is Phone —(WiFi)—>Laptop —(USB/UART)—> Micro controller —(Relays)—> Car Remote —(RF)—> Toy Car
will post details with code sometime later

Using Apple Keyboard in Linux (Fedora)

My Apple Keyboard

My Apple Keyboard


Few Days Ago i received my Apple Keyboard and i am enjoying typing on it, but having to hold down the Fn key then tap one of the F-keys to get F-keys working was irritating.
a simple solution to get it working just add this to your /etc/rc.local file
echo 2 > /sys/module/hid_apple/parameters/fnmode

and F-keys will start to work properly, enjoy

Update :- update for recent kernels,

March 05, 2010

The Ubuntu Rebranding

When I look back at my college days, the only two distros on which I can count on for simplicity was Fedora and Ubuntu. I used the latter just because it suited me and for exercising my right of freedom. Let me jot down the biggest problems I faced whenever I wanted to propagate Ubuntu in my college days under the LUG Manipal banner:

  • People disliked the dark brown theme
  • It didn’t look professional
  • The graphics card didn’t work (The ATI ones)
  • Atheros wireless driver has it’s own share of problems
  • It wasn’t windows
  • …..list continues

The change in branding

This is what I actually wanted from Ubuntu. Just making things doesn’t work. Normal people don’t want advanced things like GIMP or a desktop mail client. All they need is basic things should just work and an eye-candy. Everything should look cool and pleasant.

The new Ubuntu logo: Looks better

This font looks better and more professional than the earlier one. The one before this looked someone like Comic Sans.

Improvements

  • The re-branding brings in much needed boot-screen change. A simple boot-screen is a lot better than a constantly animating one. Remember, the blink tags and marquees for HTML. They do nothing more than distraction.
  • I liked the light theme more than the dark. The reason being that it looks better to my eyes and not because it remotely looks like Mac OSX.
  • Read Mark’s view on this whole saga. Orange will represent Community and Aubergine would represent Canonical. Every branding should be looked with three parameters: Community <=> Commercial, Consumer <=> Enterprise and End-User <=> Engineer. Aubergine with white dots means it is more Commercial and Enterprise based branding.
  • The newer website is a lot better than the previous one. Hope they are not moving away from Drupal.

New Proposed Ubuntu Website

The Roadblocks

Ubuntu has many roadblocks in becoming a major Operating System. Many of them are from within the Open Source community itself. Probably Ubuntu is growing quite fast, but when compared to overall OS market, it is stagnant.

  • Wireless driver problems need to be fixed. Many people just give up because they cannot make Wireless to work on it.
  • The graphics support is still quite weak. People with ATI cards report more problems with NVidia ones. This is one of the places where everyone has been bitten one or the other time. Since I have Intel 945GM graphics chipset on my laptop, those bad days have not struck on me yet.
  • Another roadblock is that Ubuntu has to face a lot of hate from within the OSS community itself. People bash it because it brings in non-technical people into the Linux worlds who don’t want to compile their drivers or don’t want to use the command line.  Some of them go even one step ahead and claim that Linux isn’t meant for people who can’t understand computers. My situation would be the same if I was asked to open the BMW engine(Linux kernel) and fix something deep inside by pulling some random wires(typing commands)
  • Linux in particular was designed to run on ever goddamn architecture on this world. Even though it is a good thing, the effort is split up.

Solution

  • OEM tie-ups: To me, this is the only left to fix the current mess. If you buy a system, the people supplying the hardware will make sure that everything works fine with the OS they provide.  In this case, graphics and wireless drivers can be pre-installed. Depending on patent jurisdictions, even codecs can be pre-installed.
  • Focus on Looks and Usability: Many of the GNOME apps have such horrible looks that I feel it was hacked overnight by devs in half-sleepy state. Some apps like gnome-system-monitor eat up 50% CPU and report the CPU usage to be 50%+.

Finally I am thinking of shifting to Lucid once it comes out.


February 28, 2010

Mozilla Developer Day Bangalore, 27th February 2010

Mozilla along with Mahiti organised a Mozilla Developer Day at NIMS, Bangalore at JRD Tata Auditorium. For people who want to know about the event via tweets please check the hashtag #mozdevday on Twitter

Introduction

As per the schedule, the event was supposed to kick-start at 9:30AM in the morning. After getting up in the morning and beating all the traffic as travelling 33KMs, I finally reached NIAS Campus at 11AM. After getting the badges, feedback-form and other delegate stuff, I went inside the auditorium to see what’s cooking inside.

Web Standards

Speaker: Arun Ranganathan

When I entered Arun was speaking on Web Standards. I think I missed the drum-beat part of his presentation as I was late. Abhishek Mishra and Rohan Prabhu had reached at 10AM itself and were a part of the audience from the very beginning.

Arun gave us a presentation on

  • Geolocation based services for pictures.
  • Font-face support in Firefox and other HTML5 based controls.
  • API for drag-and-drop
  • 2D support in Firefox. He showed us a Mario kind of game made using Canvas.
  • 3D support in Firefox using WebGL
  • Accelerometer support for Firefox. He showed a game which we can play by tilting our devices (Mobile/Laptop)
  • Video support in Firefox using HTML5

Arun even showed us how powerful video tag is on Firefox. We can embed a text inside a video, or even a video inside a video. Don’t believe? Have a look at the page where Arun pointed us to visit

Web.Next

Speaker: Seth Bindernagel

Seth is the localisation Director at Mozilla. He was speaking on what we can expect next from Firefox. His presentation covered mainly:

  • Out of Process Plugins
  • Improved cold startup time
  • Personas
  • Extension Manager
  • Weave

Seth discussed a bit on how Flash crashed are a big headache for the web. The next Firefox will have these plugins running as separate processes, so that the crash effects can be isolated.

For people who actually want to see how Flash crashes on the browser and how easy it is to make Flash go bonkers, just visit this site http://flashcrash.dempsky.org/

Seth also gave a lot of time on Weave and how useful it can be for a person to sync his preferences on the cloud. For privacy fanatics, he explicitly stated that all the data is encrypted at client side and then sent on the Mozilla servers. People can even run their own Weave servers.

Mozilla Labs

Speaker: Ragavan Srinivasan

Ragavan came on the stage to  present Mozilla Labs and what all they develop apart from the browser. The products which come out of the lab are Weave, Bespin and Jetpack.

Broken Sites

Speaker: Arun Ranganathan

If you visit MS Ramiah Institute of Technology’s Student Information System or FYJC’s site using a non-IE browser, then you can experience the over-smartness of the super intellectual web-masters behind the site. FYJC takes the situation to extreme levels.

Arun explained how we are supposed to report these broken sites using Firefox itself or using Mozilla Bugzilla. When using bugzilla, the explanation needed to be very exhaustive. He even asked us to tag such reports with “India” so that Arun can personally hunt down such sites.

Hack Session

Speaker: Arun Ranganathan

Arun recorded a video using a camera. Then he transferred it to his MacBook which was in MP4 format. He created a small page using HTML5 video element and opened it in Firefox,Safari and Chrome. The video which was recorded showed up properly in Chrome and Safari and not in Firefox. This was posed as a question. Many hands went up, with the first answer being the correct one. Yes. Firefox wants the web to be free and doesn’t want to license proprietary codecs for the web.

The million dollar question remains – How to convert H.264 videos to open format. Arun introduced us to a Firefox Addon named Firefogg. This converts the video to ogg which can be now played using Firefox and Chrome. Safari doesn’t want to support ogg.

I know I made no reference to Mahiti’s speech and Praneesh’s too. The post would be just too long.

Finally I would like to thank Mahiti and CIS-India for organising the event, providing free WiFi and arranging Lunch, tea and T-shirts and badges.