Wednesday, October 17, 2007

DCOP: Scripting the KDE Desktop

KDE provides a powerful interprocess communication system in DCOP, the Desktop COmmunication Protocol. Using DCOP, you can control a wide range of functions in KDE from the command line or from a script written in your favorite scripting language. You can also get information out of KDE applications: for example, several KDE media players provide methods to query the player for information about the currently-playing track.

For the whole Artical can be seen HERE

I found this when I was trying to write a script that will change my desktop to the Daily comic strip Dilbert automatically
Then I found the DCOP command
Example
#dcop kdesktop KBackgroundIface setWallpaper /tmp/dilbert.gif 1

The Above command will change your desktop wallpaper to /tmp/dilbert.gif

If any one interested to see the script the script is at link given bellow
python script source code

Sunday, October 14, 2007

Script to Automate Download Google Videos

I had to download a large number of google videos this week. But I was fade up with the pasting the url in to sites like keepvid.com then click on the download links then downlaod videos. I had a defined list of videos to be downlaoded, so I decided to write my own programm to download these files automatically from a commandline program.
My program reads the filename given in the commndline and then treats each line of the file as a google video entry and filename given separated by pipe.
Format is as shown bellow

# cat testurl.txt
http://video.google.com/videoplay?docid=2889527841583480458|testvdo.flv
http://video.google.com/videoplay?docid=1332505621497959742|testvdo2.flv
#
(testurl.txt can be downloaded from HERE

The python code is as given bellow

Python Code File
I am too lazy to format code in blogger post, so I have uploaded the file.

Save the python code as file name getvdo.py
make sure you have testurl.txt file with the google video urls, then run the code by command given bellow
[code]
python getvdo.py testurl.txt
[/code]

Any suggestions welcome
Now Some LEGAL Crap

 Is this tool legal?

From http://www.google.com/terms_of_service.html: "You may not send
automated queries of any sort to Google's system without express
permission in advance from Google."

This means that you should not use this tool to query Google without
advance express permission. Google appliances, however, do not have these
limitations. You should, however, obtain advance express permission from
the owner or maintainer of the Google appliance before searching it with
any automated tool for various legal and moral reasons.

The author wrote this tool not to violate Google's terms of service (ToS)
but to automate some of his work.