Skip to content

Commit 845db78

Browse files
committed
Set video info even if there are errors
1 parent 9df8a8b commit 845db78

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

app/models/media_item.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,13 @@ def fill_missing_details
6666
self.url = video.url
6767
end
6868

69-
if success || (created_at && created_at < 1.week.ago)
70-
self.reachable = success
71-
self.author = info["uploader"] || ''
72-
self.title = [feed&.title, info["title"]].select(&:present?).join(" - ")
73-
self.published_at = info["upload_date"] && Date.parse(info["upload_date"])
74-
self.description = "Original Video: #{url}\nPublished At: #{published_at}\n #{info["description"]}"
75-
self.duration_seconds = info["duration"] || 0
76-
self.thumbnail_url = info["thumbnails"]&.last&.fetch("url", "") || ''
77-
end
69+
self.reachable = success
70+
self.author = info["uploader"] || ''
71+
self.title = [info["is_live"] && "[LIVE]", feed&.title, info["title"]].select(&:present?).join(" - ")
72+
self.published_at = info["upload_date"] && Date.parse(info["upload_date"])
73+
self.description = "Original Video: #{url}\nPublished At: #{published_at}\n #{info["description"]}"
74+
self.duration_seconds = info["duration"]
75+
self.thumbnail_url = info["thumbnails"]&.last&.fetch("url", "") || ''
7876
end
7977
save!
8078
end

0 commit comments

Comments
 (0)