import datetime, os, re from bottle import error, response, route, run, static_file, template, TEMPLATE_PATH def find_gallery(name): gal = [name] if name == "Abbey": gal.append([["dragon.png","Abbey laying on his back, wrapped in furs"], ["FlightRising.png","Abbey's sprite from FlightRising, wearing Fig Plumes, a Squire's Beret, Chestnut Feathers, and Amber Flourishes"]]) if name == "Aloin": gal.append([["alchemy.png","Morning alchemy before work"],["dream.jpg","Stupid dream bubbles"]]) if name == "Angel": gal.append([["Chibipixel.png","One of Angel's sprites. I prefer taller, less cartoony sprites, but this style is so popular it was worth trying."],["girls.png","Angel, Chloe, and Tessa"]]) if name == "Aristen": gal.append([["menu.jpg","Aristen's fancy set with bright colors and an obi belt"], ["scarf.jpg", "Newbie Aristen with her orange scarf"], ["marine.jpg","Aristen in the Epheria Marine Classic Set, a goofy marine pinup costume."]]) if name == "Calder": gal.append([["pixelheadshot.png", "Calder's human form headshot"], ["FlightRising.png","Calder\'s sprite in FlightRising. He's wearing Sanguine Roses, Sanguine Plumage, and Pomegranate Plumes over Stonewatch Harpy."]]) if name == "Chloe": gal.append([["girls.png","Angel, Chloe, and Tessa"]]) if name == "Fifi": gal.append([["mirrorofvenus.jpg","Fifi debating herself in the mirror"],["guitarpractice.jpg","Fifi seeing how her old guitar sounds"]]) if name == "Helia": gal.append([["wm.png","Crop from a larger work-in-progress...so busy I can't draw everything I want to draw ahhh"],["Headshot.png","Helia in the style of Battle Girl High School...or at I tried! All the girls in that game wear their blush so high it's practically eyeshadow. It looks so innocent and vivacious on them, but it never comes out them same when I try to wear it myself."]]) if name == "Lune": gal.append([["RingOfFire.jpg","A painting of Lune in the Ring of Fire in her Vabbian"],["HallOfMonuments.png","My Guild Wars Necromancer showing off her Hall of Monuments"],["PhariseeFlying.jpg","My Aion Elysian Spiritmaster with really pretty hair"],["ArcheageGuild.jpg","My ArcheAge dwarf ghost girl with gold-dipped hair and a frilly gown, sitting among her old guildmates"]]) if name == "Rune": gal.append([["Bless+Rune.png","Rune and his dinosaur mother"],["Blessfrey.png","I saw the coverart for Elden Gate and tried to make my own coverart like that. It's rough, torn between pencil, digital painting, and pixelart, but I don't feel like working on it anymore."],["RuneHeadshot.png","Rune in the Battle Girl High School style, though there aren't a lot of guys in that game to reference"]]) if name == "Silke": gal.append([["Silke.png","Pixelart of Silke on the floor with her clipboard, wearing a striped green silk dress with an oversized pink tulle bow behind her bun. I tried to draw in Yuu Watase's style"],["Verpets.png","Silke's sprite from Verpets"]]) if name == "Tessa": gal.append([["Tessa.png","Pixelart of Tessa in athletic wear"],["girls.png","Angel, Chloe, and Tessa"]]) if name == "WISE": gal.append([["WISE.png","WISE processing a query"],["CityOfHeroes.png","I made WISE in City of Heroes, too. She's an Electric/Empathy Controller."]]) return gal def prepare_profile(loc, char_name): string = "" with open(loc + char_name) as f: lines = f.readlines() for line in lines: string += line return string def find_year(): now = datetime.datetime.now() return now.strftime('%Y') ## Static ## # Serve CSS @route('/static/css/') def serve_css(filename): return static_file(filename, root='static/css') # Serve images @route('/static/img/') def serve_img(filename): return static_file(filename, root='static/img') # Serve XML @route('/static/xml/') def serve_xml(filename): return static_file(filename, root='static/xml', mimetype='text/xml') ## Routes ## # Error Page @error(404) def error404(error): return "unfortunately, a 404 error. the page you're searching for doesn't exist. (or is it just in hiding?) try another page! " @error(500) def error500(error): return "unfortunately, a 500 error. something is wrong with the page you're trying to find, if it exists at all. try another page! return to blessfrey.me." @error(502) def error502(error): return "unfortunately, a 502 error. this was likely due to website maintenance. usually it'll be back up before you finish reading this, but otherwise, I'll notice something's wrong soon! return to blessfrey.me." @route('/char/') def char(char_name): """character page""" loc = 'char/' info = {'css': 'char', 'title': 'blessfrey - meet ' + char_name, 'year': find_year(), 'profile': prepare_profile(loc, char_name), 'gallery': find_gallery(char_name)} abs_app_dir_path = os.path.dirname(os.path.realpath(__file__)) abs_views_path = os.path.join(abs_app_dir_path, 'views') TEMPLATE_PATH.insert(0, abs_views_path ) return template(os.path.join(abs_views_path,'char.tpl'), info) # Blessfrey Demo Page @route('/demo') def demo(): """demo""" info = {'css': 'demo', 'title': 'blessfrey demo', 'year': find_year()} return template('demo.tpl', info) # Fashion Page @route('/diary') def diary(): """diary""" info = {'css': 'diary', 'title': 'chimchooree\'s diary', 'year': find_year()} return template('diary.tpl', info) # Fashion Page @route('/fashion') def fashion(): """fashion""" info = {'css': 'fashion', 'title': 'blessfrey fashion', 'year': find_year()} return template('fashion.tpl', info) # Home Page - Index Template @route('/') def home(): """home""" info = {'css': 'index', 'title': 'chimchooree\'s dev space - blessfrey', 'year': find_year(), 'news':[["link","website update"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"],["link2","about blessfrey rpg"]]} #list_headlines(sort_files(gather_files(loc))[0:10])} return template('index.tpl', info) # Me Page @route('/me') def me(): """me""" info = {'css': 'me', 'title': 'about me', 'year': find_year(), 'chars': ["Helia", "Angel", "Rune", "Tessa", "WISE", "Silke", "Calder", "Aloin", "Fifi", "Lune", "Aristen"]} return template('me.tpl', info) ## Main ## if __name__ == '__main__': run(host='127.0.0.1', port=9001)