Fix: some edge cases for furraffinity creator imports
This commit is contained in:
parent
06b0df63f9
commit
b05ad89842
1 changed files with 10 additions and 1 deletions
|
@ -406,8 +406,10 @@ class TwitterImporter(BaseImporter):
|
||||||
|
|
||||||
post_instance.category.add(category_instance)
|
post_instance.category.add(category_instance)
|
||||||
|
|
||||||
|
# Link creator
|
||||||
if creator_instance:
|
if creator_instance:
|
||||||
post_instance.creator = creator_instance
|
post_instance.creator = creator_instance
|
||||||
|
post_instance.save()
|
||||||
|
|
||||||
post_instance.date_created = timezone.make_aware(
|
post_instance.date_created = timezone.make_aware(
|
||||||
datetime.strptime(data["date"], "%Y-%m-%d %H:%M:%S")
|
datetime.strptime(data["date"], "%Y-%m-%d %H:%M:%S")
|
||||||
|
@ -486,14 +488,20 @@ class FurAffinityImporter(BaseImporter):
|
||||||
|
|
||||||
def _process_creator(self, data, source_site_instance):
|
def _process_creator(self, data, source_site_instance):
|
||||||
"""Process creator data for FurAffinity."""
|
"""Process creator data for FurAffinity."""
|
||||||
|
# Use artist if available, otherwise fall back to user field
|
||||||
artist = data.get("artist", "")
|
artist = data.get("artist", "")
|
||||||
artist_url = data.get("artist_url", artist.lower())
|
artist_url = data.get("artist_url", artist.lower())
|
||||||
|
if not artist_url and "user" in data:
|
||||||
|
artist_url = data.get("user", "")
|
||||||
|
|
||||||
creator_instance, _ = CreatorModel.objects.get_or_create(
|
creator_instance, _ = CreatorModel.objects.get_or_create(
|
||||||
slug=artist_url, source_site=source_site_instance
|
slug=artist_url, source_site=source_site_instance
|
||||||
)
|
)
|
||||||
|
|
||||||
creator_instance.name = artist
|
if artist:
|
||||||
|
creator_instance.name = artist
|
||||||
|
else:
|
||||||
|
creator_instance.name = artist_url
|
||||||
creator_instance.creator_id = artist_url
|
creator_instance.creator_id = artist_url
|
||||||
|
|
||||||
# We don't have creator creation date in FurAffinity data
|
# We don't have creator creation date in FurAffinity data
|
||||||
|
@ -558,6 +566,7 @@ class FurAffinityImporter(BaseImporter):
|
||||||
# Link creator
|
# Link creator
|
||||||
if creator_instance:
|
if creator_instance:
|
||||||
post_instance.creator = creator_instance
|
post_instance.creator = creator_instance
|
||||||
|
post_instance.save()
|
||||||
|
|
||||||
# Set creation date
|
# Set creation date
|
||||||
if "date" in data:
|
if "date" in data:
|
||||||
|
|
Loading…
Add table
Reference in a new issue