|
import random
|
|
import pyperclip
|
|
|
|
def read_random_lines(artist_file="artist.txt", sheet_file="Sheet1.txt"):
|
|
with open(artist_file, "r") as artist, open(sheet_file, "r") as sheet:
|
|
artist_lines = artist.readlines()
|
|
sheet_lines = sheet.readlines()
|
|
|
|
while True:
|
|
sheet_line = random.choice(sheet_lines).strip()
|
|
|
|
splits = sheet_line.split(", ")
|
|
if splits[0] in ["1girl", "1boy", "1other"]:
|
|
insertion_index = 3
|
|
else:
|
|
insertion_index = 2
|
|
|
|
num_artist_lines = random.randint(1, 4)
|
|
selected_artist_lines = random.sample(artist_lines, num_artist_lines)
|
|
|
|
pre_artists = ", ".join(splits[:insertion_index])
|
|
artist_section = ", ".join(line.strip() for line in selected_artist_lines)
|
|
post_artists = ", ".join(splits[insertion_index:])
|
|
|
|
if post_artists:
|
|
result = f"{pre_artists}, {artist_section}, {post_artists}"
|
|
else:
|
|
result = f"{pre_artists}, {artist_section}"
|
|
|
|
result = result.rstrip(", ")
|
|
|
|
print(result)
|
|
pyperclip.copy(result)
|
|
print("\nContent copied to clipboard.")
|
|
|
|
input("\nPress Enter to get more lines...\n")
|
|
|
|
read_random_lines() |