#!/usr/bin/env python # # Dorky. generate my index.html because I'd rather maintain my # frequently-used links as columns instead of rows. # TDict = {} class entry: def __init__ ( self, str ): if str.find( '@' ) < 0: print "No @ in entry string (" + str + ")." self.name = str.strip() self.URL = "http://dal.i.am/" return parts = str.split( '@' ) if len(parts) > 2: raise "Too many @'s in entry string (" + str + ")." self.name = parts[0].strip() self.URL = parts[1].strip() no_entry = entry( "--@http://dal.i.am/" ) class COL: def __init__ ( self, head, strents ): self.head = head lines = strents.split( '\n' ) # print 'COL, lines:', lines self.ents = [] for line in lines: ls = line.strip() if len(ls) >= 3: self.ents.append( entry( ls ) ) class TABLE: def __init__ ( self, title, divitem, *coltuple ): self.title = title self.divitem = divitem # self.cols = list(coltuple) TDict[title] = self self.invert() def invert ( self ): """ Converts a list of cols into a list of rows ; each row is also a list, of entries. """ self.heads = [ c.head for c in self.cols ] self.rows = [] while 1: # Once per row, behead each col nr = [] got_any = 0 for c in self.cols: try: elem = c.ents.pop(0) got_any = 1 except IndexError: elem = no_entry nr.append( elem ) if got_any == 0: break self.rows.append( nr ) def as_HTML ( self ): # explicit is better than cryptic res = [ ' \n' ] for h in self.heads: res.append( '
%s
\n' % ( self.divitem, h ) ) res.append( ' \n' ) for r in self.rows: res.append( ' \n' ) for e in r: res.append( '
%s
\n' % ( self.divitem, e.URL, e.name ) ) res.append( ' \n' ) return ''.join( res ) TABLE( "Freq", "fq_ti", COL( "Toolbar+Misc", """ GIGO_cloud @http://radio.weblogs.com/0100945/ OnlineBkMarx @http://radio.weblogs.com/0100945/gems/inv/index_new.html zia (PyCS) @http://www.pycs.net/zia/ MyGotNet @http://got.net/~landauer/ Auto-added @Additions.html New index? @index_new.html """ ), COL( "Bo-M", """ camworld @http://www.camworld.com/ leslie "0xdecafbad" orchard @http://www.decafbad.com/ Jer "Zone" Halstead @http://jerryrig.com/log/ Mitch "Chandler" Kapor @http://blogs.osafoundation.org/mitch/ Krzysztof Kowalczyk @http://blog.kowalczyk.info/ David McCusker @http://www.treedragon.com/ged/map/ti/new.htm """ ), COL( "P-S", """ Tony Pierce @http://www.tonypierce.com/blog/bloggy.htm Doc Searls @http://doc.weblogs.com/ Paul dejaVu Snively @http://radio.weblogs.com/0100136/ Joel Spolsky @http://www.joelonsoftware.com """ ), COL( "T-W", """ Roland Tanglao @http://www.rolandTanglao.com/ Jon Udell @http://radio.weblogs.com/0100887/ Dave Winer @http://www.scripting.com/ John "lemonodor" Wiseman @http://lemonodor.com """ ), COL( "Python-1", """ Daily Python-URL @http://www.pythonware.com/daily/ Mark Pilgrim @http://diveintomark.org/ Tony Bowden @http://www.tmtm.com/insanity/ Simon Brunning @ http://www.brunningonline.net/simon/blog/ Bill Bumgartner @http://radio.weblogs.com/0100490/ Joey "HappyGeek" deVilla @http://www.kode-fu.com/geek/ """ ), COL( "Python-2", """ "Slingshot" Johnson @http://radio.weblogs.com/0100215/ Garth "DBS" Kidd @http://www.deadlybloodyserious.com/ Joseph hoarfrost Kocherhans @http://radio.weblogs.com/0103820/ Andrew Kuchling @http://www.amk.ca/diary/ Patrick Logan @http://patricklogan.blogspot.com/ Hans Nowak @http://www.zephyrfalcon.org/weblog/ """ ), COL( "Python-3", """ Juri Pakaste @http://www.iki.fi/juri/blog/ Mark Paschal @http://markpasc.org/blog/ Phil "second pOst" Pearson @http://blogs.salon.com/0000002/ Paul Prescod @http://www.blogstream.com/pauls/ Jeffrey P "toulouse" Shell @http://toulouse.amber.org/ Jarno "owns us" Virtanen @http://pythonowns.blogspot.com/ """ ) ) # END_TABLE freq TABLE( "Progs", "progs_ti", COL( "PgmLangs", """ LambdaWeblog @http://lambda.weblogs.com/ Joe Gregorio @http://bitworking.org/ Richard "strongly" Caetano @http://www.stronglytyped.com/ Steve "Salad" Jenson @http://saladwithsteve.com/ marc slam barrot @http://radio.weblogs.com/0104487 """ ), COL( "Java", """ Russell "in Spain" Beattie @http://www.russellbeattie.com/notebook/ Rickard "random thoughts" \xc3\x96berg @http://roller.anthonyeden.com/page/rickard/ rebelutionary (Radio 7789) @http://radio.weblogs.com/0107789/ bob "werken" mcwhirter @http://blogs.werken.com/people/bob/ Joe Walnes "Joe's Jelly" @http://radio.weblogs.com/0108103/ The Desktop Fishbowl @http://fishbowl.pastiche.org/ java.blogs @http://www.javablogs.com Jakarta @http://jakarta.apache.org """ ), COL( "OpenSource", """ raph @http://www.advogato.org/person/raph/ graydon @http://www.advogato.org/person/graydon/ ESR @http://armedndangerous.blogspot.com/ """ ), COL( "Radio", """ Dave Winer @http://www.scripting.com/ Brent "inessential" Simmons @http://inessential.com/ Lawrence Lee's notebook @http://radio.weblogs.com/0001013/ Simon Fell @http://www.pocketsoap.com/weblog RadioDiscuss @http://radio.userland.com/discuss/ """ ), COL( "Web etc", """ A.K.M. Adam @http://akma.disseminary.org/ Kevin "peerfear" Burton @http://www.peerfear.org/ Peter "Me"rholtz @http://www.peterme.com/ Jonathan Peterson @http://way.nu Phil Ringnalda @http://www.philringnalda.com/ David "JOHO" Weinberger @http://www.hyperorg.com/blogger/ Phil "a klog apart" Wolff @http://www.dijest.com/aka/ """ ), COL( "Mac", """ MacSlash @http://www.macslash.com/ Mac Net Journal @http://www.whiterabbits.com/MacNetJournal/ Mac OS X Hints @http://www.macosxhints.com/ Forwarding Addr: OSX @http://saladwithsteve.com/osx/ Ken Bereskin @http://radio.weblogs.com/0100676/ Patrick Beard @http://radio.weblogs.com/0102607/ Steve Zellers @http://radio.weblogs.com/0100012/ """ ), COL( "DotNet_MS", """ Peter Drayton @http://www.razorsoft.net/weblog/ John iunknown Lam @http://www.iunknown.com/ Ingo Rammer @http://www.dotnetremoting.cc/DotNetCentric/ Ken "Tachy" Rawlings @http://radio.weblogs.com/0101156 tomas restrepo @http://www.winterdom.com/weblog/ Sam Ruby @http://www.intertwingly.net/ """ ) ) # END_TABLE Progs TABLE( "Weblogs", "blogs_ti", COL( "MultiBlogs I", """ daypop @http://www.daypop.com/top/ blogdex @http://blogdex.media.mit.edu/ blo.gs @http://blo.gs RadioRanx @http://www.weblogs.com/rankingsByPageReads.html SalonRanx @http://blogs.salon.com/rankings.html PyCS Ranx @http://www.pycs.net/system/rankings.py global weblogs.com @http://www.weblogs.com/ """ ), COL( "MultiBlogs II", """ advogato @http://www.advogato.org/ AlterSlash @http://www.alterslash.org/ Boing Boing @http://boingboing.net/ kuro5hin @http://www.kuro5hin.org/ memepool @http://www.memepool.com/ metafilter @http://www.metafilter.com/ SATN @http://www.satn.org/ """ ), COL( "Blogs_MAIN", """ camworld @http://www.camworld.com/ BotWiz @http://www.robotwisdom.com/ Portage "Stuff Worth Saving" @http://helloha.blogspot.com/ dangerousmeta @http://www.dangerousmeta.com// Tomalak's Realm @http://www.tomalak.org/ fury @http://www.fury.com/ """ ), COL( "Just great writers", """ burningbird @http://weblog.burningbird.net/ caveat lector @http://www.yarinareth.net/caveatlector/ F-Train @http://www.ftrain.com/ Lileks @http://www.lileks.com/bleats/ oblivio @http://www.oblivio.com/ The Morning News @http://www.themorningnews.org/ """ ), COL( "Blogs_Unsorted", """ Arts and Farces @http://www.farces.com/ Ned Batchelder @http://www.nedbatchelder.com/blog/ Anil Dash @http://www.dashes.com/anil/ Defective Yeti @http://www.defectiveyeti.com/ Diego "spaces" Doval @http://www.dynamicobjects.com/~diego/weblogs/arf/ Rael Dornfest @http://www.oreillynet.com/~rael/ graham glass @http://radio.weblogs.com/0109134/ """ ), COL( "Blogs_Unsorted", """ Peter "Tesugen" Lindberg @http://tesugen.com/ Michael "CS PhD OSX" McC @http://disco.ucsd.edu/blog Brett Morganzilla @http://radio.weblogs.com/0109827/ Snappy the clam @http://www.panix.com/~jbm/snappy/ Michal "Sabren" Wallace @http://withoutane.com/ Jamie "Xemacs DNA" Zawinski @http://jwz.livejournal.com/ Jeremy Zawodny @http://jeremy.zawodny.com/blog/ """ ) ) # END_TABLE Weblogs TABLE( "Misc", "misc_ti", COL( "Useful", """ Color_5k_Visual @http://entries.the5k.org/171/visualizer.html tinyurl @http://tinyurl.com/ ShorterLinks @http://shorterlink.com/ MakeShorterLink @http://makeashorterlink.com/ """ ), COL( "Comix", """ freefall @http://freefall.purrsia.com/ Achewood @http://www.achewood.com/ Sinfest @http://www.sinfest.net/ Liberty Meadows (reruns) @http://www.comics.com/creators/liberty/index.html Pearls before Reruns @http://www.unitedmedia.com/comics/pearls/ """ ), COL( "RealNews", """ CNN @http://www.cnn.com/ """ ), COL( "Music", """ KPIG @http://www.kpig.com/ """ ) ) # END_TABLE TABLE( "MySites", "my_ti", COL( "Radio_ON", """ GIGO_desktop @http://127.0.0.1:5335/ Radio Desktop @http://127.0.0.1:5335/ News Aggr @http://127.0.0.1:5335/system/pages/news Local weblogs.com @http://127.0.0.1:5335/system/pages/weblogsCom Radio Events @http://127.0.0.1:5335/system/pages/eventsLog """ ), COL( "My pointers", """ GIGO my RUWL @http://radio.weblogs.com/0100945/ my cloud @http://radio.weblogs.com/0100945/ dal.i.am @http://dal.i.am/ tmp.i.am @http://tmp.i.am/ my mac.com @http://homepage.mac.com/landauer/ """ ), COL( "gnLocal", """ gotNet local @http://127.0.0.1:5335/gotNet/ gnLoc bp @http://127.0.0.1:5335/gotNet/bp/ gnLoc cs @http://127.0.0.1:5335/gotNet/cs/ gnLoc etc @http://127.0.0.1:5335/gotNet/etc/ gnLoc lists @http://127.0.0.1:5335/gotNet/lists/ gnLoc mtb @http://127.0.0.1:5335/gotNet/mtb/ gnLoc tmp @http://127.0.0.1:5335/gotNet/tmp/ """ ), COL( "gnRemote", """ gotNet remote @http://got.net/~landauer/ gnLive bp @http://got.net/~landauer/bp/ gnLive cs @http://got.net/~landauer/cs/ gnLive etc @http://got.net/~landauer/etc/ gnLive lists @http://got.net/~landauer/lists/ gnLive mtb @http://got.net/~landauer/mtb/ gnLive tmp @http://got.net/~landauer/tmp/ """ ) ) # END_TABLE MySites """ Comments? Like ... Ken "Tachy" Rawlings ( http://radio.weblogs.com/0101156 ) wrote Tachy, a scheme-like skin for the MS C#/CLR.NET thing. And "the Jer Zone" ( http://jerryrig.com/log/ ) Jer is a Mac OS X user, takes some good photos """ def subst ( instr ): in_lst = instr.split('@') for ix in range(len(in_lst)): tnm = in_lst[ix] if len( tnm ) < 12: # It's a name. Substitute the corresponding table. in_lst[ix] = TDict[ tnm ].as_HTML( ) return ''.join( in_lst ) def main ( ): f = open( "index.template" ) ixt = f.read() f.close() out = subst( ixt ) fw = open( "index_new.html", "w" ) fw.write( out ) fw.close() main()