Skip to content

Commit

Permalink
fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunsi committed Jan 4, 2025
1 parent 5e5b8a0 commit 15ad92c
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 88 deletions.
6 changes: 3 additions & 3 deletions voctopublish/api_client/mastodon_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ def send_toot(ticket, config):
)
toot = mastodon.status_post(
message,
language="en", # announcements are always in english
language="en", # announcements are always in english
)
LOG.debug(toot)
return {
'id': toot['id'],
'uri': toot['uri'],
"id": toot["id"],
"uri": toot["uri"],
}
except Exception as e_:
# we don't care if tooting fails here.
Expand Down
24 changes: 20 additions & 4 deletions voctopublish/api_client/voctoweb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,26 @@ def create_or_update_event(self):
"subtitle": self.t.subtitle,
"link": event_url,
"original_language": self.t.languages[0],
"thumb_filename": (self.t.voctoweb_filename_base + ".jpg") if self.t.voctoweb_filename_base else "",
"poster_filename": (self.t.voctoweb_filename_base + "_preview.jpg") if self.t.voctoweb_filename_base else "",
"timeline_filename": (self.t.voctoweb_filename_base + ".timeline.jpg") if self.t.voctoweb_filename_base else "",
"thumbnails_filename": (self.t.voctoweb_filename_base + ".thumbnails.vtt") if self.t.voctoweb_filename_base else "",
"thumb_filename": (
(self.t.voctoweb_filename_base + ".jpg")
if self.t.voctoweb_filename_base
else ""
),
"poster_filename": (
(self.t.voctoweb_filename_base + "_preview.jpg")
if self.t.voctoweb_filename_base
else ""
),
"timeline_filename": (
(self.t.voctoweb_filename_base + ".timeline.jpg")
if self.t.voctoweb_filename_base
else ""
),
"thumbnails_filename": (
(self.t.voctoweb_filename_base + ".thumbnails.vtt")
if self.t.voctoweb_filename_base
else ""
),
"description": "\n\n".join(description),
"date": self.t.date,
"persons": self.t.people,
Expand Down
15 changes: 11 additions & 4 deletions voctopublish/api_client/youtube_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ def upload(self, file, lang):
if error_from_youtube:
exception_message.append(error_from_youtube)
else:
exception_message.append(f"Video creation failed with http status code {r.status_code}")
exception_message.append(
f"Video creation failed with http status code {r.status_code}"
)
exception_message.append(r.text)
exception_message.append(json.dumps(metadata, indent=2))

Expand Down Expand Up @@ -458,7 +460,9 @@ def _replace_language_placeholders(self, string, lang):
translation = self.translation_strings[lang]
language_name = self.lang_map[lang]
else:
raise YouTubeException("language not defined in translation strings, got")
raise YouTubeException(
"language not defined in translation strings, got"
)

return (
string.replace("${translation}", translation)
Expand Down Expand Up @@ -563,7 +567,9 @@ def update_metadata(self, video_id, metadata):
if error_from_youtube:
exception_message.append(error_from_youtube)
else:
exception_message.append(f"Video update failed with http status code {r.status_code}")
exception_message.append(
f"Video update failed with http status code {r.status_code}"
)
exception_message.append(r.text)
exception_message.append(json.dumps(metadata, indent=2))

Expand Down Expand Up @@ -748,7 +754,8 @@ def get_fresh_token(refresh_token: str, client_id: str, client_secret: str):
data = r.json()
if "access_token" not in data:
raise YouTubeException(
"fetching a fresh authToken did not return a access_token\n\n%s" % r.text
"fetching a fresh authToken did not return a access_token\n\n%s"
% r.text
)

LOG.info("successfully fetched Access-Token %s" % data["access_token"])
Expand Down
Loading

0 comments on commit 15ad92c

Please sign in to comment.