mirror of
https://github.com/markqvist/Sideband.git
synced 2026-10-26 19:01:47 -04:00
modernize
This commit is contained in:
parent
5e15c43ab7
commit
2a13ed0921
103 changed files with 822 additions and 906 deletions
|
|
@ -22,11 +22,11 @@ class BasicCommandPlugin(SidebandCommandPlugin):
|
|||
super().stop()
|
||||
|
||||
def handle_command(self, arguments, lxm):
|
||||
response_content = "Hello "+RNS.prettyhexrep(lxm.source_hash)+". "
|
||||
response_content = f"Hello {RNS.prettyhexrep(lxm.source_hash)}. "
|
||||
response_content += "This is a response from the basic command example. It doesn't do much, but here is a list of the arguments you included:\n"
|
||||
|
||||
for argument in arguments:
|
||||
response_content += "\n"+str(argument)
|
||||
response_content += f"\n{argument)}"
|
||||
|
||||
# Let the Sideband core send a reply.
|
||||
self.get_sideband().send_message(
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class ComicCommandPlugin(SidebandCommandPlugin):
|
|||
except Exception as e:
|
||||
# Send an error message
|
||||
self.get_sideband().send_message(
|
||||
"An error occurred while trying to fetch the specified comic:\n\n"+str(e),
|
||||
f"An error occurred while trying to fetch the specified comic:\n\n{e)}",
|
||||
lxm.source_hash,
|
||||
False, # Don't use propagation by default, try direct first
|
||||
skip_fields = True, # Don't include any additional fields automatically
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ class BasicServicePlugin(SidebandServicePlugin):
|
|||
def service_jobs(self):
|
||||
while self.should_run:
|
||||
time.sleep(5)
|
||||
RNS.log("Service ping from "+str(self))
|
||||
RNS.log(f"Service ping from {self)}")
|
||||
|
||||
RNS.log("Jobs stopped running for "+str(self))
|
||||
RNS.log(f"Jobs stopped running for {self)}")
|
||||
|
||||
def start(self):
|
||||
# Do any initialisation work here
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class CameraSource(ViewSource):
|
|||
self.frame_queue.put(frame)
|
||||
|
||||
except Exception as e:
|
||||
RNS.log("An error occurred while reading frames from the camera: "+str(e), RNS.LOG_ERROR)
|
||||
RNS.log(f"An error occurred while reading frames from the camera: {e)}", RNS.LOG_ERROR)
|
||||
|
||||
self.release_camera()
|
||||
|
||||
|
|
@ -195,10 +195,10 @@ class StreamSource(ViewSource):
|
|||
|
||||
self.frame_queue.put(frame)
|
||||
|
||||
RNS.log(str(self)+" idled", RNS.LOG_DEBUG)
|
||||
RNS.log(f"{self)} idled", RNS.LOG_DEBUG)
|
||||
|
||||
except Exception as e:
|
||||
RNS.log("An error occurred while reading frames from the stream: "+str(e), RNS.LOG_ERROR)
|
||||
RNS.log(f"An error occurred while reading frames from the stream: {e)}", RNS.LOG_ERROR)
|
||||
|
||||
self.release_stream()
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ class FileSource(ViewSource):
|
|||
self.source_data = image_file.read()
|
||||
|
||||
except Exception as e:
|
||||
RNS.log("Could not read image at \"{self.path}\": "+str(e), RNS.LOG_ERROR)
|
||||
RNS.log(f"Could not read image at \"{self.path}\": {e)}", RNS.LOG_ERROR)
|
||||
self.source_data = None
|
||||
|
||||
class ViewCommandPlugin(SidebandCommandPlugin):
|
||||
|
|
@ -292,7 +292,7 @@ class ViewCommandPlugin(SidebandCommandPlugin):
|
|||
else:
|
||||
response = "Available Sources:\n"
|
||||
for source in self.sources:
|
||||
response += "\n - "+str(source)
|
||||
response += f"\n - {source)}"
|
||||
|
||||
self.message_response(response, requestor)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue