Datasets:
File size: 1,256 Bytes
caba9f1 1fdeb7b caba9f1 1fdeb7b 68a8b0d 1fdeb7b 68a8b0d 1fdeb7b 1316877 e950f46 1316877 e950f46 1316877 1fdeb7b caba9f1 1fdeb7b caba9f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
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() |