Fix Discogs API integration with proper authentication
- Updated to use python3-discogs-client==2.8 library - Added environment variable configuration for API keys - Implemented proper error handling for missing API credentials - Added .env file for configuration management - Enhanced search functionality with graceful fallbacks - Updated README with Discogs API setup instructions
This commit is contained in:
84
templates/results.html
Normal file
84
templates/results.html
Normal file
@@ -0,0 +1,84 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Search Results - Media Inventory App{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Search Results</h2>
|
||||
<a href="/" class="btn btn-outline-primary">🔍 New Search</a>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>Query:</strong> "{{ query }}"
|
||||
<strong>Media Type:</strong>
|
||||
{% if media_type == 'book' %}📚 Book{% endif %}
|
||||
{% if media_type == 'vinyl' %}🎵 Vinyl Record{% endif %}
|
||||
{% if media_type == 'cd' %}💿 CD{% endif %}
|
||||
{% if media_type == 'cassette' %}📼 Cassette{% endif %}
|
||||
</div>
|
||||
|
||||
{% if results %}
|
||||
<div class="row">
|
||||
{% for item in results %}
|
||||
<div class="col-md-6 col-lg-4 mb-4">
|
||||
<div class="card h-100">
|
||||
{% if item.cover_url %}
|
||||
<img src="{{ item.cover_url }}" class="card-img-top" alt="Cover"
|
||||
style="height: 200px; object-fit: cover;">
|
||||
{% else %}
|
||||
<div class="card-img-top bg-light d-flex align-items-center justify-content-center"
|
||||
style="height: 200px;">
|
||||
<span class="text-muted">No Image</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-body d-flex flex-column">
|
||||
<h5 class="card-title">{{ item.title }}</h5>
|
||||
|
||||
{% if media_type == 'book' %}
|
||||
<p class="card-text">
|
||||
<strong>Author:</strong> {{ item.author }}<br>
|
||||
<strong>Year:</strong> {{ item.year }}<br>
|
||||
{% if item.isbn %}
|
||||
<strong>ISBN:</strong> {{ item.isbn }}<br>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="card-text">
|
||||
<strong>Artist:</strong> {{ item.artist }}<br>
|
||||
<strong>Year:</strong> {{ item.year }}<br>
|
||||
<strong>Label:</strong> {{ item.label }}<br>
|
||||
<strong>Format:</strong> {{ item.format }}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="mt-auto">
|
||||
{% if media_type == 'book' and item.openlibrary_url %}
|
||||
<a href="{{ item.openlibrary_url }}" target="_blank"
|
||||
class="btn btn-primary btn-sm">
|
||||
📚 View on OpenLibrary
|
||||
</a>
|
||||
{% elif media_type != 'book' and item.discogs_url %}
|
||||
<a href="{{ item.discogs_url }}" target="_blank"
|
||||
class="btn btn-primary btn-sm">
|
||||
🎵 View on Discogs
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-warning">
|
||||
<h4>No results found</h4>
|
||||
<p>Try adjusting your search terms or selecting a different media type.</p>
|
||||
<a href="/" class="btn btn-primary">🔍 Try Another Search</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user