This commit is contained in:
Sami Hindi committed 2026-03-01 21:34:57 +01:00
commit 978e3b6dd6
2 files changed
+12 -9

No files matched your search

+4 -5
View File
@@ -85,11 +85,11 @@ class Twitter:
bot.get("https://x.com/compose/post")
post_content: str = self.generate_post()
post_content: str = text if text is not None else self.generate_post()
now: datetime = datetime.now()
print(colored(" => Posting to Twitter:", "blue"), post_content[:30] + "...")
body = post_content if text is None else text
body = post_content
text_box = None
text_box_selectors = [
@@ -112,6 +112,7 @@ class Twitter:
"Could not find tweet text box. Ensure you are logged into X in this Firefox profile."
)
post_button = None
post_button_selectors = [
(By.XPATH, "//button[@data-testid='tweetButtonInline']"),
@@ -135,9 +136,7 @@ class Twitter:
time.sleep(2)
# Add the post to the cache
self.add_post(
{"content": post_content, "date": now.strftime("%m/%d/%Y, %H:%M:%S")}
)
self.add_post({"content": body, "date": now.strftime("%m/%d/%Y, %H:%M:%S")})
success("Posted to Twitter successfully!")
+8 -4
View File
@@ -80,8 +80,14 @@ def fetch_songs() -> None:
if get_verbose():
info(f" => Created directory: {files_dir}")
else:
# Skip if songs are already downloaded
return
existing_audio_files = [
name
for name in os.listdir(files_dir)
if os.path.isfile(os.path.join(files_dir, name))
and name.lower().endswith((".mp3", ".wav", ".m4a", ".aac", ".ogg"))
]
if len(existing_audio_files) > 0:
return
configured_url = get_zip_url().strip()
download_urls = [configured_url] if configured_url else []
@@ -144,5 +150,3 @@ def choose_random_song() -> str:
except Exception as e:
error(f"Error occurred while choosing random song: {str(e)}")
raise
raise RuntimeError("Failed to choose a random song")