[scrobbles] Allow boardgame screenshots and clean up koreader fields
This commit is contained in:
@ -31,7 +31,7 @@ class ScrobbleInline(admin.TabularInline):
|
||||
"scrobble_log",
|
||||
"timezone",
|
||||
"videogame_save_data",
|
||||
"videogame_screenshot",
|
||||
"screenshot",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
# Generated by Django 4.2.15 on 2024-08-20 14:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("scrobbles", "0058_merge_20240810_2234"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="scrobble",
|
||||
name="book_koreader_hash",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="scrobble",
|
||||
name="book_page_data",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="scrobble",
|
||||
name="book_pages_read",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="scrobble",
|
||||
name="videogame_screenshot",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="scrobble",
|
||||
name="screenshot",
|
||||
field=models.ImageField(
|
||||
blank=True,
|
||||
null=True,
|
||||
upload_to="scrobbles/videogame_screenshot/",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="scrobble",
|
||||
name="videogame_save_data",
|
||||
field=models.FileField(
|
||||
blank=True,
|
||||
null=True,
|
||||
upload_to="scrobbles/videogame_save_data/",
|
||||
),
|
||||
),
|
||||
]
|
||||
@ -536,26 +536,21 @@ class Scrobble(TimeStampedModel):
|
||||
)
|
||||
timezone = models.CharField(max_length=50, **BNULL)
|
||||
|
||||
# Fields for keeping track of book data DEPRECATED, remove after migration
|
||||
book_koreader_hash = models.CharField(max_length=50, **BNULL)
|
||||
book_pages_read = models.IntegerField(**BNULL)
|
||||
book_page_data = models.JSONField(**BNULL)
|
||||
|
||||
# Fields for keeping track of video game data
|
||||
videogame_save_data = models.FileField(
|
||||
upload_to="scrobbles/videogame_save_data/", **BNULL
|
||||
)
|
||||
videogame_screenshot = models.ImageField(
|
||||
screenshot = models.ImageField(
|
||||
upload_to="scrobbles/videogame_screenshot/", **BNULL
|
||||
)
|
||||
videogame_screenshot_small = ImageSpecField(
|
||||
source="videogame_screenshot",
|
||||
screenshot_small = ImageSpecField(
|
||||
source="screenshot",
|
||||
processors=[ResizeToFit(100, 100)],
|
||||
format="JPEG",
|
||||
options={"quality": 60},
|
||||
)
|
||||
videogame_screenshot_medium = ImageSpecField(
|
||||
source="videogame_screenshot",
|
||||
screenshot_medium = ImageSpecField(
|
||||
source="screenshot",
|
||||
processors=[ResizeToFit(300, 300)],
|
||||
format="JPEG",
|
||||
options={"quality": 75},
|
||||
|
||||
@ -56,13 +56,16 @@
|
||||
<tr>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">Publisher</th>
|
||||
<th scope="col">Screenshot</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
|
||||
<tr>
|
||||
<td>{{scrobble.timestamp}}</td>
|
||||
<td>{{scrobble.logdata}}</td>
|
||||
<td>{{scrobble.media_obj.publisher}}</td>
|
||||
<td>{% if scrobble.screenshot%}<img src="{{scrobble.screenshot.url}}" width=250 />{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
@ -164,8 +164,8 @@
|
||||
{% for scrobble in videogame_scrobble_list %}
|
||||
<tr>
|
||||
<td>{{scrobble.timestamp|naturaltime}}</td>
|
||||
{% if scrobble.videogame_screenshot %}
|
||||
<td><img src="{{scrobble.videogame_screenshot_medium.url}}" width=25 height=25 style="border:1px solid black;" /></td>
|
||||
{% if scrobble.screenshot %}
|
||||
<td><img src="{{scrobble.screenshot_medium.url}}" width=25 height=25 style="border:1px solid black;" /></td>
|
||||
{% else %}
|
||||
{% if scrobble.media_obj.hltb_cover %}
|
||||
<td><img src="{{scrobble.media_obj.hltb_cover_medium.url}}" width=25 height=25 style="border:1px solid black;" /></td>
|
||||
|
||||
@ -93,7 +93,7 @@
|
||||
<td>{% if scrobble.in_progress %}Now playing{% else %}{{scrobble.playback_position_seconds|natural_duration}}{% endif %}</td>
|
||||
<td>{% for platform in scrobble.video_game.platforms.all %}<a href="{{platform.get_absolute_url}}">{{platform}}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</td>
|
||||
<td>{% if scrobble.videogame_save_data %}<a href="{{scrobble.videogame_save_data.url}}">Save data</a>{% else %}Not yet{% endif %}</td>
|
||||
<td>{% if scrobble.videogame_screenshot%}<img src="{{scrobble.videogame_screenshot.url}}" width=250 />{% endif %}</td>
|
||||
<td>{% if scrobble.screenshot%}<img src="{{scrobble.screenshot.url}}" width=250 />{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user