Get updates of completed torrents via SMS Part 2

The other day one of my friends Ankur , made a python script to get updates via sms using twitter account.
Check here :http://tinyurl.com/djbnon

I have changed the script to use Gmail SMTP instead .
Enjoy

import dbus,base64,urllib2,urllib
from dbus.mainloop.glib import DBusGMainLoop
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email import Encoders
import os

ver = "v1.0"
gmail_user = ""				                #Gmail Username

gmail_pwd  = ""					#Gmail Password
gmail_alias=" "+gmail_user                       #Gmail Nickname
gateway=""	# Check http://tinyurl.com/d5ghcv

def mailz(text):

    mail = MIMEMultipart()
    mail['From'] = gmail_alias

    mail['To'] = gateway
    mail.attach(MIMEText(text))
    mailServer = smtplib.SMTP("smtp.gmail.com", 587)
    mailServer.ehlo()
    mailServer.starttls()
    mailServer.ehlo()
    mailServer.login(gmail_user, gmail_pwd)
    mailServer.sendmail(gmail_user, gateway, mail.as_string())
    mailServer.close()

DBusGMainLoop(set_as_default=True)

s = dbus.SessionBus()
kt = s.get_object("org.ktorrent.ktorrent","/core")

def update(k):
        torrent = s.get_object("org.ktorrent.ktorrent","/torrent/"+k)
        name = torrent.get_dbus_method("name","org.ktorrent.torrent")
        mailz("ktorrent: finished " +name())

kt.connect_to_signal("finished",update)

import gobject
loop = gobject.MainLoop()
loop.run()

Fedora 10 Fglrx

Finally the RPMFusion Stable NonFree Updates repositories have the fglrx driver
All steps are to be executed in root/super-user mode

1) Get RPMFusion Repos.

rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

2) Install Fglrx

yum  install akmod-fglrx xorg-x11-drv-fglrx xorg-x11-drv-fglrx-libs -y

3) Blacklist radeon
Add

blacklist radeon

to /etc/modprobe.d/blacklist

4) Reboot

5) Make initrd

– While booting at grub press ‘e’ in line starting with kernel. Add ‘single’ to the end. Press ‘ESC’ & press ‘b’

cd /boot/
rm initrd-`uname -r`.img
mkinitrd initrd-`uname -r`.img `uname -r` --with=fglrx

6)Reboot

NOTE: You might have to do

aticonfig --initial -f

Install XBMC

XBMC (a.k.a. XBOX Media Center) is a great media center available on all platforms

If you have Ubuntu then see this
http://xbmc.org/forum/showthread.php?p=185738

For Fedora an unofficial rpm is available at http://www.fedorajunkies.com/index.php/XBMC

Installing From source:

0) Get Latest SVN Snapshot

svn co http://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC/

Fedora:
1)Get RPMFusion Repo:

rpm -Uvh  http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

2)Install Dependencies :

yum install SDL* glew glew-devel libmad-devel tre tre-devel libogg libogg-devel libvorbis libvorbis-devel boost 
boost-devel bzip2-devel bzip2-libs fribidi* lzo lzo-devel mysql-libs mysql-devel jasper jasper-devel faac faac-devel 
enca enca-devel hal hal-devel hal-libs cmake gperf nasm libXmu-devel fontconfig-devel freetype-devel libXinerama-devel 
pcre-devel gcc-c++ sqlite-devel curl-devel pulseaudio-libs-devel libsmbclient-devel

3)Make sql symbolic link
– For i386

ln -s /usr/lib/mysql/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so

For 64 bit

ln -s /usr/lib64/mysql/libmysqlclient.so.15.0.0 /usr/lib64/libmysqlclient.so

4)Configure

cd linuxport/XBMC
./configure

5)Make

make

During this some errors may occur:
A)

../xbmc/utils/CharsetConverter.h:31:39: error: fribidi/fribidi_char_sets.h: No such file or directory

Sol:

cd xbmc
ln -s lib/libfribidi/ fribidi
cd ..
make

B)

/usr/include/jpeglib.h:1096:55: error: jpegint.h: No such file or directory

Sol:

cp xbmc/lib/cximage-6.0/jpeg/jpegint.h /usr/include/
make

C) For any other errors refer to fedorajunkies.com or fedoraforums.org

6) Install

make install

7) Configuring

Open xbmc by typing   xbmc in terminal or ALT+F2

-Settings > System >Audio Hardware
-Change Audio Output to Digital
-Change Audio Output Device and Passthrough Output Device to same device settings

(pulse -for fedora , hdmi/spdif- for ubuntu/debian systems)

You can also find out your device by using

aplay -L

8) To learn More about plugins and scripts Visit

http://www.xbmc.org/wiki

Install fglrx from rpmfusion testing repos

Now the fglrx driver is available in testing repos it can be installed .Since its in testing repos it is not recommended.
Older Guide: http://fglrx.djsh.net Older Guide’s Install Script: http://installfglrx.djsh.net

Make sure you have rpm-fusion repo installed

rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

Install Driver using yum

yum --enablerepo=rpmfusion-nonfree-updates-testing install akmod-fglrx xorg-x11-drv-fglrx xorg-x11-drv-fglrx-libs.

