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