| Line 6... |
Line 6... |
| 6 |
import time
|
6 |
import time
|
| 7 |
from multiprocessing import Pool as ThreadPool
|
7 |
from multiprocessing import Pool as ThreadPool
|
| 8 |
from multiprocessing import cpu_count
|
8 |
from multiprocessing import cpu_count
|
| 9 |
import optparse
|
9 |
import optparse
|
| 10 |
from dtr.storage.MemCache import MemCache
|
10 |
from dtr.storage.MemCache import MemCache
|
| 11 |
from dtr.utils.utils import getCashBack, get_mongo_connection, SOURCE_MAP
|
11 |
from dtr.utils.utils import getCashBack, get_mongo_connection, SOURCE_MAP, DEAL_PRIORITY
|
| 12 |
import traceback
|
12 |
import traceback
|
| 13 |
from operator import itemgetter
|
13 |
from operator import itemgetter
|
| 14 |
import chardet
|
14 |
import chardet
|
| 15 |
from dtr.utils import HomeShop18Scraper
|
15 |
from dtr.utils import HomeShop18Scraper
|
| 16 |
|
16 |
|
| Line 186... |
Line 186... |
| 186 |
continue
|
186 |
continue
|
| 187 |
if similarItem.get('netPriceAfterCashBack') < bestPrice:
|
187 |
if similarItem.get('netPriceAfterCashBack') < bestPrice:
|
| 188 |
bestOne = similarItem
|
188 |
bestOne = similarItem
|
| 189 |
bestPrice = similarItem.get('netPriceAfterCashBack')
|
189 |
bestPrice = similarItem.get('netPriceAfterCashBack')
|
| 190 |
bestSellerPoints = similarItem['bestSellerPoints']
|
190 |
bestSellerPoints = similarItem['bestSellerPoints']
|
| 191 |
elif similarItem.get('netPriceAfterCashBack') == bestPrice and bestSellerPoints < similarItem['bestSellerPoints']:
|
191 |
elif similarItem.get('netPriceAfterCashBack') == bestPrice:
|
| - |
|
192 |
|
| - |
|
193 |
try:
|
| - |
|
194 |
if (DEAL_PRIORITY.index(int(similarItem['source_id'])) > DEAL_PRIORITY.index(int(bestOne['source_id']))):
|
| - |
|
195 |
continue
|
| - |
|
196 |
except:
|
| - |
|
197 |
traceback.print_exc()
|
| - |
|
198 |
|
| 192 |
bestOne = similarItem
|
199 |
bestOne = similarItem
|
| 193 |
bestPrice = similarItem.get('netPriceAfterCashBack')
|
200 |
bestPrice = similarItem.get('netPriceAfterCashBack')
|
| 194 |
bestSellerPoints = similarItem['bestSellerPoints']
|
201 |
bestSellerPoints = similarItem['bestSellerPoints']
|
| 195 |
else:
|
202 |
else:
|
| 196 |
pass
|
203 |
pass
|
| Line 205... |
Line 212... |
| 205 |
continue
|
212 |
continue
|
| 206 |
if similarItem.get('netPriceAfterCashBack') < prepaidBestPrice:
|
213 |
if similarItem.get('netPriceAfterCashBack') < prepaidBestPrice:
|
| 207 |
prepaidBestOne = similarItem
|
214 |
prepaidBestOne = similarItem
|
| 208 |
prepaidBestPrice = similarItem.get('netPriceAfterCashBack')
|
215 |
prepaidBestPrice = similarItem.get('netPriceAfterCashBack')
|
| 209 |
prepaidBestSellerPoints = similarItem['bestSellerPoints']
|
216 |
prepaidBestSellerPoints = similarItem['bestSellerPoints']
|
| 210 |
elif similarItem.get('netPriceAfterCashBack') == prepaidBestPrice and prepaidBestSellerPoints < similarItem['bestSellerPoints']:
|
217 |
elif similarItem.get('netPriceAfterCashBack') == prepaidBestPrice:
|
| - |
|
218 |
|
| - |
|
219 |
try:
|
| - |
|
220 |
if (DEAL_PRIORITY.index(int(similarItem['source_id'])) > DEAL_PRIORITY.index(int(bestOne['source_id']))):
|
| - |
|
221 |
continue
|
| - |
|
222 |
except:
|
| - |
|
223 |
traceback.print_exc()
|
| - |
|
224 |
|
| 211 |
prepaidBestOne = similarItem
|
225 |
prepaidBestOne = similarItem
|
| 212 |
prepaidBestPrice = similarItem.get('netPriceAfterCashBack')
|
226 |
prepaidBestPrice = similarItem.get('netPriceAfterCashBack')
|
| 213 |
prepaidBestSellerPoints = similarItem['bestSellerPoints']
|
227 |
prepaidBestSellerPoints = similarItem['bestSellerPoints']
|
| 214 |
else:
|
228 |
else:
|
| 215 |
pass
|
229 |
pass
|