diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py
index c76ef84..4f93bd5 100644
--- a/vrobbler/apps/scrobbles/views.py
+++ b/vrobbler/apps/scrobbles/views.py
@@ -801,7 +801,7 @@ class ScrobbleDetailView(DetailView):
FormClass = self.get_form_class()
log = self.object.log or {}
- log["notes"] = self.object.logdata.notes_as_str()
+ log["notes"] = self.object.logdata.notes_as_str(separator="\n")
return FormClass(initial=log)
diff --git a/vrobbler/apps/tasks/models.py b/vrobbler/apps/tasks/models.py
index 0282c4d..6770de5 100644
--- a/vrobbler/apps/tasks/models.py
+++ b/vrobbler/apps/tasks/models.py
@@ -38,7 +38,7 @@ class TaskLogData(BaseLogData):
"todoist_project_id",
}
- def notes_as_str(self) -> str:
+ def notes_as_str(self, separator: str = " | ") -> str:
"""Return formatted notes with line breaks and no keys"""
labels_str = ""
if self.labels:
@@ -60,7 +60,34 @@ class TaskLogData(BaseLogData):
lines += note
if isinstance(note, str):
lines.append(note)
- return "\n".join(lines).encode("utf-8").decode("unicode_escape")
+ return separator.join(lines).encode("utf-8").decode("unicode_escape")
+
+ def notes_as_html(self) -> str:
+ if not self.notes:
+ return ""
+
+ notes = self.notes
+ if isinstance(notes, str):
+ notes = [notes]
+
+ html_notes = []
+ for note in notes:
+ if isinstance(note, dict):
+ timestamp, note_text = next(iter(note.items()))
+ note_text = " ".join(note_text.strip().split())
+ html_notes.append(
+ f'
{timestamp}: {note_text}
'
+ )
+ elif isinstance(note, str):
+ escaped = note.encode("utf-8").decode("unicode_escape")
+ for line in escaped.split("\n"):
+ if line.strip():
+ html_notes.append(f'{line}
')
+ elif isinstance(note, list):
+ for item in note:
+ if isinstance(item, str):
+ html_notes.append(f'{item}
')
+ return "".join(html_notes)
class Task(LongPlayScrobblableMixin):
diff --git a/vrobbler/templates/foods/food_detail.html b/vrobbler/templates/foods/food_detail.html
index 03e1a1d..c292559 100644
--- a/vrobbler/templates/foods/food_detail.html
+++ b/vrobbler/templates/foods/food_detail.html
@@ -34,7 +34,7 @@
| {{scrobble.local_timestamp}} |
{% if scrobble.logdata.calories %}{{scrobble.logdata.calories}}{% else %}{{scrobble.media_obj.calories}}{% endif %} |
- {% for note in scrobble.logdata.notes %}{{note}}{% if not forloop.last %}; {% endif%}{% endfor %}
+ | {{scrobble.logdata.notes_as_str|safe}} |
{% endfor %}
diff --git a/vrobbler/templates/lifeevents/lifeevent_detail.html b/vrobbler/templates/lifeevents/lifeevent_detail.html
index 63dbbb4..0c0baa5 100644
--- a/vrobbler/templates/lifeevents/lifeevent_detail.html
+++ b/vrobbler/templates/lifeevents/lifeevent_detail.html
@@ -37,7 +37,7 @@
| {{scrobble.local_timestamp}} |
{{scrobble.logdata.title}} |
- {{scrobble.logdata.notes_as_html|safe}} |
+ {{scrobble.logdata.notes_as_str|safe}} |
{{scrobble.source}} |
{% endfor %}
diff --git a/vrobbler/templates/locations/geolocation_detail.html b/vrobbler/templates/locations/geolocation_detail.html
index 2cc95d1..6d0a167 100644
--- a/vrobbler/templates/locations/geolocation_detail.html
+++ b/vrobbler/templates/locations/geolocation_detail.html
@@ -66,7 +66,7 @@
| {{scrobble.local_timestamp}} |
{% for person in scrobble.logdata.with_people%}{{person}}{% if not forloop.last %}, {% endif%}{% endfor %} |
- {% for note in scrobble.logdata.notes %}{{note}}{% if not forloop.last %}; {% endif%}{% endfor %}
+ | {{scrobble.logdata.notes_as_str|safe}} |
{% endfor %}
diff --git a/vrobbler/templates/scrobbles/scrobble_detail.html b/vrobbler/templates/scrobbles/scrobble_detail.html
index 7ee90d5..22770df 100644
--- a/vrobbler/templates/scrobbles/scrobble_detail.html
+++ b/vrobbler/templates/scrobbles/scrobble_detail.html
@@ -11,6 +11,7 @@
{{ object.media_obj }} - {{object.media_type}}
+
{{ object.local_timestamp }}
{% with notes_html=object.logdata.notes_as_html %}
{% if notes_html %}
@@ -27,8 +28,10 @@
Rate: {{object.logdata.avg_seconds_per_page}}s per page
{% endif %}
-
- Edit Log
+
+
-
+
Other Scrobbles of This Media
{% if related_scrobbles %}
diff --git a/vrobbler/templates/tasks/task_detail.html b/vrobbler/templates/tasks/task_detail.html
index a055b9f..fdc3333 100644
--- a/vrobbler/templates/tasks/task_detail.html
+++ b/vrobbler/templates/tasks/task_detail.html
@@ -64,7 +64,7 @@
| {{scrobble.local_timestamp}} |
{{scrobble.logdata.title}} |
- {{scrobble.logdata.notes_as_html|safe}} |
+ {{scrobble.logdata.notes_as_str|safe}} |
{{scrobble.source}} |
{% endfor %}