Initial Push

This commit is contained in:
Oli Passey
2025-06-27 10:36:26 +01:00
parent cf1023c14a
commit 191184ba5e
31 changed files with 4531 additions and 68 deletions

View File

@@ -0,0 +1,85 @@
"""
Example script to add sample products for testing
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.database import DatabaseManager
from src.config import Config
def add_sample_products():
"""Add some sample products for testing."""
config = Config()
db_manager = DatabaseManager(config.database_path)
# Sample products with real URLs (for demonstration)
sample_products = [
{
'name': 'AirPods Pro (2nd Generation)',
'description': 'Apple AirPods Pro with Active Noise Cancellation',
'target_price': 200.00,
'urls': {
'amazon': 'https://www.amazon.com/dp/B0BDHWDR12',
'walmart': 'https://www.walmart.com/ip/AirPods-Pro-2nd-generation/1952646965'
}
},
{
'name': 'Sony WH-1000XM4 Headphones',
'description': 'Wireless Noise Canceling Over-Ear Headphones',
'target_price': 250.00,
'urls': {
'amazon': 'https://www.amazon.com/dp/B0863TXGM3',
'ebay': 'https://www.ebay.com/itm/Sony-WH-1000XM4-Wireless-Headphones/324298765234'
}
},
{
'name': 'iPad Air (5th Generation)',
'description': '10.9-inch iPad Air with M1 Chip, 64GB',
'target_price': 500.00,
'urls': {
'amazon': 'https://www.amazon.com/dp/B09V3HN1KC',
'walmart': 'https://www.walmart.com/ip/iPad-Air-5th-Gen/612825603'
}
},
{
'name': 'Nintendo Switch OLED',
'description': 'Nintendo Switch OLED Model Gaming Console',
'target_price': 300.00,
'urls': {
'amazon': 'https://www.amazon.com/dp/B098RKWHHZ',
'walmart': 'https://www.walmart.com/ip/Nintendo-Switch-OLED/910582148'
}
},
{
'name': 'Samsung 55" 4K Smart TV',
'description': 'Samsung 55-inch Crystal UHD 4K Smart TV',
'target_price': 400.00,
'urls': {
'amazon': 'https://www.amazon.com/dp/B08T6F5H1Y',
'walmart': 'https://www.walmart.com/ip/Samsung-55-Class-4K-Crystal-UHD/485926403'
}
}
]
print("Adding sample products...")
for product_data in sample_products:
try:
product_id = db_manager.add_product(
name=product_data['name'],
description=product_data['description'],
target_price=product_data['target_price'],
urls=product_data['urls']
)
print(f"✓ Added: {product_data['name']} (ID: {product_id})")
except Exception as e:
print(f"✗ Failed to add {product_data['name']}: {e}")
print("\nSample products added successfully!")
print("You can now run the web UI with: python main.py --mode web")
print("Or start scraping with: python main.py --mode scrape")
if __name__ == "__main__":
add_sample_products()

View File

@@ -0,0 +1,99 @@
"""
Example script to add UK catering sample products for testing
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.database import DatabaseManager
from src.config import Config
def add_uk_catering_products():
"""Add some sample UK catering products for testing."""
config = Config()
db_manager = DatabaseManager(config.database_path)
# Sample UK catering products with example URLs
# Note: These are example URLs - you'll need to replace with real product URLs
sample_products = [
{
'name': 'McCain Straight Cut Oven Chips 2.5kg',
'description': 'Frozen straight cut oven chips for catering use',
'target_price': 4.50,
'urls': {
'jjfoodservice': 'https://www.jjfoodservice.com/products/mccain-straight-cut-oven-chips',
'atoz_catering': 'https://www.atoz-catering.co.uk/products/product/mccain-straight-cut-oven-chips-25kg'
}
},
{
'name': 'Heinz Baked Beans 6x2.62kg',
'description': 'Catering size baked beans in tomato sauce',
'target_price': 25.00,
'urls': {
'atoz_catering': 'https://www.atoz-catering.co.uk/products/product/heinz-baked-beans--6x262kg',
'jjfoodservice': 'https://www.jjfoodservice.com/products/heinz-baked-beans-catering'
}
},
{
'name': 'Chef Select Chicken Breast Fillets 2kg',
'description': 'Fresh chicken breast fillets for professional kitchens',
'target_price': 12.00,
'urls': {
'jjfoodservice': 'https://www.jjfoodservice.com/products/chicken-breast-fillets-2kg',
'atoz_catering': 'https://www.atoz-catering.co.uk/products/product/chicken-breast-fillets-2kg'
}
},
{
'name': 'Whole Milk 2 Litre Bottles (Case of 6)',
'description': 'Fresh whole milk in 2L bottles for catering',
'target_price': 8.00,
'urls': {
'atoz_catering': 'https://www.atoz-catering.co.uk/products/product/cotteswold-whole-milk-1x2lt-blue',
'jjfoodservice': 'https://www.jjfoodservice.com/products/whole-milk-2l-case'
}
},
{
'name': 'Vegetable Oil 20L Container',
'description': 'Catering vegetable oil for deep frying and cooking',
'target_price': 35.00,
'urls': {
'jjfoodservice': 'https://www.jjfoodservice.com/products/vegetable-oil-20l',
'atoz_catering': 'https://www.atoz-catering.co.uk/products/product/vegetable-oil-20l-container'
}
},
{
'name': 'Plain Flour 16kg Sack',
'description': 'Professional baking flour for commercial use',
'target_price': 18.00,
'urls': {
'atoz_catering': 'https://www.atoz-catering.co.uk/products/product/plain-flour-16kg-sack',
'jjfoodservice': 'https://www.jjfoodservice.com/products/plain-flour-16kg'
}
}
]
print("Adding UK catering sample products...")
for product_data in sample_products:
try:
product_id = db_manager.add_product(
name=product_data['name'],
description=product_data['description'],
target_price=product_data['target_price'],
urls=product_data['urls']
)
print(f"✓ Added: {product_data['name']} (ID: {product_id})")
except Exception as e:
print(f"✗ Failed to add {product_data['name']}: {e}")
print("\nUK catering sample products added successfully!")
print("Note: The URLs in this example are placeholders.")
print("You'll need to replace them with real product URLs from:")
print("- JJ Food Service: https://www.jjfoodservice.com/")
print("- A to Z Catering: https://www.atoz-catering.co.uk/")
print("\nYou can now run the web UI with: python main.py --mode web")
print("Or start scraping with: python main.py --mode scrape")
if __name__ == "__main__":
add_uk_catering_products()