The MSG_ID_SET_SONGNAME message now handles streams.
authorTilman Sauerbeck <tilman@code-monkey.de>
Sat, 7 Oct 2006 19:15:11 +0000 (21:15 +0200)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sat, 7 Oct 2006 19:15:11 +0000 (21:15 +0200)
If the argument to MSG_ID_SET_SONGNAME is a single string, treat
it as the song name (or stream channel name).

bin/euphoria
data/themes/iio/iio.edc
data/themes/winter/groups/euphoria.edc
lib/playlist_item.rb

index 707d9e0b806d7c4e3bb1d327825facd81f20f943..5726f6d8b5d6d7620aa9f5bfa2faee128d91a104 100644 (file)
@@ -326,12 +326,7 @@ private
 
        def ui_fill_track_info(item)
                unless item.nil?
-                       if item.channel.nil?
-                               msg = Edje::Message.new(0, item.artist, item.title, item.album)
-                       else
-                               msg = Edje::Message.new(0, "", item.title, "")
-                       end
-                       @edje.send_message(msg)
+                       @edje.send_message(item.track_info_message)
                end
        end
 
index 31862cd6f94d81902e87b30ea251ead5d24be98e..9e46f7c3dc0ca9cf66dbb159f3d829a953ea2107 100644 (file)
                {
                        switch (id) {
                                case MSG_ID_SET_SONGNAME: {
-                                       new buf[128];
+                                       new buf[128], args_left;
 
-                                       if (type != MSG_STRING_SET || numargs () < 5)
-                                               return;
+                                       args_left = numargs () - 2;
 
-                                       getsarg (2, buf, 128);
-                                       set_text (PART:"artist_name", buf);
+                                       /* if the one argument is a string, the current song
+                                        * is a stream, and the argument is the stream's name
+                                        * (channel name).
+                                        */
+                                       if (type == MSG_STRING && args_left == 1) {
+                                               getsarg (2, buf, 128);
+                                               set_text (PART:"artist_name", buf);
 
-                                       getsarg (3, buf, 128);
-                                       set_text (PART:"song_name", buf);
+                                               set_text (PART:"song_name", "");
+                                               set_text (PART:"album_name", "");
+                                       } else if (type == MSG_STRING_SET && args_left > 1) {
+                                               getsarg (2, buf, 128);
+                                               set_text (PART:"artist_name", buf);
 
-                                       getsarg (4, buf, 128);
-                                       set_text (PART:"album_name", buf);
+                                               getsarg (3, buf, 128);
+                                               set_text (PART:"song_name", buf);
+
+                                               getsarg (4, buf, 128);
+                                               set_text (PART:"album_name", buf);
+                                       }
                                }
                        }
                }
index 3a03583daebe0f1e75ca979b17ef9a70aa184c51..776562c165cf0c51241b910dc1006f5918ac1655 100644 (file)
                {
                        switch (id) {
                                case MSG_ID_SET_SONGNAME: {
-                                       new buf[128];
+                                       new buf[128], args_left;
 
-                                       if (type != MSG_STRING_SET || numargs () < 5)
-                                               return;
+                                       args_left = numargs () - 2;
 
-                                       getsarg (2, buf, 128);
-                                       set_text (PART:"artist_name", buf);
+                                       /* if the one argument is a string, the current song
+                                        * is a stream, and the argument is the stream's name
+                                        * (channel name).
+                                        */
+                                       if (type == MSG_STRING && args_left == 1) {
+                                               getsarg (2, buf, 128);
+                                               set_text (PART:"artist_name", buf);
 
-                                       getsarg (3, buf, 128);
-                                       set_text (PART:"song_name", buf);
+                                               set_text (PART:"song_name", "");
+                                               set_text (PART:"album_name", "");
+                                       } else if (type == MSG_STRING_SET && args_left > 1) {
+                                               getsarg (2, buf, 128);
+                                               set_text (PART:"artist_name", buf);
 
-                                       getsarg (4, buf, 128);
-                                       set_text (PART:"album_name", buf);
+                                               getsarg (3, buf, 128);
+                                               set_text (PART:"song_name", buf);
+
+                                               getsarg (4, buf, 128);
+                                               set_text (PART:"album_name", buf);
+                                       }
                                }
                        }
                }
index f3d397f0de97b62e9ba86dc09891ecddfe2186d5..a4ed9896a8efe9bcdb6ee149676be7bfcc4f6bda 100644 (file)
@@ -116,6 +116,14 @@ class PlaylistItem
                set_parts_text unless @edje.nil?
        end
 
+       def track_info_message
+               unless @props[:channel].nil?
+                       Edje::Message.new(0, channel)
+               else
+                       Edje::Message.new(0, artist, title, album)
+               end
+       end
+
        private
        def set_parts_text
                tmp = (duration == -1) ? "" :