fglrx Install script fedora 10

THIS SCRIPT IS NO LONGER REQUIRED SINCE PACKAGES IN RPMFUSION REPO WORK .

http://djsh.net/2009/01/26/fedora-10-fglrx/

Note:

– Remove all packages related to previous attempts to install fglrx

– It now supports x86_64 but requires more testing on the platform

– Since its new it will have many unobserved bugs even though it has been tested

-This uses the ati driver at http://ati.amd.com/support/driver.html

-For x86_64 bit OS you can either select  64 bit driver (while installing) or install 32 bit driver and remove # sign in front of a section called NOTE.

-If any bugs are encountered please comment about them (with details) at this blog.

To install put driver and script in same folder and run sh installfglrx (root mode)

DOWNLOAD LINK

AFTER INSTALL(if everything is working_:

edit /boot/grub/menu.conf

instead  of nomodset put vga=0xA

A is the VESA mode http://en.wikipedia.org/wiki/VESA_BIOS_Extensions


fglrx install script for fedora 10

REFER TO NEWER POST  HERE

Yes, this is a script to install fglrx on fedora 10 due to problems faced by people.

Note:

– Remove all packages related to previous attempts to install fglrx

– For time being this supports only 32 bit Fedora 10

– Since its new it will have many unobserved bugs even though it has been tested

-This uses the ati driver at http://ati.amd.com/support/driver.html

-Any bugs encountered please comment them at this blog

To install put driver and script in same folder and run sh installfglrx (root mode)

DOWNLOAD LINK

AFTER INSTALL(if everything is working_:

edit /boot/grub/menu.conf

instead  of nomodset put vga=0xA

A is the VESA mode http://en.wikipedia.org/wiki/VESA_BIOS_Extensions

Reliance ATZ USB CDMA Modem on fedora , ubuntu and other linux

1) Find Vendor and ProdID

Do

cat /proc/bus/usb/devices

In the generated list where Manufacturer is ZTE , Incorporated

Take Vendor and ProdID

eg. Vendor=19d2 ProdID=fffd

-You can also use lsusb to get entry with ONDA Communication S.p.A in format   a:b

eg  19d2:fffd

2) Load Module
modprobe usbserial vendor=0x19d2 product=0xfffd

After this step 3 interfaces /dev/ttyUSB* where *(0-2)
should be created .(if not then rmmod usbserial ->remove device->modprobe again->insert device )

3)Configure (Run in root mode)(NOT FOR FEDORA go to 6)
wvdialconf

4)Edit /etc/wvdial.conf
Add number eg. #777
Add your username and password in the fields.

5)Run
Ideally running wvdial should be enough.
(try ping google.com to check if you are connected)

6)However in fedora(and if above steps dont work for you) after modprobe
Go to System>Administration>Network>New>Modem>
In Modem Properties (Despite error)
change device to /dev/ttyUSB0
Modem Volume=low
->Forward
Phone number #777
Username and Password -as you have
Provider Name -any
->Forward
Save And activate
Try ping google.com

Python 3.0 Basics

print(“Hello”) prints Hello , to know more about any command use help(<name>) so help(print) brings the command info.

-Unlike older versions python now classifies strings into data and text. All Text is Unicode  represented by type str and all data is encoded Unicode represented as binary data by byte. Both are immutable cannot be inter-converted as in older versions.

-A python script can be written by writing the code in a text file with extension .py Also in Linux / Unix based systems the first line can give the interpreter version
#!/usr/bin/env python        or #!/usr/bin/env python3.0
(If you have multiple versions of python its HIGHLY recommended to stick to 3.x versions)
-Python is strictly indentation based, so give same indentation at each level.

Eg.
i=0                     1
while i<5:              2
print (i)               3
i+=1                    4

So inside the file line 1 & 2 have same indentation while those inside while loop (line 3 &4) have
same indentation but different from outside level.
(To Be Continued ..)
For FAQS and More Info Visit http://docs.python.org/dev/3.0/ or http://docs.python.org/

Installing Python 3.0

1)For Windows
Go to http://python.org/download/    and download software depending on your OS’s architecture
2)Linux
a) First Search in your Package Manager for python 3.0 (it probably is installed) if not try to install from the repos else:
Go to http://python.org/download/ and download the bz package and extract it.
b) Open a terminal in root / superuser mode
cd <dir>
where <dir> is the path .
c) ./configure
d) make
e) make altinstall (this preserves current python version , else do make install)
If you get any dependency errors ,don’t be scared just try to find them using your package   manager or use google to find them.
For Old Python Users:
– Basic syntax had changed but you would get used to it.
– There’s a tool to convert old syntax scripts to new 2to3 .(unstable)

Windows users can add python to their environment variables
My Computer>Properties>(Advanced System Settings in vista)>Advanced
Go to Environment Variables >Scroll bottom scroll bar, select PATH and click edit
Add to the end ;<path where its installed>;
Now a script can be written anywhere and executed by

python <file-name> in dos
-Open DOS or terminal and enter python or python3.0 .Upon pressing enter an interactive shell
shall open with current python version and install date and time and OS type you are using.

Lost in Cyberspace