Remove trailing whitespaces.
This commit is contained in:
parent
310e2cc347
commit
27b3592e16
1 changed files with 899 additions and 899 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
SAT plugin for managing Radiocol
|
||||
SAT plugin for managing Radiocol
|
||||
Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi@goffi.org)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -80,7 +80,7 @@ class Radiocol():
|
|||
elt["type"] = type
|
||||
elt.addElement((NC_RADIOCOL, RADIOC_TAG))
|
||||
return elt
|
||||
|
||||
|
||||
def __create_started_elt(self):
|
||||
"""Create a game_started domish element"""
|
||||
started_elt = domish.Element((None,'started'))
|
||||
|
|
@ -122,14 +122,14 @@ class Radiocol():
|
|||
self.radiocolCreate(_room_jid.userhost(), profile_key=profile)
|
||||
for occupant in occupants:
|
||||
self.host.plugins["XEP-0249"].invite(jid.JID(occupant), room.occupantJID.userhostJID(), {"game":"Radiocol"}, profile)
|
||||
|
||||
|
||||
def after_init(ignore):
|
||||
room_name = "sat_radiocol_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
|
||||
print "\n\n===> room_name:", room_name
|
||||
muc_service = None
|
||||
for service in self.host.memory.getServerServiceEntities("conference", "text", profile):
|
||||
if not ".irc." in service.userhost():
|
||||
#FIXME:
|
||||
#FIXME:
|
||||
#This awfull ugly hack is here to avoid an issue with openfire: the irc gateway
|
||||
#use "conference/text" identity (instead of "conference/irc"), there is certainly a better way
|
||||
#to manage this, but this hack fill do it for test purpose
|
||||
|
|
@ -138,7 +138,7 @@ class Radiocol():
|
|||
if not muc_service:
|
||||
error(_("Can't find a MUC service"))
|
||||
return
|
||||
|
||||
|
||||
_jid, xmlstream = self.host.getJidNStream(profile)
|
||||
d = self.host.plugins["XEP-0045"].join(jid.JID("%s@%s" % (room_name, muc_service.userhost())), _jid.user, {}, profile)
|
||||
d.addCallback(radiocolRoomJoined)
|
||||
|
|
@ -184,7 +184,7 @@ class Radiocol():
|
|||
client = self.host.getClient(profile)
|
||||
if not client:
|
||||
error(_("Can't access profile's data"))
|
||||
return
|
||||
return
|
||||
try:
|
||||
song = OggVorbis(song_path)
|
||||
except OggVorbisHeaderError:
|
||||
|
|
@ -213,7 +213,7 @@ class Radiocol():
|
|||
self.host.profiles[profile].xmlstream.send(mess)
|
||||
|
||||
radio_data = self.radios[jid.JID(referee).userhost()] #FIXME: referee comes from Libervia's client side, it's unsecure
|
||||
radio_data['to_delete'][filename] = song_path #FIXME: works only because of the same host trick, see the note under the docstring
|
||||
radio_data['to_delete'][filename] = song_path #FIXME: works only because of the same host trick, see the note under the docstring
|
||||
|
||||
def playNext(self, room_jid, profile):
|
||||
""""Play next sont in queue if exists, and put a timer
|
||||
|
|
@ -248,22 +248,22 @@ class Radiocol():
|
|||
except KeyError:
|
||||
error(_("INTERNAL ERROR: can't find full path of the song to delete"))
|
||||
return
|
||||
|
||||
#we wait more than the song length to delete the file, to manage poorly reactive networks/clients
|
||||
|
||||
#we wait more than the song length to delete the file, to manage poorly reactive networks/clients
|
||||
reactor.callLater(length + 90, unlink, file_to_delete) #FIXME: same host trick (see above)
|
||||
|
||||
|
||||
def radiocol_game_cmd(self, mess_elt, profile):
|
||||
#FIXME: we should check sender (is it referee ?) here before accepting commands
|
||||
from_jid = jid.JID(mess_elt['from'])
|
||||
from_jid = jid.JID(mess_elt['from'])
|
||||
room_jid = jid.JID(from_jid.userhost())
|
||||
radio_elt = mess_elt.firstChildElement()
|
||||
radio_data = self.radios[room_jid.userhost()]
|
||||
occupants_data = radio_data['occupants_data']
|
||||
queue = radio_data['queue']
|
||||
|
||||
|
||||
for elt in radio_elt.elements():
|
||||
|
||||
|
||||
if elt.name == 'started': #new game created
|
||||
self.host.bridge.radiocolStarted(room_jid.userhost(), from_jid.full(), profile)
|
||||
elif elt.name == 'preload': #a song is in queue and must be preloaded
|
||||
|
|
@ -279,7 +279,7 @@ class Radiocol():
|
|||
elif elt.name == 'song_added': #a song has been added
|
||||
#FIXME: we are KISS for the proof of concept: every song is added, to a limit of 3 in queue.
|
||||
# Need to manage some sort of rules to allow peoples to send songs
|
||||
|
||||
|
||||
if len(queue) >= QUEUE_LIMIT:
|
||||
#there are already too many songs in queue, we reject this one
|
||||
mess = self.createRadiocolElt(room_jid)
|
||||
|
|
@ -289,7 +289,7 @@ class Radiocol():
|
|||
#FIXME: add an error code
|
||||
self.host.profiles[profile].xmlstream.send(mess)
|
||||
return
|
||||
|
||||
|
||||
#The song is accepted and added in queue
|
||||
queue.append((elt['filename'], float(elt['length'])))
|
||||
|
||||
|
|
@ -317,13 +317,13 @@ class Radiocol():
|
|||
self.playNext(room_jid, profile)
|
||||
else:
|
||||
error (_('Unmanaged game element: %s') % elt.name)
|
||||
|
||||
|
||||
def getHandler(self, profile):
|
||||
return RadiocolHandler(self)
|
||||
|
||||
class RadiocolHandler (XMPPHandler):
|
||||
implements(iwokkel.IDisco)
|
||||
|
||||
|
||||
def __init__(self, plugin_parent):
|
||||
self.plugin_parent = plugin_parent
|
||||
self.host = plugin_parent.host
|
||||
|
|
|
|||
Loading…
Reference in a new issue