1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added confirmation prompt to random generation

This commit is contained in:
krateng 2022-03-29 18:09:39 +02:00
parent 3108b368ef
commit 5d582d39aa
2 changed files with 11 additions and 10 deletions

View File

@ -11,8 +11,6 @@ def loadexternal(filename):
print("File could not be found.")
return
print("Please wait...")
from .importer import import_scrobbles
imported,failed,warning = import_scrobbles(filename)
print("Successfully imported",imported,"scrobbles!")

View File

@ -1,5 +1,6 @@
import random
import datetime
from doreah.io import ask
artists = [
"Chou Tzuyu","Jennie Kim","Kim Seolhyun","Nancy McDonie","Park Junghwa","Hirai Momo","Rosé Park","Laura Brehm","HyunA",
@ -65,12 +66,14 @@ def generate_track():
def generate(targetfile):
with open(targetfile,"a") as fd:
for _ in range(200):
track = generate_track()
for _ in range(random.randint(1, 50)):
timestamp = random.randint(1, int(datetime.datetime.now().timestamp()))
if ask("Generate random scrobbles?",default=False):
with open(targetfile,"a") as fd:
for _ in range(200):
track = generate_track()
for _ in range(random.randint(1, 50)):
timestamp = random.randint(1, int(datetime.datetime.now().timestamp()))
entry = "\t".join([str(timestamp),"".join(track['artists']),track['title'],"-"])
fd.write(entry)
fd.write("\n")
entry = "\t".join([str(timestamp),"".join(track['artists']),track['title'],"-"])
fd.write(entry)
fd.write("\n")
print("Done!")