Skip to content

Commit 564861b

Browse files
committed
initial commit
1 parent e9cbb25 commit 564861b

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

expOpenCV.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#capture image on webcam with OpenCV
2+
import Image;
3+
import cv;
4+
import subprocess
5+
import ImageStat
6+
import time
7+
8+
capture = cv.CreateCameraCapture(0)
9+
cv.SetCaptureProperty(capture,cv.CV_CAP_PROP_FRAME_WIDTH, 128)
10+
cv.SetCaptureProperty(capture,cv.CV_CAP_PROP_FRAME_HEIGHT, 128);
11+
12+
if not capture:
13+
print "Error"
14+
sys.exit(1)
15+
while 1:
16+
frame = cv.QueryFrame(capture)
17+
cv.SaveImage("./cam.bmp",frame)
18+
image =Image.open("./cam.bmp").convert('L')
19+
stats = ImageStat.Stat(image)
20+
stats = stats.mean[0]
21+
22+
brightval = hex(int((255 - (stats*1.5))))
23+
currentval=subprocess.Popen("setpci -s 00:02.0 F4.B",shell=True,stdout=subprocess.PIPE).stdout.read()
24+
if abs(int(brightval,16) - int(currentval,16)) > 30:
25+
print int(brightval,16)
26+
command = "setpci -s 00:02.0 F4.B=" + str(brightval)
27+
subprocess.Popen(command,shell=True)
28+
else:
29+
time.sleep(5)

fetchLyrics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def parseLyrics(data):
6767
run=False
6868
inp = str(raw_input("\bSave lyrics(y/n)?"))
6969
if inp=='y' or inp=='Y':
70-
inp+=a2[len('Title: '):len(a2)]+".lyric'"
70+
inp+=a2[len('Title: ')+1:len(a2)]+".lyric"
7171
try:
7272
file_w=open(inp,'a')
7373
file_w.write(op+'\n'+lyric)

setBrightness.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import dbus
2+
bus = dbus.SessionBus()
3+
4+
proxy = bus.get_object('org.gnome.SettingsDaemon',
5+
'/org/gnome/SettingsDaemon/Power')
6+
7+
iface=dbus.Interface(proxy,dbus_interface='org.gnome.SettingsDaemon.Power.Screen')
8+
9+
iface.SetPercentage(30)

0 commit comments

Comments
 (0)