/usr/lib/python2.7/dist-packages/MLBviewer/mlbMediaDetail.py is in mlbviewer 2015.sf.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | #!/usr/bin/env python
import datetime
from mlbGameTime import MLBGameTime
from mlbConstants import *
STATUSTEXT = {
"CG" : "Final",
"P" : "Preview",
"GO" : "Game Over",
"E" : "Final",
"I" : "Live",
"W" : "Game Over",
"F" : "Final",
"S" : "Suspended",
"D" : "Delayed",
"IP" : "Pregame",
"PO" : "Postponed",
"NB" : "Blackout",
"LB" : "Blackout",
"Manager Challenge" : "Live",
}
class MLBMediaDetail:
def __init__(self,mycfg,listings):
self.listings = listings
self.mycfg = mycfg
# initialize some data structures
self.games = []
def parseListings(self):
self.games = []
for game in self.listings:
gamedata=dict()
gamedata['media'] = dict()
gamedata['media']['audio'] = dict()
gamedata['media']['alt_audio'] = dict()
gamedata['media']['video'] = dict()
gamedata['prefer'] = dict()
gamedata['home']=game[0]['home']
gamedata['away']=game[0]['away']
gamedata['starttime']=game[1]
try:
( gamedata['media']['video']['home'], \
gamedata['media']['video']['away'] ) = game[2]
except:
if len(game[2]) == 1:
try:
team = STATS_TEAMS[int(game[2][0][1])]
except:
raise Exception,repr(game[2][0])
gamedata['media']['video']['home'] = \
(("(None)",),game[2][0])[(team==gamedata['home'])]
gamedata['media']['video']['away'] = \
(("(None)",),game[2][0])[(team==gamedata['away'])]
if game[2][0][1] == '0':
gamedata['media']['video']['home'] = game[2][0]
gamedata['media']['video']['away'] = ("(None)",)
try:
( gamedata['media']['audio']['home'], \
gamedata['media']['audio']['away'] ) = game[3]
except:
if len(game[3]) == 1:
try:
team = STATS_TEAMS[int(game[3][0][1])]
except:
raise Exception,repr(game[3][0])
gamedata['media']['audio']['home'] = \
(("(None)",),game[3][0])[(team==gamedata['home'])]
gamedata['media']['audio']['away'] = \
(("(None)",),game[3][0])[(team==gamedata['away'])]
if game[3][0][1] == '0':
gamedata['media']['audio']['home'] = game[3][0]
gamedata['media']['audio']['away'] = ("(None)",)
gamedata['media']['condensed'] = game[4]
gamedata['status'] = STATUSTEXT.get(game[5])
gamedata['statustext'] = STATUSLINE.get(game[5],"Unknown flag: " +\
game[5] )
gamedata['gameid'] = game[6]
gamedata['archive'] = (0,1)[(game[7] == "media_archive")]
gamedata['mediastart'] = game[8]
gamedata['free'] = game[9]
for alt in game[10]:
if len(alt):
team = STATS_TEAMS[int(alt[1])]
else:
team = None
for k in ( 'away', 'home' ):
if team == gamedata[k]:
gamedata['media']['alt_audio'][k] = alt
for k in ( 'away', 'home' ):
if not gamedata['media']['alt_audio'].has_key(k):
gamedata['media']['alt_audio'][k] = []
self.games.append(gamedata)
return self.games
|