Bladeren bron

some playserver changes

A 4 jaren geleden
bovenliggende
commit
89c8d51f2f
1 gewijzigde bestanden met toevoegingen van 10 en 4 verwijderingen
  1. 10 4
      src/playserver.py

+ 10 - 4
src/playserver.py

@@ -94,12 +94,14 @@ class __PlayServer__(object):
             if not request:
                 return False
 
-            matches = re.search(r"^([^\s]+) /([^/]+)(?:/([^/]+))?/[^\s]* HTTP", request, re.IGNORECASE | re.MULTILINE)
+            matches = re.search(r"^([^\s]+) /(.*(?=/))/[^\s]* HTTP", request, re.IGNORECASE | re.MULTILINE)
             if matches:
+                method = matches.group(1)
+                params = matches.group(2).split("/")
                 output("[SERVER-" + str(self._port) + "] Request: %s" % str([matches.group(i + 1) for i in xrange(len(matches.groups()))]))
 
                 method = matches.group(1)
-                command = matches.group(2)
+                command = params[0]
 
                 if method == "HEAD":
                     if command == "play":
@@ -117,7 +119,7 @@ class __PlayServer__(object):
                         read_settings()
                         check_settings()
 
-                        episode_id = matches.group(3)
+                        episode_id = params[1]
 
                         self.__play_end__(self._episode_id)
 
@@ -134,10 +136,11 @@ class __PlayServer__(object):
                         except Exception as e:
                             self._running = False
                             output("[SERVER-" + str(self._port) + "] Client Play Error: %s" % traceback.format_exc())
-                            __client_socket__.send("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n")
 
                             PLUGIN.notify("Fehler beim Abspielen!")
 
+                            raise e
+
                         finally:
                             hide_busy_dialog()
 
@@ -152,8 +155,11 @@ class __PlayServer__(object):
             return True
 
         except:
+            __client_socket__.send("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n")
+
             self._running = False
             output("[SERVER-" + str(self._port) + "] Client Error: %s" % traceback.format_exc())
+
             return False
 
         finally: