Project

General

Profile

Bug #850 » 0002-Fixed-title-and-plot-parsing-for-old-summary.vdr-for.patch

hetas, 01/15/2012 07:14 PM

View differences:

vdrnfofs/filesystemnodes.py
info_path = self.path + '/info'
if not os.path.exists(info_path):
info_path = self.path + '/info.vdr'
if not os.path.exists(info_path):
info_path = self.path + '/summary.vdr'
if not os.path.exists(info_path):
info_path = None
info_vdr = InfoVdr(info_path)
vdrnfofs/vdr.py
def __init__(self, filename = None):
self.values = {'T' : 'Unknown', 'D': 'No Description'}
if filename:
isOldFormat = filename.endswith('summary.vdr')
with open(filename, 'r') as file:
for line in file:
line = line.rstrip("\r\n")
self.values[line[0]] = line[2:]
if isOldFormat:
lines = file.readlines()
if len(lines) > 0:
self.values['T'] = lines[0].rstrip("\r\n")
self.values['D'] = ' '.join([l.rstrip("\r\n") for l in lines[1:]])
else:
for line in file:
line = line.rstrip("\r\n")
self.values[line[0]] = line[2:]
def __getitem__(self, key):
return self.values[key] if self.values.has_key(key) else ''
(2-2/2)