Commit 7bf07d6e authored by Melroy van den Berg's avatar Melroy van den Berg

all categories completed, plus ordered alpha

parent f8b69daf
This diff is collapsed.
......@@ -4,6 +4,8 @@
__version__= 1.0
import argparse
import collections
from marktplaats import Marktplaats
from text_color import TextColor
from category import MP_Category
......@@ -11,6 +13,8 @@ from category import MP_Category
parser = argparse.ArgumentParser(description="Batch process Marktplaats.nl advertisements.")
parser.add_argument("-c", "--categories", help="List of all Marktplaats categories and exit.",
action="store_true")
parser.add_argument("--defined", help="List categories in defined order.",
action="store_true")
parser.add_argument("-a", "--approval", help="Approval required to submit",
action="store_true")
parser.add_argument('--version', action='version', version='%(prog)s {version}'.format(version=__version__))
......@@ -21,10 +25,14 @@ args = parser.parse_args()
print (TextColor.OKGREEN + "INFO: Running Marktplaats Batch %s" % str(__version__) + TextColor.ENDC)
if args.categories:
print (TextColor.OKGREEN + "INFO: All available Marktplaats.nl (free) product categories in Marktplaats Batch:\n" + TextColor.ENDC)
for c in MP_Category:
#print(c.name)
print(c.value)
print (TextColor.OKGREEN + "INFO: All available Marktplaats.nl (free) product categories in Marktplaats Batch (total: %d categories):\n" % len(MP_Category) + TextColor.ENDC)
if args.defined:
for c in MP_Category:
print(c.name)
else:
# By default show the enum values ordered alphabetically
for k, _ in collections.OrderedDict(sorted(MP_Category.__members__.items())).items():
print (k)
exit(0)
USER_FINAL_APPROVAL_REQUIRED=False
......
......@@ -77,7 +77,8 @@ def startFirefox():
status = loop.run_until_complete(
run_command("firefox", "site/index.html", timeout=180))
if loop is not None:
loop.close()
loop.close()
return status
<li class="item " data-val="1659">games DS</li>
<li class="item " data-val="2887">games 2DS en 3DS</li>
<li class="item " data-val="2888">games Wii U</li>
<li class="item " data-val="363">games Game Boy</li>
<li class="item " data-val="1730">games GameCube</li>
<li class="item " data-val="1733">games Nintendo 64</li>
<li class="item " data-val="1731">games NES</li>
<li class="item " data-val="1732">games Super NES</li>
<li class="item " data-val="1630">games Wii</li>
<li class="item " data-val="367">games PlayStation</li>
<li class="item " data-val="1734">games PlayStation 2</li>
<li class="item " data-val="1735">games PlayStation 3</li>
<li class="item " data-val="2889">games PlayStation 4</li>
<li class="item " data-val="2890">games PlayStation Vita</li>
<li class="item " data-val="1660">games PSP</li>
<li class="item " data-val="368">games Xbox</li>
<li class="item " data-val="1631">games Xbox 360</li>
<li class="item " data-val="2891">games Xbox One</li>
<li class="item " data-val="1729">games Atari</li>
<li class="item " data-val="365">games Pc</li>
<li class="item " data-val="366">games Sega</li>
<li class="item " data-val="364">games Overige merken</li>
<li class="item " data-val="1655">spelcomputers DS</li>
<li class="item " data-val="2892">spelcomputers 2DS en 3DS</li>
<li class="item " data-val="2893">spelcomputers Wii U</li>
<li class="item " data-val="346">spelcomputers Game Boy</li>
<li class="item " data-val="1736">spelcomputers GameCube</li>
<li class="item " data-val="1739">spelcomputers Nintendo 64</li>
<li class="item " data-val="1737">spelcomputers NES</li>
<li class="item " data-val="1738">spelcomputers Super NES</li>
<li class="item " data-val="1628">spelcomputers Wii</li>
<li class="item " data-val="347">spelcomputers PlayStation</li>
<li class="item " data-val="1740">spelcomputers PlayStation 2</li>
<li class="item " data-val="1741">spelcomputers PlayStation 3</li>
<li class="item " data-val="2894">spelcomputers PlayStation 4</li>
<li class="item " data-val="2895">spelcomputers PlayStation Vita</li>
<li class="item " data-val="1656">spelcomputers PSP</li>
<li class="item " data-val="349">spelcomputers Xbox</li>
<li class="item " data-val="1629">spelcomputers Xbox 360</li>
<li class="item " data-val="2896">spelcomputers Xbox One</li>
<li class="item " data-val="345">spelcomputers Atari</li>
<li class="item " data-val="348">spelcomputers Sega</li>
<li class="item " data-val="1743">spelcomputers Overige merken</li>
<li class="item " data-val="2799">toebehoren DS</li>
<li class="item " data-val="2800">toebehoren Wii</li>
<li class="item " data-val="2801">toebehoren PlayStation</li>
<li class="item " data-val="2802">toebehoren PSP</li>
<li class="item " data-val="2803">toebehoren Xbox</li>
<li class="item " data-val="1657">Overige Toebehoren</li>
<li class="item " data-val="436">Kerst</li>
<li class="item " data-val="1703">Pasen</li>
<li class="item " data-val="1345">Rommelmarktspullen</li>
<li class="item " data-val="443">Sinterklaas</li>
<li class="item " data-val="1704">Vlaggen en Wimpels</li>
<li class="item " data-val="1968">Levensmiddelen</li>
<li class="item " data-val="1967">Kalenders en Agenda's</li>
<li class="item " data-val="1456">Schoolbenodigdheden</li>
<li class="item " data-val="1355">Schrijfmachines en Typemachines</li>
<li class="item " data-val="1705">Schrijfwaren en Papierwaren</li>
<li class="item " data-val="2904">Rolstoelen</li>
<li class="item " data-val="2828">Trapliften</li>
<li class="item " data-val="1346">Verpleegmiddelen en Hulpmiddelen</li>
<li class="item " data-val="1347">Overige zorg</li>
<li class="item " data-val="440">Overige Diversen</li>
......@@ -24,7 +24,7 @@ with open("cat.txt", "r") as ins:
line = line.split("\">")
id = line[0].replace(" style=\"\"", "")
name = line[1].replace("'", "").replace("!", "").replace("&", "").replace("-", "_").replace(" | ", "_").replace(", ", "_").replace(" en ", "_").replace(":", "_").replace(" ", "_").replace("____", "_").replace("___", "_").replace("__", "_")
name = line[1].replace("'", "").replace("!", "").replace("&", "").replace("-", "_").replace("/", "_").replace(" | ", "_").replace(", ", "_").replace(" en ", "_").replace(":", "_").replace(" ", "_").replace("____", "_").replace("___", "_").replace("__", "_")
name = special_char_replace(name).upper()
data['id'] = id
data['name'] = name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment