From 9e8702962ed15705eeed925b366d9accfad376e5 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Sun, 21 Jul 2013 13:50:23 -0400 Subject: [PATCH] Require Python 2.5; revert some 2.4 compatibility patches. --- README | 2 +- config.py | 6 ++---- plugins/settings/settings.py | 6 ++---- plugins/video/qtfaststart.py | 7 +++---- pyTivo.py | 4 ++-- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/README b/README index e84af2e..2dc6450 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ OS = Anything that will run python and ffmpeg, which I think is anything. Known to work on Linux, Mac OS X and Windows. Python - http://www.python.org/download/ -- You need at least version 2.4 of python +- You need at least version 2.5 of python pywin32 (only to install as a service) - http://sourceforge.net/project/showfiles.php?group_id=78018&package_id=79063 diff --git a/config.py b/config.py index a22da4d..6cdbe87 100644 --- a/config.py +++ b/config.py @@ -174,10 +174,8 @@ def isTsnInConfig(tsn): def getShares(tsn=''): shares = [(section, dict(config.items(section))) for section in config.sections() - if not (section.startswith('_tivo_') - or section.startswith('logger_') - or section.startswith('handler_') - or section.startswith('formatter_') + if not (section.startswith(('_tivo_', 'logger_', 'handler_', + 'formatter_')) or section in ('Server', 'loggers', 'handlers', 'formatters') ) diff --git a/plugins/settings/settings.py b/plugins/settings/settings.py index b6518b3..6149492 100644 --- a/plugins/settings/settings.py +++ b/plugins/settings/settings.py @@ -67,8 +67,7 @@ class Settings(Plugin): shares_data = [] for section in config.config.sections(): - if not (section.startswith('_tivo_') - or section.startswith('Server')): + if not section.startswith(('_tivo_', 'Server')): if (not (config.config.has_option(section, 'type')) or config.config.get(section, 'type').lower() not in ['settings', 'togo']): @@ -90,8 +89,7 @@ class Settings(Plugin): t.tivos_data = [(section, dict(config.config.items(section, raw=True))) for section in config.config.sections() if section.startswith('_tivo_') - and not section.startswith('_tivo_SD') - and not section.startswith('_tivo_HD')] + and not section.startswith(('_tivo_SD', '_tivo_HD'))] t.tivos_known = buildhelp.getknown('tivos') t.help_list = buildhelp.gethelp() t.has_shutdown = hasattr(handler.server, 'shutdown') diff --git a/plugins/video/qtfaststart.py b/plugins/video/qtfaststart.py index 257a997..a39ebaf 100644 --- a/plugins/video/qtfaststart.py +++ b/plugins/video/qtfaststart.py @@ -69,7 +69,6 @@ from StringIO import StringIO VERSION = "1.7wjm3" CHUNK_SIZE = 8192 -SEEK_CUR = 1 # Not defined in Python 2.4, so we define it here -- WJM3 log = logging.getLogger('pyTivo.video.qt-faststart') @@ -128,7 +127,7 @@ def get_index(datastream): # Weird, but just continue to try to find more atoms atom_size = skip - datastream.seek(atom_size - skip, SEEK_CUR) + datastream.seek(atom_size - skip, os.SEEK_CUR) # Make sure the atoms we need exist top_level_atoms = set([item[0] for item in index]) @@ -167,7 +166,7 @@ def find_atoms(size, datastream): yield atom_type else: # Ignore this atom, seek to the end of it. - datastream.seek(atom_size - 8, SEEK_CUR) + datastream.seek(atom_size - 8, os.SEEK_CUR) def output(outfile, skip, data): global count @@ -248,7 +247,7 @@ def process(datastream, outfile, skip=0): moov.read(csize * entry_count)) # Patch and write entries - moov.seek(-csize * entry_count, SEEK_CUR) + moov.seek(-csize * entry_count, os.SEEK_CUR) moov.write(struct.pack(">" + ctype * entry_count, *[entry + offset for entry in entries])) diff --git a/pyTivo.py b/pyTivo.py index b9f6d57..a931fbc 100755 --- a/pyTivo.py +++ b/pyTivo.py @@ -6,8 +6,8 @@ import platform import sys import time -if sys.version_info[0] != 2 or sys.version_info[1] < 4: - print ('ERROR: pyTivo requires Python >= 2.4, < 3.0.\n') +if sys.version_info[0] != 2 or sys.version_info[1] < 5: + print ('ERROR: pyTivo requires Python >= 2.5, < 3.0.\n') sys.exit(1) import beacon -- 2.11.4.GIT