[tasks] Actually get title consistently
This commit is contained in:
@ -31,6 +31,7 @@ from tasks.models import Task
|
||||
from videogames.howlongtobeat import lookup_game_from_hltb
|
||||
from videogames.models import VideoGame
|
||||
from videos.models import Video
|
||||
from tasks.utils import get_title_from_labels
|
||||
from webpages.models import WebPage
|
||||
|
||||
from vrobbler.apps.tasks.constants import (
|
||||
@ -414,21 +415,7 @@ def todoist_scrobble_task(
|
||||
stopped: bool = False,
|
||||
) -> Scrobble:
|
||||
|
||||
prefix = ""
|
||||
suffix = ""
|
||||
# TODO look up the user profile and instead of checking PREFIX/SUFFIX, check against
|
||||
# user.profile.task_context_tags which will result in context-based tag titles
|
||||
# We'd also have to migrate existing tasks to the new context based ones (maybe)
|
||||
for label in todoist_task["todoist_label_list"]:
|
||||
if label in TODOIST_TITLE_LABELS:
|
||||
title = label
|
||||
|
||||
if not prefix and suffix:
|
||||
logger.warning(
|
||||
"Missing a prefix and suffix tag for task",
|
||||
extra={"todoist_scrobble_task": todoist_task},
|
||||
)
|
||||
|
||||
title = get_title_from_labels(todoist_task.get("todoist_label_list", []))
|
||||
task = Task.find_or_create(title)
|
||||
|
||||
timestamp = pendulum.parse(todoist_task.get("updated_at", timezone.now()))
|
||||
@ -556,17 +543,8 @@ def emacs_scrobble_task(
|
||||
suffix = ""
|
||||
|
||||
source_id = task_data.get("source_id")
|
||||
for label in task_data.get("labels", []):
|
||||
if label in TODOIST_TITLE_LABELS:
|
||||
title = label
|
||||
title = get_title_from_labels(task_data.get("labels", []))
|
||||
|
||||
if not prefix and not suffix:
|
||||
logger.warning(
|
||||
"Missing a prefix and suffix tag for task",
|
||||
extra={"emacs_scrobble_task": task_data},
|
||||
)
|
||||
|
||||
title = " ".join([prefix.capitalize(), suffix.capitalize()])
|
||||
task = Task.find_or_create(title)
|
||||
|
||||
timestamp = pendulum.parse(task_data.get("updated_at", timezone.now()))
|
||||
|
||||
Reference in New Issue
Block a user