scalzi.html
001|
002| from sys import argv
003| from os import path
004| import datetime as dttm
005| from facts import MonthNames
006|
007|
008| BasePath = r'C:\CJS\prj\Python\ws'
009|
010| ScalziWorks = {
011| "Old Man's War universe": [
012| ("Old Man's War", "2005"),
013| ("Questions for a Soldier", "December 2005"),
014| ("The Ghost Brigades", "February 2006"),
015| ("The Sagan Diary", "February 2007"),
016| ("The Last Colony", "April 2007"),
017| ("Zoe's Tale", "August 2008"),
018| ("After the Coup", "July 2008"),
019| ("The Human Division", "May 2013"),
020| ("The End of All Things", "August 2015"),
021| ("The Shattering Peace", "September 2025"),
022| ],
023| "The Android's Dream universe": [
024| ("The Android's Dream", "October 2006"),
025| ("Judge Sn Goes Golfing", "December 2009"),
026| ],
027| "Lock In universe": [
028| ("Unlocked: An Oral History of Haden's Syndrome", "May 2014"),
029| ("Lock In", "August 2014"),
030| ("Head On", "April 2018"),
031| ],
032| "The Interdependency series": [
033| ("The Collapsing Empire", "March 2017"),
034| ("The Consuming Fire", "October 2018"),
035| ("The Last Emperox", "April 2020"),
036| ],
037| "The Dispatcher series": [
038| ("The Dispatcher", "October 2016"),
039| ("Murder by Other Means", "September 2020"),
040| ("Travel by Bullet", "September 2022"),
041| ],
042| "Stand-alone Novels": [
043| ("Agent to the Stars", "2005"),
044| ("Fuzzy Nation", "May 2011"),
045| ("Redshirts", "June 2012"),
046| ("The Kaiju Preservation Society", "March 2022"),
047| ("Starter Villain", "September 2023"),
048| ("When the Moon Hits Your Eye", "March 2025"),
049| ("Monsters of Ohio", "November 2026"),
050| ],
051| "Stand-alone novellas and novelettes": [
052| ("The God Engines", "December 2009"),
053| ("Constituent Service", "October 2024"),
054| ],
055| "Stand-alone Short Stories": [
056| ("Alien Animal Encounters", "October 2001"),
057| ("New Directives for Employee-Manxtse Interactions", "2005"),
058| ("Missives from Possible Futures #1: Alternate History Search Results", "February 2007"),
059| ("How I Proposed to My Wife: An Alien Sex Story", "2007"),
060| ("Pluto Tells All", "May 2007"),
061| ("Utere nihil non extra quiritationem suis", "2008"),
062| ("Denise Jones, Superbooker", "September 2008"),
063| ("The Tale of the Wicked", "June 2009"),
064| ("The President's Brain is Missing", "July 2010"),
065| ("An Election", "November 2010"),
066| ("The Shadow War of the Night Dragons", "April 2011"),
067| ("The Other Large Thing", "August 2011"),
068| ("Muse of Fire", "September 2013"),
069| ("Miniatures: The Very Short Fiction of John Scalzi", "December 2016"),
070| ("A Very Scalzi Christmas", "November 2019"),
071| ("3 Days, 9 Months, 27 Years", "2025"),
072| ],
073| "Stand-alone Nonfiction": [
074| ("The Rough Guide to Money Online", "October 2000"),
075| ("The Rough Guide to the Universe", "May 2003"),
076| ("Book of the Dumb", "November 2003"),
077| ("Book of the Dumb 2", "November 2004"),
078| ("The Rough Guide to Sci-Fi Movies", "October 2005"),
079| ("You're Not Fooling Anyone When You Take Your Laptop to a Coffee Shop: Scalzi on Writing", "2007"),
080| ("Your Hate Mail Will Be Graded: Selected Writing, 1998–2008", "2008"),
081| ("The Mallet of Loving Correction", "2013"),
082| ("Don't Live For Your Obituary: Advice, Commentary and Personal Observations on Writing, 2008–2017", "2017"),
083| ],
084| "Editor": [
085| ("Subterranean Magazine, #4", "2006"),
086| ("METAtropolis", "2008"),
087| ],
088| }
089|
090|
091| def dump_scalzi_bibleography ():
092| """List the data in ScalziWorks."""
093|
094| for category in ScalziWorks:
095| print(category)
096| for title,pubdate in ScalziWorks[category]:
097| print(title, pubdate)
098| print()
099| print()
100|
101|
102|
103| def process_scalzi_works ():
104| """Process ScalziWorks to sort by date."""
105| out = []
106|
107| for category in ScalziWorks:
108| print(category)
109|
110| for title,pubdate in ScalziWorks[category]:
111| parts = pubdate.partition(" ")
112| if parts[1]:
113| yr = int(parts[2])
114| mn = MonthNames.index(parts[0])
115| else:
116| yr = int(parts[0])
117| mn = 1
118| dt = dttm.date(yr, mn, 1)
119| out.append((dt, title, category))
120| print()
121|
122| return out
123|
124|
125|
126|
127| def main (*args):
128| """Module main function."""
129|
130|
131| data = process_scalzi_works()
132|
133| fn = path.join(BasePath, 'scalzi.out')
134| fp = open(fn, mode='w', encoding='utf-8')
135| try:
136|
137| print('John Scalzi Books, Novels, and Short Stories', file=fp)
138| print('--------------------------------------------', file=fp)
139| print(file=fp)
140|
141| print('BY TYPE:', file=fp)
142| print('--------', file=fp)
143| for category in ScalziWorks:
144| print(f'[{category}]', file=fp)
145| for title,pubdate in ScalziWorks[category]:
146| print(f' {title} ({pubdate})', file=fp)
147| print(file=fp)
148| print(file=fp)
149|
150| print('='*80, file=fp)
151| print('BY TITLE:', file=fp)
152| print('---------', file=fp)
153| for dt,ttl,cat in sorted(data, key=lambda t:t[1]):
154| print(f'{ttl} ({dt:%Y}) [{cat}]', file=fp)
155| print(file=fp)
156|
157| print('='*80, file=fp)
158| print('BY DATE:', file=fp)
159| print('--------', file=fp)
160| for dt,ttl,cat in sorted(data, key=lambda t:t[0]):
161| print(f'{dt:%Y (%b)}: {ttl} [{cat}]', file=fp)
162| print(file=fp)
163|
164| print('='*80, file=fp)
165| print(file=fp)
166|
167| except:
168| raise
169|
170| finally:
171| fp.close()
172|
173| return data
174|
175| if __name__ == "__main__":
176| print(f'running: {argv[0]}...')
177| print()
178| rv = main(*argv[1:])
179| print()
180|
181| """eof"""
182|