remove startup sound, nervt
git-svn-id: http://www.neo1973-germany.de/svn@232 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
32b2999fac
commit
1298e8817c
2 changed files with 38 additions and 19 deletions
|
@ -5,7 +5,12 @@ __version__ = "prototype"
|
|||
__copyright__ = "Copyright (c) 2008"
|
||||
__license__ = "GPL3"
|
||||
|
||||
LICENSE_KEY = "18C3VZN9HCECM5G3HQG2"
|
||||
ASSOCIATE = "webservices-20"
|
||||
|
||||
from epydial import *
|
||||
import urllib
|
||||
from xml.dom import minidom
|
||||
|
||||
class AudioScreen(EdjeGroup):
|
||||
toggle = 0
|
||||
|
@ -21,6 +26,28 @@ class AudioScreen(EdjeGroup):
|
|||
|
||||
def on_get_mp3_tags(self, status):
|
||||
self.part_text_set("mp3_tags", "artist: %s<br>album: %s<br>title: %s" % (status['artist'], status['album'], status['title']))
|
||||
print 'cover url: ', self.get_amazon_cover(status['artist'] + " "+ status['album'])
|
||||
|
||||
def getText(self, nodelist):
|
||||
rc = ""
|
||||
for node in nodelist:
|
||||
if node.nodeType == node.TEXT_NODE:
|
||||
rc = rc + node.data
|
||||
return rc
|
||||
|
||||
def get_amazon_cover(self, album):
|
||||
AMAZON_URL = "http://ecs.amazonaws.de/onca/xml"\
|
||||
"?Service=AWSECommerceService"\
|
||||
"&AWSAccessKeyId=" + LICENSE_KEY +\
|
||||
"&AssociateTag=" + ASSOCIATE +\
|
||||
"&ResponseGroup=Images,ItemAttributes"\
|
||||
"&Operation=ItemSearch"\
|
||||
"&ItemSearch.Shared.SearchIndex=Music"\
|
||||
"&ItemSearch.1.Keywords=%s"
|
||||
|
||||
url = AMAZON_URL % (album)
|
||||
dom = minidom.parse(urllib.urlopen(url))
|
||||
return self.getText(dom.getElementsByTagName("URL")[1].childNodes)
|
||||
|
||||
@edje.decorators.signal_callback("music_player_send", "*")
|
||||
def on_edje_signal_audio_screen_triggered(self, emission, source):
|
||||
|
|
|
@ -457,39 +457,34 @@ class PyneoController(object):
|
|||
class_.notify_callbacks("on_get_mp3_tags", newmap)
|
||||
|
||||
@classmethod
|
||||
def check_new_sms(class_, newmap,):
|
||||
def InsertSms(status, from_msisdn, time, text):
|
||||
connection = connect(DB_FILE_PATH)
|
||||
cursor = connection.cursor()
|
||||
cursor.execute('INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES (?, ?, ?, ?)', (status, from_msisdn, time, text,))
|
||||
connection.commit()
|
||||
def insert_new_sms(class_, status, from_msisdn, time, text):
|
||||
connection = connect(DB_FILE_PATH)
|
||||
cursor = connection.cursor()
|
||||
cursor.execute('INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES (?, ?, ?, ?)', (status, from_msisdn, time, text,))
|
||||
connection.commit()
|
||||
|
||||
@classmethod
|
||||
def check_new_sms(class_, newmap,):
|
||||
res = dedbusmap(newmap)
|
||||
for n in res:
|
||||
sm = object_by_url(n)
|
||||
content = dedbusmap(sm.GetContent(dbus_interface=DIN_ENTRY))
|
||||
InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8'))
|
||||
PyneoController.insert_new_sms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8'))
|
||||
print '--- NEW SMS:', content['from_msisdn'], content['time'], content['text'].encode('utf-8')
|
||||
class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE)
|
||||
|
||||
@classmethod
|
||||
def first_check_new_sms(class_):
|
||||
def InsertSms(status, from_msisdn, time, text):
|
||||
connection = connect(DB_FILE_PATH)
|
||||
cursor = connection.cursor()
|
||||
cursor.execute('INSERT INTO sms (status, from_msisdn, time, sms_text) VALUES (?, ?, ?, ?)', (status, from_msisdn, time, text,))
|
||||
connection.commit()
|
||||
|
||||
try:
|
||||
res = class_.gsm_sms.ListAll(dbus_interface=DIN_STORAGE)
|
||||
for n in res:
|
||||
sm = object_by_url(n)
|
||||
content = dedbusmap(sm.GetContent(dbus_interface=DIN_ENTRY))
|
||||
InsertSms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8'))
|
||||
PyneoController.insert_new_sms('REC UNREAD', content['from_msisdn'], content['time'], content['text'].encode('utf-8'))
|
||||
except:
|
||||
print '--- NULL new sms'
|
||||
class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE)
|
||||
PyneoController.stop_ringtone()
|
||||
PyneoController.stop_ringtone() #TODO: not the optimal break for the startup sound ;)
|
||||
|
||||
@classmethod
|
||||
def show_sms_screen(class_):
|
||||
|
@ -563,9 +558,8 @@ class PyneoController(object):
|
|||
def db_check(class_):
|
||||
if not os.path.exists(DB_FILE_PATH):
|
||||
os.mkdir(DB_PATH)
|
||||
print '--- Add db path: ', DB_PATH
|
||||
os.system('cp %s %s' % ('./data/db/epydial.sqlite', DB_PATH))
|
||||
print '--- Add sqlite'
|
||||
print '--- Add db path and a empty sqlite db'
|
||||
|
||||
from dialer_screen import *
|
||||
from incall_screen import *
|
||||
|
@ -621,8 +615,6 @@ class Dialer(object):
|
|||
|
||||
PyneoController.db_check()
|
||||
PyneoController.set_playlist_from_dir()
|
||||
PyneoController.set_ringtone(RINGTONE_FILE)
|
||||
PyneoController.play_ringtone()
|
||||
PyneoController.power_up_gsm()
|
||||
PyneoController.get_gsm_keyring()
|
||||
|
||||
|
|
Loading…
Reference in a new issue