From dd840aa75d2e55cb00097b672460422f18c36727 Mon Sep 17 00:00:00 2001 From: Anton Sarukhanov <code@ant.sr> Date: Sat, 5 Aug 2017 14:20:59 -0400 Subject: [PATCH] dpsounds: handle track names that aren't strictly numeric. --- wooify/adapters/dpsounds.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wooify/adapters/dpsounds.py b/wooify/adapters/dpsounds.py index 463a698..ddeed78 100644 --- a/wooify/adapters/dpsounds.py +++ b/wooify/adapters/dpsounds.py @@ -94,6 +94,7 @@ class DpsoundsAdapter(BaseAdapter): "Attributes": wtf_attributes, "Custom Fields": (phpserialize.dumps(custom_fields) .decode('utf-8')), + "Menu Order": 10000 + _make_int(r['Track']) }) return product @@ -105,3 +106,7 @@ class DpsoundsAdapter(BaseAdapter): self.products.append(product) adapter_cls = DpsoundsAdapter + +def _make_int(str_in): + """Cast string to int, ignoring any excess chars.""" + return int(''.join(c for c in str_in if c.isdigit())) -- GitLab