Skip to content

Commit

Permalink
Fix invalid string escapes (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
notpeelz authored Apr 29, 2024
1 parent 887131e commit 64ea98a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions syncplay/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def getValueForOS(constantDict):
# Usually there's no need to adjust these
DOUBLE_CHECK_REWIND = False
LAST_PAUSED_DIFF_THRESHOLD = 2
FILENAME_STRIP_REGEX = "[-~_\.\[\](): ]"
CONTROL_PASSWORD_STRIP_REGEX = "[^a-zA-Z0-9\-]"
ROOM_NAME_STRIP_REGEX = "^(\+)(?P<roomnamebase>.*)(:)(\w{12})$"
FILENAME_STRIP_REGEX = r"[-~_\.\[\](): ]"
CONTROL_PASSWORD_STRIP_REGEX = r"[^a-zA-Z0-9\-]"
ROOM_NAME_STRIP_REGEX = r"^(\+)(?P<roomnamebase>.*)(:)(\w{12})$"
ARGUMENT_SPLIT_REGEX = r'(?:[^\s"]+|"[^"]*")+'
COMMANDS_UNDO = ["u", "undo", "revert"]
COMMANDS_CHAT = ["ch", "chat"]
Expand Down Expand Up @@ -163,7 +163,7 @@ def getValueForOS(constantDict):
]

MPC_EXECUTABLES = ["mpc-hc.exe", "mpc-hc64.exe", "mpc-hcportable.exe", "mpc-hc_nvo.exe", "mpc-hc64_nvo.exe", "shoukaku.exe"]
MPC64_EXECUTABLES = ["mpc-hc64.exe", "mpc-hc64_nvo.exe", "x64\mpc-hc\shoukaku.exe"]
MPC64_EXECUTABLES = ["mpc-hc64.exe", "mpc-hc64_nvo.exe", r"x64\mpc-hc\shoukaku.exe"]

MPC_BE_PATHS = [
r"c:\program files\mpc-be x64\mpc-be64.exe",
Expand Down Expand Up @@ -302,7 +302,7 @@ def getValueForOS(constantDict):
OS_MACOS: ['--verbose=2', '--no-file-logging']})
MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["set_property time-pos ", "loadfile "]
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
MPLAYER_ANSWER_REGEX = r"^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
VLC_ANSWER_REGEX = r"(?:^(?P<command>[a-zA-Z_-]+)(?:\: )?(?P<argument>.*))"
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,9}(?:[^\d\.](?:\d{1,9})){0,2}(?:\.(?:\d{1,3}))?)$"
Expand Down
6 changes: 3 additions & 3 deletions syncplay/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def stripfilename(filename, stripURL):
def stripRoomName(RoomName):
if RoomName:
try:
return re.sub(constants.ROOM_NAME_STRIP_REGEX, "\g<roomnamebase>", RoomName)
return re.sub(constants.ROOM_NAME_STRIP_REGEX, r"\g<roomnamebase>", RoomName)
except IndexError:
return RoomName
else:
Expand Down Expand Up @@ -505,8 +505,8 @@ def getListOfPublicServers():


class RoomPasswordProvider(object):
CONTROLLED_ROOM_REGEX = re.compile("^\+(.*):(\w{12})$")
PASSWORD_REGEX = re.compile("[A-Z]{2}-\d{3}-\d{3}")
CONTROLLED_ROOM_REGEX = re.compile(r"^\+(.*):(\w{12})$")
PASSWORD_REGEX = re.compile(r"[A-Z]{2}-\d{3}-\d{3}")

@staticmethod
def isControlledRoom(roomName):
Expand Down

0 comments on commit 64ea98a

Please sign in to comment.