Mercurial > libervia-backend
comparison src/plugins/plugin_misc_radiocol.py @ 718:074970227bc0
plugin tools: turn src/plugin/games.py into a plugin and move it to src/plugins/plugin_misc_room_game.py
author | souliane <souliane@mailoo.org> |
---|---|
date | Thu, 21 Nov 2013 18:23:08 +0100 |
parents | 358018c5c398 |
children | 539f278bc265 |
comparison
equal
deleted
inserted
replaced
717:358018c5c398 | 718:074970227bc0 |
---|---|
23 from twisted.words.protocols.jabber import jid | 23 from twisted.words.protocols.jabber import jid |
24 | 24 |
25 import os.path | 25 import os.path |
26 from os import unlink | 26 from os import unlink |
27 from mutagen.oggvorbis import OggVorbis, OggVorbisHeaderError | 27 from mutagen.oggvorbis import OggVorbis, OggVorbisHeaderError |
28 from sat.tools.plugins.games import RoomGame | |
29 | 28 |
30 | 29 |
31 NC_RADIOCOL = 'http://www.goffi.org/protocol/radiocol' | 30 NC_RADIOCOL = 'http://www.goffi.org/protocol/radiocol' |
32 RADIOC_TAG = 'radiocol' | 31 RADIOC_TAG = 'radiocol' |
33 | 32 |
34 PLUGIN_INFO = { | 33 PLUGIN_INFO = { |
35 "name": "Radio collective plugin", | 34 "name": "Radio collective plugin", |
36 "import_name": "Radiocol", | 35 "import_name": "Radiocol", |
37 "type": "Exp", | 36 "type": "Exp", |
38 "protocols": [], | 37 "protocols": [], |
39 "dependencies": ["XEP-0045", "XEP-0249"], | 38 "dependencies": ["XEP-0045", "XEP-0249", "ROOM-GAME"], |
40 "main": "Radiocol", | 39 "main": "Radiocol", |
41 "handler": "yes", | 40 "handler": "yes", |
42 "description": _("""Implementation of radio collective""") | 41 "description": _("""Implementation of radio collective""") |
43 } | 42 } |
44 | 43 |
45 QUEUE_LIMIT = 2 | 44 QUEUE_LIMIT = 2 |
46 | 45 |
47 | 46 |
48 class Radiocol(RoomGame): | 47 class Radiocol(object): |
48 | |
49 def inheritFromRoomGame(self, host): | |
50 global RoomGame | |
51 RoomGame = host.plugins["ROOM-GAME"].__class__ | |
52 self.__class__ = type(self.__class__.__name__, (self.__class__, RoomGame, object), {}) | |
49 | 53 |
50 def __init__(self, host): | 54 def __init__(self, host): |
51 info(_("Radio collective initialization")) | 55 info(_("Radio collective initialization")) |
52 RoomGame.__init__(self, host, PLUGIN_INFO, (NC_RADIOCOL, RADIOC_TAG), | 56 self.inheritFromRoomGame(host) |
57 RoomGame._init_(self, host, PLUGIN_INFO, (NC_RADIOCOL, RADIOC_TAG), | |
53 game_init={'queue': [], 'upload': True, 'playing': False, 'to_delete': {}}) | 58 game_init={'queue': [], 'upload': True, 'playing': False, 'to_delete': {}}) |
54 self.host = host | 59 self.host = host |
55 host.bridge.addMethod("radiocolLaunch", ".plugin", in_sign='asss', out_sign='', method=self.prepareRoom) | 60 host.bridge.addMethod("radiocolLaunch", ".plugin", in_sign='asss', out_sign='', method=self.prepareRoom) |
56 host.bridge.addMethod("radiocolCreate", ".plugin", in_sign='sass', out_sign='', method=self.createGame) | 61 host.bridge.addMethod("radiocolCreate", ".plugin", in_sign='sass', out_sign='', method=self.createGame) |
57 host.bridge.addMethod("radiocolSongAdded", ".plugin", in_sign='sss', out_sign='', method=self.radiocolSongAdded) | 62 host.bridge.addMethod("radiocolSongAdded", ".plugin", in_sign='sss', out_sign='', method=self.radiocolSongAdded) |