Tuesday, January 12, 2010

Living harmoniously with Ubuntu 9.10 and Nokia 5800 XpressMusic

As I mentioned in the previous post, I ran into some trouble syncing my new Nokia 5800 XpressMusic with my laptop running Ubuntu 9.10 Karmic Koala. Sure, the phone would work just fine in mass storage mode via the included data cable and let me transfer anything onto the SD card, but I was not satisfied with it. Apart from other issues, that way I'd still have to create the playlist manually in the phone's music player. And since the phone lacked the capability  to add all the contents of a folder to a playlist (It doesn't allow changing the order of songs in an existing playlist either - those guys at Finland seem to be rather aversive to the idea of playlists), I was not exactly thrilled at the prospect of having to add each song in the full discography of Poets of the Fall to a playlist.
         I needed a program which would not only transfer all the songs in a playlist in my computer to my phone but also create the appropriate playlist in the phone. At first I unsuccessfully tried my luck with Rhythmbox : it showed all the tracks on my phone but stubbornly refused to play any of them.
         But I got lucky the second time. I happened to start amarok - the music player I abandoned ever since Jaunty Jackalope due to its sluggish performance. After googling for amarok plugins to sync with Nokia symbian phones, I came to know about the existence of amarok scripts. Although I couldn't find any script meeting my requirements on the web, on reading some of the scripts I became aware of the powerful DCOP interface of amarok. To my great delight, I found out that it  gives one the freedom to control (and automate) every aspect of that brilliant music player and natively supports python scripts.
         So I chose the obvious solution. I  wrote the code myself in python. The actual procedure was very simple: ask the user to select the playlist he wants to sync and where he wants to copy them to, copy-paste the whole damn thing, create a playlist and be done with it. But  the user interaction part was problematic: the user has to specify long pathnames. Doing so at a  python raw_input prompt without tab-completion can be frustrating. I had to create a gui.
       The last time I tried to code some gui stuff in python, I decided to learn Tkinter. Needless to say, that time I created some of the ugliest possible widgets in the universe. I had no intension of making the same mistake again. But the idea of going through the whole elaborate affair of learning pyQt or pyGTK for creating some simple dialog boxes did not seem appealing to me. While facing this dilemma, I found another gem hidden in the lines of the amarokscripts I already had in my system: kdialog. This was just the perfect thing for my code: simple one-line commands to present pretty dialog boxes showing a message or a file browser where the user can select the paths by means of good old point and click.
       Well, here's another interesting piece of trivia: the temporary playlist amarok creates when you drag and drop music files to its main window is saved as an XML file, but the playlists created manually are saved in normal .m3u format. Unaware of the second fact, I ended up studying xml parsing in python. Although it was totally unnecessary, I learnt about a couple of very powerful python libraries: xml and urllib.
       So the process of syncing the Nokia 5800 with Ubuntu was not as simple as I thought it would be. But my chance encounter with DCOP and urllib turned out to be rather fortuitous as it enabled me to write my second amarok script. I'll write about it in another post someday.

40 comments:

  1. The more I can show really interesting images the more chances we all have that art directors will wake up to the benefits of hiring illustrators.

    ReplyDelete
  2. Woody's love life however, doesn't read chanel outlet nearly as cheery. He's been linked to many louis vuitton outlet of leading ladies and has a penchant for women/girls much, much younger than he is. Woody was once in love with Mia Farrow and http://www.strgraduates.co.uk they adopted kids and had one of their own together, but in what is now an infamous scandal, that relationship ended not cartier replica only his union with Farrow, but almost undid his illustrious entertainment career.

    Mia and Woody parted ways and had a longbrutal http://www.lakesideshopping.com/store1.html (to say the least) custody battle, which was eventually won by Farrow. In Mia's biography, "What Falls Away, Frank Sinatra, who was once married Mia, (to many people's dismay rolex masterpiece watches) offered to have Allen's legs broken when he was found to be having an affair with her adopted daughter, Soon-Yi Previn. Keep it classy, Frank!

    ReplyDelete
  3. World's best writing services are now available in your budgeted prices. If you are feeling difficulty about writing any kind of paper then get wwwritingservice.com - essay writing service from our source and we are making sure to provide you such content which will definitely amused you. Then why to pay more for writing services get it today.

    ReplyDelete
  4. Wholesale rolex replica does not beggarly that you get
    some accommodation on the superior because the best handbags do not accommodation on the quality, in
    fact, they accord the aforementioned cartier
    replica
    adequation and architecture in beneath price. The reason for this beneath amount is that the
    aboriginal artist handbags allegation for their cast name, which is absolutely very cher but the acceptable omega replica backpack banker allegation for their activity and actual
    by accepting some reasonable profit, which do not amount that abundant to the customer. By this, chump
    gets the aforementioned superior in very rational amount but for this it is important that they accept the best
    dealer.You can aswell get the best quality broad chanel replica handbags online, because
    there are abounding dealers who are affairs their handbags online and they aswell accept the shipment ability
    to forward your orders at your aperture step. They accord the aforementioned quality and architecture after
    compromising on the price. This is the best way to attending abundant after spending a
    lot of money on one actual big-ticket artist http://www.vemaawards.com/info.php handbag; instead
    you can get three or added in the aforementioned price,which will aswell bout your altered dresses.

    ReplyDelete
  5. Nokia is very famous company for the quality for its mobiles and and technology to get more information visit superior papers customer reviews site. Nokia always provide us super quality in cheep rates and i am thankful for their great service. model Nokia 3310 was very famous in and high quality model that was no other like that in that time.

    ReplyDelete
  6. YYou can visit our page and make sure that we are the best!

    ReplyDelete
  7. Online term paper wriitng assistance is a solution to those students who want to be succesful in academics as well as remain active in social life. Custom essay wriitng service is your chance to get free time! I wish you good luck!

    ReplyDelete
  8. I heard a lot about this computer system. My professor even assigned me to write a paper on Ubuntu versus Windows. I order a superior essay at www.custom-essays-online.com ;)

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Thanks for this post!

    UEFA Euro 2016

    http://www.playcaper.com/uefa-euro-2016-schedule-groups-matches-standings-live-scores-and-results

    ReplyDelete
  11. Indian Premiere League (IPL)Starting from April 9 to 29 May 2016.Check out latest IPL 2016 Schhedule

    ReplyDelete
  12. I also like ubuntu intead of windows and phone the loved one.
    Ipl 9 2016 Schedule

    Ipl 9 Opening Ceremony

    ReplyDelete
  13. I pretty much enjoyed your post and i am happy to hear you have written python code yourself. students always have doubt in How to write a best essay, then you can have help from online writing service.

    ReplyDelete
  14. imo download
    Truly! Whatever an eye opener this unique put up happens to be in my circumstances. Substantially relished, saved, I just can’t look for further!
    download imo for pc
    imo video call

    ReplyDelete
  15. Customary home loans, regardless of whether for single-family residences or venture properties, for example, duplex house arrangements, are not guaranteed by the administration. On the off chance that the up front installment is under 20%, private home loan protection is generally required. cash advance

    ReplyDelete
  16. Property holders settling on the settled rate home loan can have intrigue just home loan with a settled rate. The 5-year ARM offers an intrigue installment for the initial 10 years. This will be a settled rate. Payday Loans

    ReplyDelete
  17. Daylight Mortgage has entry to more than two-hundred moneylenders and will help you to figure out which Florida home advance will work best for you. Regardless of whether you require a 30 year settled rate contract or you're wanting to get a Florida home credit requiring no focuses and no cash down, Sunshine Mortgage will help you to get the Florida home advance that addresses your issues.Car Title Loans Chicago

    ReplyDelete
  18. It is simple for such individuals to be despondent and feel that they will never have the capacity to claim their very own home. Gratefully, loaning establishments have turned out with the idea of no credit check home advances, which permits individuals with awful credit to make applications for advances and buy their fantasy home of their decision. check cashing san-diego

    ReplyDelete
  19. This special case opens up numerous conceivable outcomes for the individual with resources yet next to zero money. Do you have a home with value? Is it true that you are an auto buff with an important exemplary. Car Title Loans Chicago

    ReplyDelete
  20. Obviously you must know that on the off chance that you utilize your home as security on an advance, on the off chance that you default on your installments then you are gambling losing your home. payday loans chula-vista

    ReplyDelete
  21. To do this, you should compose and send letters specifically to the office and the lender distinguishing the off base data. In any case, it can take months, or even years, to get mistakes expelled or altered from a credit report, so be set up for a possibly troublesome and baffling procedure.

    ReplyDelete
  22. site
    click here
    click here
    site
    <a href="https://id.arduino.cc/theranusinghji>site</a>

    ReplyDelete
  23. I thank you for the information and articles you provided

    ReplyDelete
  24. cool, please guidance so that I can create a blog like yours

    ReplyDelete