plugin radiocol: radiocolSongAdded now gets a JID as argument, add _radiocolSongAdded working with unicode for bridge calls

This commit is contained in:
souliane 2015-04-17 19:05:37 +02:00
commit d9a7804fb5

View file

@ -89,11 +89,14 @@ class Radiocol(object):
# 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 @@ class Radiocol(object):
'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