Add category search, license handling, and message page improvements
Add /category route to find Wikipedia articles without images in a category using the MediaWiki API. Filter out non-content images (UI icons, logos) when checking articles. Show image license on message page with alternate message for non-free CC licenses (NC/ND) explaining Wikipedia's restrictions. For photos with free licenses, show upload options linking to UploadWizard instead of a message form. Add Flickr CC 4.0 license codes, user profile links, previous message detection from sent mail index, and back-navigation between category, search results, and message pages. Closes #3 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d59e67b55d
commit
c5efd429ce
4 changed files with 403 additions and 19 deletions
67
templates/category.html
Normal file
67
templates/category.html
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Category Search - Flickr mail{% endblock %}
|
||||
|
||||
{% block style %}
|
||||
<style>
|
||||
.article-link:visited { color: #6f42c1; }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h1>Find articles needing images</h1>
|
||||
<p class="text-muted">Enter a Wikipedia category to find articles without images</p>
|
||||
|
||||
<form action="{{ url_for('category_search') }}" method="get">
|
||||
<div class="mb-3">
|
||||
<label for="cat" class="form-label">Wikipedia category name or URL:</label>
|
||||
<input type="text" class="form-control" id="cat" name="cat" value="{{ cat }}"
|
||||
placeholder="e.g., Living people or https://en.wikipedia.org/wiki/Category:Living_people" required>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary" value="Search">
|
||||
<a href="{{ url_for('start') }}" class="btn btn-outline-secondary ms-2">Back to main</a>
|
||||
</form>
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert-danger mt-3">{{ error }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if category and articles is defined %}
|
||||
<div class="mt-4">
|
||||
<h5>Articles without images in <a href="https://en.wikipedia.org/wiki/{{ category | replace(' ', '_') }}" target="_blank">{{ category_name }}</a></h5>
|
||||
|
||||
{% if articles %}
|
||||
<p class="text-muted small">Found {{ articles | length }} article(s) without images{% if continue_token %} (more available){% endif %}</p>
|
||||
|
||||
<div class="list-group">
|
||||
{% for article in articles %}
|
||||
<div class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<a href="{{ url_for('start', enwp=article.title, cat=cat) }}" class="text-decoration-none article-link">{{ article.title }}</a>
|
||||
<a href="{{ article.wikipedia_url }}" target="_blank" class="badge bg-secondary text-decoration-none">Wikipedia</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if continue_token %}
|
||||
<p class="text-muted small mt-3">Note: Only showing first batch of results. More articles may be available in this category.</p>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<div class="alert alert-success mt-3">
|
||||
All articles in this category have images!
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="mt-4">
|
||||
<p class="text-muted small">
|
||||
<a href="{{ url_for('start') }}">Back to Flickr mail home</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue