You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.5 KiB
Python

7 years ago
#!/usr/bin/env python3
import json, random, textwrap
2 years ago
import yaml
from urllib.request import urlopen
7 years ago
2 years ago
# with open('terms.json', 'r') as f:
# terms = json.load(f)
# with open('terms.yaml', 'r') as f:
# terms = yaml.load(f)
f = urlopen("https://pad.xpub.nl/p/XPUB-promo-terms/export/txt")
terms = yaml.load(f)
with open("terms.yaml", "w") as f:
yaml.dump(terms, f)
2 years ago
with open("terms.json", "w") as f:
json.dump(terms, f, indent=2)
7 years ago
def make_pub():
actor = random.choice(terms['actor'])
7 years ago
terms['actor'].remove(actor)
7 years ago
action = random.choice(terms['action'])
7 years ago
terms['action'].remove(action)
7 years ago
prefix = ''
sort = random.choice(terms['sort'])
7 years ago
terms['sort'].remove(sort)
7 years ago
media = random.choice(terms['media'])
7 years ago
terms['media'].remove(media)
7 years ago
if random.randint(0,2) == 0:
7 years ago
prefix = random.choice(terms['prefix'])
terms['prefix'].remove(prefix)
prefix += '-'
7 years ago
return actor + ' ' + action + ' ' + prefix + sort + ' ' + media
def make_call():
text = 'Calling all '
for _ in range(20):
text += make_pub() + ', '
text = text[:-2]
text += '.'
return text
7 years ago
call = '''
///
____ ____ ____ ____
||X |||P |||U |||B ||
||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|
7 years ago
Master of Arts in Fine Art and Design: Experimental Publishing
2 years ago
at the Piet Zwart Institute (Rotterdam, Netherlands
7 years ago
///
%s
///
Applications deadlines: March 7, 2023 (non-EU) and May 10, 2023 (EU)
Online open day: February 11, 2023
7 years ago
https://xpub.nl
///
''' % (textwrap.fill(make_call()))
print(call)