Datasets:
mimizukari
commited on
Gave search functionality.
Browse filesType part of what's in the character description to get that character or a random thing with that element. e.g. zero two (d will return zero two from darling in the franxx. "black shirt" will return something with black shirt and so on.
- randumbizer.py +13 -8
randumbizer.py
CHANGED
@@ -4,10 +4,19 @@ import pyperclip
|
|
4 |
def read_random_lines(artist_file="artist.txt", sheet_file="Sheet1.txt"):
|
5 |
with open(artist_file, "r") as artist, open(sheet_file, "r") as sheet:
|
6 |
artist_lines = artist.readlines()
|
7 |
-
sheet_lines = sheet.readlines()
|
|
|
|
|
8 |
|
9 |
while True:
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
splits = sheet_line.split(", ")
|
13 |
if splits[0] in ["1girl", "1boy", "1other"]:
|
@@ -22,17 +31,13 @@ def read_random_lines(artist_file="artist.txt", sheet_file="Sheet1.txt"):
|
|
22 |
artist_section = ", ".join(line.strip() for line in selected_artist_lines)
|
23 |
post_artists = ", ".join(splits[insertion_index:])
|
24 |
|
25 |
-
if post_artists
|
26 |
-
result = f"{pre_artists}, {artist_section}, {post_artists}"
|
27 |
-
else:
|
28 |
-
result = f"{pre_artists}, {artist_section}"
|
29 |
-
|
30 |
result = result.rstrip(", ")
|
31 |
|
32 |
print(result)
|
33 |
pyperclip.copy(result)
|
34 |
print("\nContent copied to clipboard.")
|
35 |
|
36 |
-
input("\nPress Enter
|
37 |
|
38 |
read_random_lines()
|
|
|
4 |
def read_random_lines(artist_file="artist.txt", sheet_file="Sheet1.txt"):
|
5 |
with open(artist_file, "r") as artist, open(sheet_file, "r") as sheet:
|
6 |
artist_lines = artist.readlines()
|
7 |
+
sheet_lines = [line.strip() for line in sheet.readlines()]
|
8 |
+
|
9 |
+
user_input = ""
|
10 |
|
11 |
while True:
|
12 |
+
if user_input:
|
13 |
+
matching_lines = [line for line in sheet_lines if user_input in line]
|
14 |
+
if matching_lines:
|
15 |
+
sheet_line = random.choice(matching_lines)
|
16 |
+
else:
|
17 |
+
sheet_line = random.choice(sheet_lines)
|
18 |
+
else:
|
19 |
+
sheet_line = random.choice(sheet_lines)
|
20 |
|
21 |
splits = sheet_line.split(", ")
|
22 |
if splits[0] in ["1girl", "1boy", "1other"]:
|
|
|
31 |
artist_section = ", ".join(line.strip() for line in selected_artist_lines)
|
32 |
post_artists = ", ".join(splits[insertion_index:])
|
33 |
|
34 |
+
result = f"{pre_artists}, {artist_section}, {post_artists}" if post_artists else f"{pre_artists}, {artist_section}"
|
|
|
|
|
|
|
|
|
35 |
result = result.rstrip(", ")
|
36 |
|
37 |
print(result)
|
38 |
pyperclip.copy(result)
|
39 |
print("\nContent copied to clipboard.")
|
40 |
|
41 |
+
user_input = input("\nPress Enter for random or type search term...\n").strip()
|
42 |
|
43 |
read_random_lines()
|