add song duration
git-svn-id: http://www.neo1973-germany.de/svn@235 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
dc6ada12da
commit
e0366591f3
3 changed files with 37 additions and 7 deletions
|
@ -20,7 +20,7 @@ from pyneo.dns_support import DNSCache #require: export PYTHONPATH=/usr/share/py
|
||||||
|
|
||||||
class AudioScreen(EdjeGroup):
|
class AudioScreen(EdjeGroup):
|
||||||
toggle = 0
|
toggle = 0
|
||||||
volume = 0.9
|
volume = 0.1
|
||||||
|
|
||||||
def __init__(self, screen_manager):
|
def __init__(self, screen_manager):
|
||||||
EdjeGroup.__init__(self, screen_manager, AUDIO_SCREEN_NAME)
|
EdjeGroup.__init__(self, screen_manager, AUDIO_SCREEN_NAME)
|
||||||
|
@ -71,8 +71,15 @@ class AudioScreen(EdjeGroup):
|
||||||
|
|
||||||
def register_pyneo_callbacks(self):
|
def register_pyneo_callbacks(self):
|
||||||
PyneoController.register_callback("on_get_mp3_tags", self.on_get_mp3_tags)
|
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)
|
||||||
|
|
||||||
|
def on_get_song_duration(self, status):
|
||||||
|
self.part_text_set("duration", "%s" % time.ctime(status)[14:][:5])
|
||||||
|
print '--- current song length: ', status
|
||||||
|
|
||||||
def on_get_mp3_tags(self, status):
|
def on_get_mp3_tags(self, status):
|
||||||
|
PyneoController.get_song_duration()
|
||||||
try:
|
try:
|
||||||
self.image.delete()
|
self.image.delete()
|
||||||
except:
|
except:
|
||||||
|
@ -80,12 +87,10 @@ class AudioScreen(EdjeGroup):
|
||||||
|
|
||||||
self.part_text_set("mp3_tags", "artist: %s<br>album: %s<br>title: %s" % (status['artist'], status['album'], status['title']))
|
self.part_text_set("mp3_tags", "artist: %s<br>album: %s<br>title: %s" % (status['artist'], status['album'], status['title']))
|
||||||
if not os.path.isfile(COVER_FILE_PATH + '%s_%s.jpeg' % (status['artist'], status['album'])):
|
if not os.path.isfile(COVER_FILE_PATH + '%s_%s.jpeg' % (status['artist'], status['album'])):
|
||||||
try:
|
print '--- cover not exists'
|
||||||
content = self.get_amazon_cover(status['artist'], status['album'])
|
content = self.get_amazon_cover(status['artist'], status['album'])
|
||||||
with open(COVER_FILE_PATH + '%s_%s.jpeg' % (status['artist'], status['album']), 'w') as f:
|
with open(COVER_FILE_PATH + '%s_%s.jpeg' % (status['artist'], status['album']), 'w') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
except:
|
|
||||||
pass # display a dummy cover
|
|
||||||
|
|
||||||
self.image = self.evas.Image(file=COVER_FILE_PATH + '%s_%s.jpeg' % (status['artist'], status['album']))
|
self.image = self.evas.Image(file=COVER_FILE_PATH + '%s_%s.jpeg' % (status['artist'], status['album']))
|
||||||
x, y = self.image.image_size
|
x, y = self.image.image_size
|
||||||
|
|
|
@ -289,6 +289,22 @@ collections {
|
||||||
rel2 { relative: 1/2 1/2; offset: 80 80; }
|
rel2 { relative: 1/2 1/2; offset: 80 80; }
|
||||||
}
|
}
|
||||||
} /*end icon swallow */
|
} /*end icon swallow */
|
||||||
|
part {
|
||||||
|
name: "duration";
|
||||||
|
type: TEXT;
|
||||||
|
mouse_events: 0;
|
||||||
|
description {
|
||||||
|
state: "default" 0;
|
||||||
|
color_class: "button_inactive";
|
||||||
|
rel1 { relative: 6/8 3/8; }
|
||||||
|
rel2 { relative: 1 4/8; }
|
||||||
|
text {
|
||||||
|
size: 20;
|
||||||
|
font: "VeraBd";
|
||||||
|
fit: 1 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
key("track_left", 0, 2)
|
key("track_left", 0, 2)
|
||||||
key("stop", 1, 2)
|
key("stop", 1, 2)
|
||||||
key_play_pause("play_pause", "play", "pause", 2, 2)
|
key_play_pause("play_pause", "play", "pause", 2, 2)
|
||||||
|
|
|
@ -554,6 +554,14 @@ class PyneoController(object):
|
||||||
def stop_ringtone(class_):
|
def stop_ringtone(class_):
|
||||||
class_.mp3.StopRingtone(dbus_interface='org.pyneo.Music')
|
class_.mp3.StopRingtone(dbus_interface='org.pyneo.Music')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_song_duration(class_):
|
||||||
|
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')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def db_check(class_):
|
def db_check(class_):
|
||||||
if not os.path.exists(DB_FILE_PATH):
|
if not os.path.exists(DB_FILE_PATH):
|
||||||
|
@ -601,6 +609,7 @@ class Dialer(object):
|
||||||
PyneoController.register_callback("show_sms_screen_detail", self.on_sms_screen_detail)
|
PyneoController.register_callback("show_sms_screen_detail", self.on_sms_screen_detail)
|
||||||
PyneoController.register_callback("show_weather_screen", self.on_weather_screen)
|
PyneoController.register_callback("show_weather_screen", self.on_weather_screen)
|
||||||
PyneoController.register_callback("show_audio_screen", self.on_audio_screen)
|
PyneoController.register_callback("show_audio_screen", self.on_audio_screen)
|
||||||
|
# PyneoController.register_callback("on_get_song_duration", self.on_get_song_duration)
|
||||||
|
|
||||||
# Initialize the D-Bus interface to pyneo
|
# Initialize the D-Bus interface to pyneo
|
||||||
dbus_ml = e_dbus.DBusEcoreMainLoop()
|
dbus_ml = e_dbus.DBusEcoreMainLoop()
|
||||||
|
|
Loading…
Reference in a new issue