diff src/plugins/plugin_misc_radiocol.py @ 1411:8767c0bb7d48

plugin radiocol: radiocolSongAdded now gets a JID as argument, add _radiocolSongAdded working with unicode for bridge calls
author souliane <souliane@mailoo.org>
date Fri, 17 Apr 2015 19:05:37 +0200
parents 3265a2639182
children 94901070478e
line wrap: on
line diff
--- a/src/plugins/plugin_misc_radiocol.py	Thu Apr 16 17:17:28 2015 +0200
+++ b/src/plugins/plugin_misc_radiocol.py	Fri Apr 17 19:05:37 2015 +0200
@@ -89,11 +89,14 @@
         # XXX: the frontend should know the temporary directory where file is put
         return preload_elt
 
+    def _radiocolSongAdded(self, referee_s, song_path, profile):
+        return self.radiocolSongAdded(jid.JID(referee_s), song_path, profile)
+
     def radiocolSongAdded(self, referee, song_path, profile):
         """This method is called by libervia when a song has been uploaded
-        @param referee: JID of the referee in the room (room userhost + '/' + nick)
-        @song_path: absolute path of the song added
-        @param profile_key: %(doc_profile_key)s
+        @param referee (jid.JID): JID of the referee in the room (room userhost + '/' + nick)
+        @param song_path (unicode): absolute path of the song added
+        @param profile_key (unicode): %(doc_profile_key)s
         @return: a Deferred instance
         """
         # XXX: this is a Q&D way for the proof of concept. In the future, the song should
@@ -125,9 +128,9 @@
                  'album': song.get("album", ["Unknown"])[0],
                  'length': str(song.info.length)
                  }
-        radio_data = self.games[jid.JID(referee).userhostJID()]  # FIXME: referee comes from Libervia's client side, it's unsecure
+        radio_data = self.games[referee.userhostJID()]  # FIXME: referee comes from Libervia's client side, it's unsecure
         radio_data['to_delete'][attrs['filename']] = song_path  # FIXME: works only because of the same host trick, see the note under the docstring
-        return self.send(jid.JID(referee), ('', 'song_added'), attrs, profile=profile)
+        return self.send(referee, ('', 'song_added'), attrs, profile=profile)
 
     def playNext(self, room_jid, profile):
         """"Play next song in queue if exists, and put a timer