Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from os import listdir
- import operator
- def get_episode_info():
- ep_list = open("c:\ds9\eplist.txt").readlines()
- episodes = {}
- for episode in ep_list:
- spl = episode.split()
- number = int(spl[0])
- code = spl[1]
- season = code.split("-")[0]
- ep = code.split("-")[1]
- code = "S0" + season + "E" + ep
- airdate = spl[3]
- title = " ".join(spl[4:])
- episodes[400 + number] = [code, airdate, title]
- return episodes
- def get_top_lines(script, top_speakers):
- ds9script = open("c:/ds9/Scripts - DS9/" + script, "rU")
- dialog = {}
- for line in ds9script.readlines():
- if len(line) > 6:
- if line[:5] == "\t\t\t\t\t" and line[5] != "\t":
- char = line.strip()
- try:
- dialog[char] += 1
- except KeyError:
- dialog[char] = 1
- sorted_dialog = sorted(dialog.iteritems(), key=operator.itemgetter(1))
- sorted_dialog.reverse()
- return sorted_dialog[:top_speakers]
- episode_info = get_episode_info()
- scripts = listdir("c:/ds9/Scripts - DS9")
- scripts.sort()
- char = "KIRA"
- #scripts = ["402.txt"]
- for script in scripts:
- number = int(script.split(".")[0])
- top_lines = get_top_lines(script,1)
- for speaker in top_lines:
- if speaker[0] == char:
- print "* **" + episode_info[number][0] + "** - *" + episode_info[number][2] + "*, Lines: " + str(speaker[1])
- -- eplist.txt
- 2 1-01/02 721 03/Jan/93 Emissary
- 3 1-03 404 10/Jan/93 Past Prologue
- 4 1-04 403 17/Jan/93 A Man Alone
- 5 1-05 405 24/Jan/93 Babel
- 6 1-06 406 31/Jan/93 Captive Pursuit
- 7 1-07 407 07/Feb/93 Q-Less
- 8 1-08 408 14/Feb/93 Dax
- 9 1-09 409 21/Feb/93 The Passenger
- 10 1-10 410 14/Mar/93 Move Along Home
- 11 1-11 411 21/Mar/93 The Nagus
- 12 1-12 412 18/Apr/93 Vortex
- 13 1-13 413 25/Apr/93 Battle Lines
- 14 1-14 414 02/May/93 The Storyteller
- 15 1-15 415 09/May/93 Progress
- 16 1-16 416 16/May/93 If Wishes Were Horses
- 17 1-17 417 23/May/93 The Forsaken
- 18 1-18 418 30/May/93 Dramatis Personae
- 19 1-19 419 13/Jun/93 Duet
- 20 1-20 420 20/Jun/93 In the Hands of the Prophets
- 21 2-01 421 26/Sep/93 The Homecoming (1)
- 22 2-02 422 03/Oct/93 The Circle (2)
- 23 2-03 423 10/Oct/93 The Siege (3)
- 24 2-04 424 17/Oct/93 Invasive Procedures
- 25 2-05 425 24/Oct/93 Cardassians
- 26 2-06 426 31/Oct/93 Melora
- 27 2-07 427 07/Nov/93 Rules of Acquisition
- 28 2-08 428 14/Nov/93 Necessary Evil
- 29 2-09 429 21/Nov/93 Second Sight
- 30 2-10 430 28/Nov/93 Sanctuary
- 31 2-11 431 02/Jan/94 Rivals
- 32 2-12 432 09/Jan/94 The Alternate
- 33 2-13 433 30/Jan/94 Armageddon Game
- 34 2-14 434 06/Feb/94 Whispers
- 35 2-15 435 13/Feb/94 Paradise
- 36 2-16 436 20/Feb/94 Shadowplay
- 37 2-17 437 27/Feb/94 Playing God
- 38 2-18 438 20/Mar/94 Profit and Loss
- 39 2-19 439 27/Mar/94 Blood Oath
- 40 2-20 440 24/Apr/94 The Maquis, Part I
- 41 2-21 441 01/May/94 The Maquis, Part II
- 42 2-22 442 08/May/94 The Wire
- 43 2-23 443 15/May/94 Crossover
- 44 2-24 444 22/May/94 The Collaborator
- 45 2-25 445 05/Jun/94 Tribunal
- 46 2-26 446 12/Jun/94 The Jem'Hadar (1)
- 47 3-01 447 26/Sep/94 The Search, Part I (2)
- 48 3-02 448 03/Oct/94 The Search, Part II (3)
- 49 3-03 449 16/Oct/94 The House of Quark
- 50 3-04 450 23/Oct/94 Equilibrium
- 51 3-05 451 30/Oct/94 Second Skin
- 52 3-06 452 06/Nov/94 The Abandoned
- 53 3-07 453 13/Nov/94 Civil Defense
- 54 3-08 454 20/Nov/94 Meridian
- 55 3-09 455 27/Nov/94 Defiant
- 56 3-10 456 04/Dec/94 Fascination
- 57 3-11 457 08/Jan/95 Past Tense, Part I
- 58 3-12 458 15/Jan/95 Past Tense, Part II
- 59 3-13 459 05/Feb/95 Life Support
- 60 3-14 460 12/Feb/95 Heart of Stone
- 61 3-15 461 19/Feb/95 Destiny
- 62 3-16 462 26/Feb/95 Prophet Motive
- 63 3-17 463 05/Mar/95 Visionary
- 64 3-18 464 16/Apr/95 Distant Voices
- 65 3-19 466 23/Apr/95 Through the Looking Glass
- 66 3-20 465 07/May/95 Improbable Cause (1)
- 67 3-21 467 07/May/95 The Die is Cast (2)
- 68 3-22 468 14/May/95 Explorers
- 69 3-23 469 21/May/95 Family Business
- 70 3-24 470 28/May/95 Shakaar
- 71 3-25 471 18/Jun/95 Facets
- 72 3-26 472 25/Jun/95 The Adversary
- 73 4-01 473 02/Oct/95 The Way of the Warrior, Part I
- 74 4-02 474 02/Oct/95 The Way of the Warrior, Part II
- 75 4-03 476 09/Oct/95 The Visitor
- 76 4-04 475 16/Oct/95 Hippocratic Oath
- 77 4-05 477 23/Oct/95 Indiscretion
- 78 4-06 478 30/Oct/95 Rejoined
- 79 4-07 479 06/Nov/95 Starship Down
- 80 4-08 480 13/Nov/95 Little Green Men
- 81 4-09 481 20/Nov/95 The Sword of Kahless
- 82 4-10 482 27/Nov/95 Our Man Bashir
- 83 4-11 483 01/Jan/96 Homefront (1)
- 84 4-12 485 08/Jan/96 Paradise Lost (2)
- 85 4-13 485 29/Jan/96 Crossfire
- 86 4-14 486 05/Feb/96 Return to Grace
- 87 4-15 487 12/Feb/96 Sons of Mogh
- 88 4-16 488 19/Feb/96 Bar Association
- 89 4-17 489 26/Feb/96 Accession
- 90 4-18 490 08/Apr/96 Rules of Engagement
- 91 4-19 491 15/Apr/96 Hard Time
- 92 4-20 492 22/Apr/96 Shattered Mirror
- 93 4-21 493 29/Apr/96 The Muse
- 94 4-22 494 06/May/96 For the Cause
- 95 4-23 496 13/May/96 To the Death
- 96 4-24 495 20/May/96 The Quickening
- 97 4-25 497 10/Jun/96 Body Parts
- 98 4-26 498 17/Jun/96 Broken Link
- 99 5-01 499 30/Sep/96 Apocalypse Rising
- 100 5-02 500 07/Oct/96 The Ship
- 101 5-03 501 14/Oct/96 Looking for par'Mach in all the Wrong Places
- 102 5-04 502 21/Oct/96 ...Nor the Battle to the Strong
- 103 5-05 504 28/Oct/96 The Assignment
- 104 5-06 503 04/Nov/96 Trials and Tribble-ations
- 105 5-07 505 11/Nov/96 Let He Who is Without Sin...
- 106 5-08 506 18/Nov/96 Things Past
- 107 5-09 507 25/Nov/96 The Ascent
- 108 5-10 508 30/Dec/96 Rapture
- 109 5-11 509 06/Jan/97 The Darkness and the Light
- 110 5-12 510 27/Jan/97 The Begotten
- 111 5-13 511 03/Feb/97 For the Uniform
- 112 5-14 512 10/Feb/97 In Purgatory's Shadow (1)
- 113 5-15 513 17/Feb/97 By Inferno's Light (2)
- 114 5-16 514 24/Feb/97 Doctor Bashir, I Presume?
- 115 5-17 515 31/Mar/97 A Simple Investigation
- 116 5-18 516 07/Apr/97 Business as Usual
- 117 5-19 517 14/Apr/97 Ties of Blood and Water
- 118 5-20 518 21/Apr/97 Ferengi Love Songs
- 119 5-21 519 28/Apr/97 Soldiers of the Empire
- 120 5-22 520 05/May/97 Children of Time
- 121 5-23 521 12/May/97 Blaze of Glory
- 122 5-24 522 19/May/97 Empok Nor
- 123 5-25 523 09/Jun/97 In the Cards
- 124 5-26 524 16/Jun/97 Call to Arms
- 125 6-01 525 29/Sep/97 A Time to Stand
- 126 6-02 527 06/Oct/97 Rocks and Shoals
- 127 6-03 526 13/Oct/97 Sons and Daughters
- 128 6-04 528 20/Oct/97 Behind the Lines
- 129 6-05 529 27/Oct/97 Favor the Bold
- 130 6-06 530 03/Nov/97 Sacrifice of Angels
- 131 6-07 531 10/Nov/97 You are Cordially Invited
- 132 6-08 532 17/Nov/97 Resurrection
- 133 6-09 533 24/Nov/97 Statistical Probabilities
- 134 6-10 534 01/Jan/98 The Magnificent Ferengi
- 135 6-11 535 08/Jan/98 Waltz
- 136 6-12 536 04/Feb/98 Who Mourns for Morn?
- 137 6-13 538 11/Feb/98 Far Beyond the Stars
- 138 6-14 537 18/Feb/98 One Little Ship
- 139 6-15 539 25/Feb/98 Honor Among Thieves
- 140 6-16 540 04/Mar/98 Change of Heart
- 141 6-17 541 01/Apr/98 Wrongs Darker than Death or Night
- 142 6-18 542 08/Apr/98 Inquisition
- 143 6-19 543 15/Apr/98 In the Pale Moonlight
- 144 6-20 544 22/Apr/98 His Way
- 145 6-21 545 29/Apr/98 The Reckoning
- 146 6-22 546 06/May/98 Valiant
- 147 6-23 547 13/May/98 Profit and Lace
- 148 6-24 548 20/May/98 Time's Orphan
- 149 6-25 549 10/Jun/98 The Sound of Her Voice
- 150 6-26 550 17/Jun/98 Tears of the Prophets (1)
- 151 7-01 551 30/Sep/98 Image in the Sand (2)
- 152 7-02 552 07/Oct/98 Shadows and Symbols (3)
- 153 7-03 553 14/Oct/98 Afterimage
- 154 7-04 554 21/Oct/98 Take Me Out to the Holosuite
- 155 7-05 555 28/Oct/98 Chrysalis
- 156 7-06 556 04/Nov/98 Treachery, Faith and the Great River
- 157 7-07 557 11/Nov/98 Once More Unto the Breach
- 158 7-08 558 18/Nov/98 The Siege of AR-558
- 159 7-09 559 25/Nov/98 Covenant
- 160 7-10 560 30/Dec/98 It's Only a Paper Moon
- 161 7-11 561 06/Jan/99 Prodigal Daughter
- 162 7-12 562 03/Feb/99 The Emperor's New Cloak
- 163 7-13 563 10/Feb/99 Field of Fire
- 164 7-14 564 17/Feb/99 Chimera
- 165 7-15 566 24/Feb/99 Badda-Bing, Badda-Bang
- 166 7-16 565 03/Mar/99 Inter Arma Enim Silent Leges
- 167 7-17 567 07/Apr/99 Penumbra
- 168 7-18 568 14/Apr/99 'Til Death Do Us Part
- 169 7-19 569 21/Apr/99 Strange Bedfellows
- 170 7-20 570 28/Apr/99 The Changing Face of Evil
- 171 7-21 571 05/May/99 When It Rains...
- 172 7-22 572 12/May/99 Tacking into the Wind
- 173 7-23 573 19/May/99 Extreme Measures
- 174 7-24 574 26/May/99 The Dogs of War
- 175 7-25/26 575 02/Jun/99 What You Leave Behind
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement