mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-05 02:43:37 +00:00
0d9fbc1ad7
This version of SickBeard uses both TVDB and TVRage to search and gather it's series data from allowing you to now have access to and download shows that you couldn't before because of being locked into only what TheTVDB had to offer. Also this edition is based off the code we used in our XEM editon so it does come with scene numbering support as well as all the other features our XEM edition has to offer. Please before using this with your existing database (sickbeard.db) please make a backup copy of it and delete any other database files such as cache.db and failed.db if present, we HIGHLY recommend starting out with no database files at all to make this a fresh start but the choice is at your own risk! Enjoy!
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
from lib.hachoir_core.field import Field, FieldSet, ParserError
|
|
|
|
class GenericVector(FieldSet):
|
|
def __init__(self, parent, name, nb_items, item_class, item_name="item", description=None):
|
|
# Sanity checks
|
|
assert issubclass(item_class, Field)
|
|
assert isinstance(item_class.static_size, (int, long))
|
|
if not(0 < nb_items):
|
|
raise ParserError('Unable to create empty vector "%s" in %s' \
|
|
% (name, parent.path))
|
|
size = nb_items * item_class.static_size
|
|
self.__nb_items = nb_items
|
|
self._item_class = item_class
|
|
self._item_name = item_name
|
|
FieldSet.__init__(self, parent, name, description, size=size)
|
|
|
|
def __len__(self):
|
|
return self.__nb_items
|
|
|
|
def createFields(self):
|
|
name = self._item_name + "[]"
|
|
parser = self._item_class
|
|
for index in xrange(len(self)):
|
|
yield parser(self, name)
|
|
|
|
class UserVector(GenericVector):
|
|
"""
|
|
To implement:
|
|
- item_name: name of a field without [] (eg. "color" becomes "color[0]"),
|
|
default value is "item"
|
|
- item_class: class of an item
|
|
"""
|
|
item_class = None
|
|
item_name = "item"
|
|
|
|
def __init__(self, parent, name, nb_items, description=None):
|
|
GenericVector.__init__(self, parent, name, nb_items, self.item_class, self.item_name, description)
|
|
|