[scrobbles] Allow boardgame screenshots and clean up koreader fields
This commit is contained in:
@ -31,7 +31,7 @@ class ScrobbleInline(admin.TabularInline):
|
|||||||
"scrobble_log",
|
"scrobble_log",
|
||||||
"timezone",
|
"timezone",
|
||||||
"videogame_save_data",
|
"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)
|
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
|
# Fields for keeping track of video game data
|
||||||
videogame_save_data = models.FileField(
|
videogame_save_data = models.FileField(
|
||||||
upload_to="scrobbles/videogame_save_data/", **BNULL
|
upload_to="scrobbles/videogame_save_data/", **BNULL
|
||||||
)
|
)
|
||||||
videogame_screenshot = models.ImageField(
|
screenshot = models.ImageField(
|
||||||
upload_to="scrobbles/videogame_screenshot/", **BNULL
|
upload_to="scrobbles/videogame_screenshot/", **BNULL
|
||||||
)
|
)
|
||||||
videogame_screenshot_small = ImageSpecField(
|
screenshot_small = ImageSpecField(
|
||||||
source="videogame_screenshot",
|
source="screenshot",
|
||||||
processors=[ResizeToFit(100, 100)],
|
processors=[ResizeToFit(100, 100)],
|
||||||
format="JPEG",
|
format="JPEG",
|
||||||
options={"quality": 60},
|
options={"quality": 60},
|
||||||
)
|
)
|
||||||
videogame_screenshot_medium = ImageSpecField(
|
screenshot_medium = ImageSpecField(
|
||||||
source="videogame_screenshot",
|
source="screenshot",
|
||||||
processors=[ResizeToFit(300, 300)],
|
processors=[ResizeToFit(300, 300)],
|
||||||
format="JPEG",
|
format="JPEG",
|
||||||
options={"quality": 75},
|
options={"quality": 75},
|
||||||
|
|||||||
@ -56,13 +56,16 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Date</th>
|
<th scope="col">Date</th>
|
||||||
<th scope="col">Publisher</th>
|
<th scope="col">Publisher</th>
|
||||||
|
<th scope="col">Screenshot</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
|
{% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{scrobble.timestamp}}</td>
|
<td>{{scrobble.timestamp}}</td>
|
||||||
|
<td>{{scrobble.logdata}}</td>
|
||||||
<td>{{scrobble.media_obj.publisher}}</td>
|
<td>{{scrobble.media_obj.publisher}}</td>
|
||||||
|
<td>{% if scrobble.screenshot%}<img src="{{scrobble.screenshot.url}}" width=250 />{% endif %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -164,8 +164,8 @@
|
|||||||
{% for scrobble in videogame_scrobble_list %}
|
{% for scrobble in videogame_scrobble_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{scrobble.timestamp|naturaltime}}</td>
|
<td>{{scrobble.timestamp|naturaltime}}</td>
|
||||||
{% if scrobble.videogame_screenshot %}
|
{% if scrobble.screenshot %}
|
||||||
<td><img src="{{scrobble.videogame_screenshot_medium.url}}" width=25 height=25 style="border:1px solid black;" /></td>
|
<td><img src="{{scrobble.screenshot_medium.url}}" width=25 height=25 style="border:1px solid black;" /></td>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if scrobble.media_obj.hltb_cover %}
|
{% 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>
|
<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>{% 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>{% 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_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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user