Add scrobble list to import detail view
This commit is contained in:
@ -99,6 +99,14 @@ class BaseFileImportMixin(TimeStampedModel):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def scrobbles(self) -> models.QuerySet:
|
||||||
|
scrobble_ids = []
|
||||||
|
for line in self.process_log.split("\n"):
|
||||||
|
sid = line.split("\t")[0]
|
||||||
|
if sid:
|
||||||
|
scrobble_ids.append(sid)
|
||||||
|
return Scrobble.objects.filter(id__in=scrobble_ids)
|
||||||
|
|
||||||
def mark_started(self):
|
def mark_started(self):
|
||||||
self.processing_started = timezone.now()
|
self.processing_started = timezone.now()
|
||||||
self.save(update_fields=["processing_started"])
|
self.save(update_fields=["processing_started"])
|
||||||
|
|||||||
@ -8,6 +8,28 @@
|
|||||||
<p>Import started: {{object.processing_started}}</p>
|
<p>Import started: {{object.processing_started}}</p>
|
||||||
<p>Import finished: {{object.processed_finished}}</p>
|
<p>Import finished: {{object.processed_finished}}</p>
|
||||||
<p>Imported {{object.process_count}} scrobbles</p>
|
<p>Imported {{object.process_count}} scrobbles</p>
|
||||||
|
|
||||||
|
<h3>Scrobbles</h3>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Date</th>
|
||||||
|
<th scope="col">Media Type</th>
|
||||||
|
<th scope="col">Media</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for scrobble in object.scrobbles %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="{{scrobble.get_absolute_url}}">{{scrobble.timestamp}}</a></td>
|
||||||
|
<td>{{scrobble.media_type}}</td>
|
||||||
|
<td>{{scrobble.media_obj}}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user