From a257ac87f70781f615a313622c90ff6d594de219 Mon Sep 17 00:00:00 2001 From: Michael Krane Date: Thu, 28 Apr 2016 18:30:41 +0200 Subject: [PATCH 1/3] Allows to import DNA fittings via ingame urls --- service/port.py | 1 + 1 file changed, 1 insertion(+) diff --git a/service/port.py b/service/port.py index cc6d11d17..4eb570f1d 100644 --- a/service/port.py +++ b/service/port.py @@ -206,6 +206,7 @@ class Port(object): @staticmethod def importDna(string): sMkt = service.Market.getInstance() + string = string.replace("javascript:CCPEVE.showFitting('", "").replace("');", "") info = string.split(":") f = Fit() From a09d4139d50cdac365b56fe1904191870d3dfdf4 Mon Sep 17 00:00:00 2001 From: Michael Krane Date: Thu, 28 Apr 2016 19:06:53 +0200 Subject: [PATCH 2/3] Removes everything before and after the DNA --- service/port.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/service/port.py b/service/port.py index 4eb570f1d..d330515c8 100644 --- a/service/port.py +++ b/service/port.py @@ -206,7 +206,17 @@ class Port(object): @staticmethod def importDna(string): sMkt = service.Market.getInstance() - string = string.replace("javascript:CCPEVE.showFitting('", "").replace("');", "") + + ids = map(int, re.findall(r'\d+', string)) + for id in ids: + try: + Ship(sMkt.getItem(id)) + string = string[string.index(str(id)):] + break + except Exception, e: + continue + pass + string = string[0: (string.index("::") + 2)] info = string.split(":") f = Fit() From 8a4f3b7642a9ed1b7f89141a373623cd3d276499 Mon Sep 17 00:00:00 2001 From: Michael Krane Date: Thu, 28 Apr 2016 22:59:47 +0200 Subject: [PATCH 3/3] Code clean Up --- service/port.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/service/port.py b/service/port.py index d330515c8..718ee3fe4 100644 --- a/service/port.py +++ b/service/port.py @@ -213,10 +213,9 @@ class Port(object): Ship(sMkt.getItem(id)) string = string[string.index(str(id)):] break - except Exception, e: - continue - pass - string = string[0: (string.index("::") + 2)] + except: + pass + string = string[:string.index("::") + 2] info = string.split(":") f = Fit()