diff browser_side/radiocol.py @ 397:6148e9063069

browser_side: radiocol displays who uploaded the file with ChatPanel.printInfo
author souliane <souliane@mailoo.org>
date Tue, 11 Mar 2014 11:53:03 +0100
parents ee61b0765d6c
children 462fc3359ee3
line wrap: on
line diff
--- a/browser_side/radiocol.py	Tue Mar 11 10:45:52 2014 +0100
+++ b/browser_side/radiocol.py	Tue Mar 11 11:53:03 2014 +0100
@@ -217,6 +217,13 @@
 class RadioColPanel(HorizontalPanel, ClickHandler):
 
     def __init__(self, parent, referee, player_nick, players, queue_data):
+        """
+        @param parent
+        @param referee
+        @param player_nick
+        @param players
+        @param queue_data: list of integers (queue to start, queue limit)
+        """
         # We need to set it here and not in the CSS :(
         HorizontalPanel.__init__(self, Height="90px")
         ClickHandler.__init__(self)
@@ -240,13 +247,11 @@
             self.add(player)
         self.addClickListener(self)
 
-        help_msg = HTML("""Accepted file formats: Ogg Vorbis (recommended), MP3.<br />
+        help_msg = """Accepted file formats: Ogg Vorbis (recommended), MP3.<br />
         Please do not submit files that are protected by copyright.<br />
-        Click <a style="color: red;">here</a> if you need some support :)
-        """)
-        help_msg.setStyleName('chatTextInfo-link')
-        help_msg.addClickListener(lambda: self._parent.host.bridge.call('joinMUC', None, DEFAULT_MUC, self._parent.nick))
-        self._parent.content.add(help_msg)
+        Click <a style="color: red;">here</a> if you need some support :)"""
+        link_cb = lambda: self._parent.host.bridge.call('joinMUC', None, DEFAULT_MUC, self._parent.nick)
+        self._parent.printInfo(help_msg, type_='link', link_cb=link_cb)
 
     def pushNextSong(self, title):
         """Add a song to the left panel's next songs queue"""
@@ -273,7 +278,7 @@
                 return False
         return True
 
-    def radiocolPreload(self, timestamp, filename, title, artist, album):
+    def radiocolPreload(self, timestamp, filename, title, artist, album, sender):
         if not self.radiocolCheckPreload(timestamp):
             return  # song already preloaded
         preloaded = False
@@ -286,9 +291,10 @@
                 preloaded = True
                 break
         if not preloaded:
-            print("WARNING: Can't preload song, we are getting too many songs to preload, we shouldn't have more than 2 at once")
+            print(_("WARNING: Can't preload song, we are getting too many songs to preload, we shouldn't have more than %d at once") % self.queue_data[1])
         else:
             self.pushNextSong(title)
+            self._parent.printInfo(_('%(user)s uploaded %(artist)s - %(title)s') % {'user': sender, 'artist': artist, 'title': title})
 
     def radiocolPlay(self, filename):
         found = False