diff --git a/epydial/audio_screen.py b/epydial/audio_screen.py index 33edb45..4a9ace8 100644 --- a/epydial/audio_screen.py +++ b/epydial/audio_screen.py @@ -16,11 +16,13 @@ from httplib import HTTPConnection from urllib import urlencode from urlparse import urlparse, urlunparse from xml.dom.minidom import parseString -from pyneo.dns_support import DNSCache #require: export PYTHONPATH=/usr/share/pyneod +from pyneo.dns_support import DNSCache #require: 'export PYTHONPATH=/usr/share/pyneod' class AudioScreen(EdjeGroup): toggle = 0 volume = 0.1 + position_timer = None + e_timer = None def __init__(self, screen_manager): EdjeGroup.__init__(self, screen_manager, AUDIO_SCREEN_NAME) @@ -72,7 +74,12 @@ class AudioScreen(EdjeGroup): def register_pyneo_callbacks(self): PyneoController.register_callback("on_get_mp3_tags", self.on_get_mp3_tags) PyneoController.register_callback("on_get_song_duration", self.on_get_song_duration) -# PyneoController.register_callback("on_get_song_position", self.on_get_song_position) + PyneoController.register_callback("on_get_song_position", self.on_get_song_position) + + def on_get_song_position(self, status): + self.position_timer = status = time.time() + self.e_timer = ecore.timer_add(1.0, self.display_position) + self.display_position() def on_get_song_duration(self, status): self.part_text_set("duration", "%s" % time.ctime(status)[14:][:5]) @@ -80,6 +87,7 @@ class AudioScreen(EdjeGroup): def on_get_mp3_tags(self, status): PyneoController.get_song_duration() + PyneoController.get_song_position() try: self.image.delete() except: @@ -108,6 +116,11 @@ class AudioScreen(EdjeGroup): self.obj.size = x, y self.obj.show() + def display_position(self): + elapsed = (time.time() - self.position_timer) + self.part_text_set("position", "%s" % (time.ctime(elapsed)[14:][:5])) + return True + @edje.decorators.signal_callback("music_player_send", "*") def on_edje_signal_audio_screen_triggered(self, emission, source): if source == "headline": @@ -117,12 +130,14 @@ class AudioScreen(EdjeGroup): if self.toggle == 0: self.signal_emit("key1", "") PyneoController.play_music() + PyneoController.get_mp3_tags() self.toggle = 1 elif self.toggle == 1: + print '--- timer stoppen' + self.e_timer.delete() self.signal_emit("key2", "") PyneoController.pause_music() self.toggle = 0 - PyneoController.get_mp3_tags() if source == "stop": self.signal_emit("key2", "") self.toggle = 0 diff --git a/epydial/data/db/epydial.sqlite b/epydial/data/db/epydial.sqlite index bf40f16..a1fa9df 100755 Binary files a/epydial/data/db/epydial.sqlite and b/epydial/data/db/epydial.sqlite differ diff --git a/epydial/data/sounds/ring-ring.mp3 b/epydial/data/sounds/ring-ring.mp3 new file mode 100644 index 0000000..f2b0c92 Binary files /dev/null and b/epydial/data/sounds/ring-ring.mp3 differ diff --git a/epydial/data/themes/blackwhite/audio_screen.edc b/epydial/data/themes/blackwhite/audio_screen.edc index 22fbeb2..8eeef84 100755 --- a/epydial/data/themes/blackwhite/audio_screen.edc +++ b/epydial/data/themes/blackwhite/audio_screen.edc @@ -305,6 +305,22 @@ collections { } } } + part { + name: "position"; + type: TEXT; + mouse_events: 0; + description { + state: "default" 0; + color_class: "button_inactive"; + rel1 { relative: 0 3/8; } + rel2 { relative: 2/8 4/8; } + text { + size: 20; + font: "VeraBd"; + fit: 1 1; + } + } + } key("track_left", 0, 2) key("stop", 1, 2) key_play_pause("play_pause", "play", "pause", 2, 2) diff --git a/epydial/epydial.py b/epydial/epydial.py index 070dd20..a1ebe62 100755 --- a/epydial/epydial.py +++ b/epydial/epydial.py @@ -556,11 +556,11 @@ class PyneoController(object): @classmethod def get_song_duration(class_): - class_.notify_callbacks("on_get_song_duration", class_.mp3.GetSongDuration(dbus_interface='org.pyneo.Music')) + class_.notify_callbacks('on_get_song_duration', class_.mp3.GetSongDuration(dbus_interface='org.pyneo.Music')) @classmethod def get_song_position(class_): - class_mp3.GetSongPosition(dbus_interface='org.pyneo,Music') + class_.notify_callbacks('on_get_song_position', class_.mp3.GetSongPosition(dbus_interface='org.pyneo.Music')) @classmethod def db_check(class_): diff --git a/epydial/incall_screen.py b/epydial/incall_screen.py index 92f1330..6c554b2 100644 --- a/epydial/incall_screen.py +++ b/epydial/incall_screen.py @@ -18,7 +18,7 @@ class InCallScreen(EdjeGroup): connection = connect(DB_FILE_PATH) cursor = connection.cursor() try: - cursor.execute("SELECT * FROM contacts WHERE mobil LIKE '%" + str(number) + "' OR home LIKE '%" + str(number) + "' OR work LIKE '%" + str(number) + "'") + cursor.execute("SELECT * FROM contacts WHERE mobil LIKE %s OR home LIKE %s OR work LIKE %s" % (number, number, number)) for row in cursor: CallerNamemap = row[0], row[1], row[2], row[3], row[4] @@ -27,9 +27,9 @@ class InCallScreen(EdjeGroup): elif CallerNamemap[4] == str(number): source = 'work' if CallerNamemap[1] and CallerNamemap[0]: - self.part_text_set("incall_number_text", "%s: %s"% (source, CallerNamemap[1] + ', ' + CallerNamemap[0])) + self.part_text_set("incall_number_text", "%s: %s, %s" % (source, CallerNamemap[1], CallerNamemap[0])) except: - self.part_text_set("incall_number_text", "unknown") + self.part_text_set("incall_number_text", "??? %s ???" % number) @edje.decorators.signal_callback("dialer_incall_send", "*") def on_edje_signal_dialer_incall_triggered(self, emission, source):