- Removed duplicate /api/search endpoint - Kept /search as the main JSON API endpoint with proper documentation - Added /search/form for web form submissions - Updated HTML form to use /search/form endpoint - Clear separation between API and web interface - Media type enums still visible in /docs for API usage - Maintains all functionality while reducing endpoint confusion
87 lines
3.6 KiB
HTML
87 lines
3.6 KiB
HTML
{% extends "base.html" %}
|
||
|
||
{% block title %}Search Media - Media Inventory App{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="row justify-content-center">
|
||
<div class="col-md-8">
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<h2 class="card-title mb-0">🔍 Search Media</h2>
|
||
</div>
|
||
<div class="card-body">
|
||
{% if error %}
|
||
<div class="alert alert-danger" role="alert">
|
||
{{ error }}
|
||
</div>
|
||
{% endif %}
|
||
|
||
<form method="post" action="/search/form">
|
||
<div class="mb-3">
|
||
<label for="media_type" class="form-label">Media Type</label>
|
||
<select class="form-select" id="media_type" name="media_type" required>
|
||
<option value="">Select media type...</option>
|
||
<option value="book">📚 Book</option>
|
||
<option value="vinyl">🎵 Vinyl Record</option>
|
||
<option value="cd">💿 CD</option>
|
||
<option value="cassette">📼 Cassette</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="mb-3">
|
||
<label for="query" class="form-label">Search Query</label>
|
||
<input type="text" class="form-control" id="query" name="query"
|
||
placeholder="Enter title, album name, or keywords..." required>
|
||
<div class="form-text">
|
||
For books: Enter book title or author name<br>
|
||
For music: Enter album title or song name
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mb-3" id="artist-field" style="display: none;">
|
||
<label for="artist" class="form-label">Artist (Optional)</label>
|
||
<input type="text" class="form-control" id="artist" name="artist"
|
||
placeholder="Enter artist name...">
|
||
<div class="form-text">
|
||
Helps narrow down music search results
|
||
</div>
|
||
</div>
|
||
|
||
<button type="submit" class="btn btn-primary btn-lg w-100">
|
||
🔍 Search
|
||
</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-4">
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<h5 class="card-title mb-0">ℹ️ How it works</h5>
|
||
</div>
|
||
<div class="card-body">
|
||
<ul class="list-unstyled">
|
||
<li><strong>📚 Books:</strong> Searches OpenLibrary.org for book information</li>
|
||
<li><strong>🎵 Music (Vinyl/CD/Cassette):</strong> Searches Discogs.com for music releases</li>
|
||
<li><strong>🎯 Tips:</strong> Be specific with your search terms for better results</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
document.getElementById('media_type').addEventListener('change', function() {
|
||
const artistField = document.getElementById('artist-field');
|
||
const selectedType = this.value;
|
||
|
||
if (selectedType === 'vinyl' || selectedType === 'cd' || selectedType === 'cassette') {
|
||
artistField.style.display = 'block';
|
||
} else {
|
||
artistField.style.display = 'none';
|
||
}
|
||
});
|
||
</script>
|
||
{% endblock %}
|