Mercurial > libervia-backend
comparison libervia/backend/plugins/plugin_misc_radiocol.py @ 4270:0d7bb4df2343
Reformatted code base using black.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 19 Jun 2024 18:44:57 +0200 |
parents | 4b842c1fb686 |
children |
comparison
equal
deleted
inserted
replaced
4269:64a85ce8be70 | 4270:0d7bb4df2343 |
---|---|
193 radio_data = self.games[ | 193 radio_data = self.games[ |
194 referee.userhostJID() | 194 referee.userhostJID() |
195 ] # FIXME: referee comes from Libervia's client side, it's unsecure | 195 ] # FIXME: referee comes from Libervia's client side, it's unsecure |
196 radio_data["to_delete"][ | 196 radio_data["to_delete"][ |
197 attrs["filename"] | 197 attrs["filename"] |
198 ] = ( | 198 ] = song_path # FIXME: works only because of the same host trick, see the note under the docstring |
199 song_path | |
200 ) # FIXME: works only because of the same host trick, see the note under the docstring | |
201 return self.send(referee, ("", "song_added"), attrs, profile=profile) | 199 return self.send(referee, ("", "song_added"), attrs, profile=profile) |
202 | 200 |
203 def play_next(self, room_jid, profile): | 201 def play_next(self, room_jid, profile): |
204 """"Play next song in queue if exists, and put a timer | 202 """ "Play next song in queue if exists, and put a timer |
205 which trigger after the song has been played to play next one""" | 203 which trigger after the song has been played to play next one""" |
206 # TODO: songs need to be erased once played or found invalids | 204 # TODO: songs need to be erased once played or found invalids |
207 # ==> unlink done the Q&D way with the same host trick (see above) | 205 # ==> unlink done the Q&D way with the same host trick (see above) |
208 radio_data = self.games[room_jid] | 206 radio_data = self.games[room_jid] |
209 if len(radio_data["players"]) == 0: | 207 if len(radio_data["players"]) == 0: |
243 """ | 241 """ |
244 if radio_data: | 242 if radio_data: |
245 try: | 243 try: |
246 file_to_delete = radio_data["to_delete"][filename] | 244 file_to_delete = radio_data["to_delete"][filename] |
247 except KeyError: | 245 except KeyError: |
248 log.error( | 246 log.error(_("INTERNAL ERROR: can't find full path of the song to delete")) |
249 _("INTERNAL ERROR: can't find full path of the song to delete") | |
250 ) | |
251 return False | 247 return False |
252 else: | 248 else: |
253 file_to_delete = filename | 249 file_to_delete = filename |
254 try: | 250 try: |
255 unlink(file_to_delete) | 251 unlink(file_to_delete) |