mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 19:12:26 -05: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!
69 lines
1.7 KiB
Python
69 lines
1.7 KiB
Python
"""
|
|
Bit sized classes:
|
|
- Bit: Single bit, value is False or True ;
|
|
- Bits: Integer with a size in bits ;
|
|
- RawBits: unknown content with a size in bits.
|
|
"""
|
|
|
|
from lib.hachoir_core.field import Field
|
|
from lib.hachoir_core.i18n import _
|
|
from lib.hachoir_core import config
|
|
|
|
class RawBits(Field):
|
|
"""
|
|
Unknown content with a size in bits.
|
|
"""
|
|
static_size = staticmethod(lambda *args, **kw: args[1])
|
|
|
|
def __init__(self, parent, name, size, description=None):
|
|
"""
|
|
Constructor: see L{Field.__init__} for parameter description
|
|
"""
|
|
Field.__init__(self, parent, name, size, description)
|
|
|
|
def hasValue(self):
|
|
return True
|
|
|
|
def createValue(self):
|
|
return self._parent.stream.readBits(
|
|
self.absolute_address, self._size, self._parent.endian)
|
|
|
|
def createDisplay(self):
|
|
if self._size < config.max_bit_length:
|
|
return unicode(self.value)
|
|
else:
|
|
return _("<%s size=%u>" %
|
|
(self.__class__.__name__, self._size))
|
|
createRawDisplay = createDisplay
|
|
|
|
class Bits(RawBits):
|
|
"""
|
|
Positive integer with a size in bits
|
|
|
|
@see: L{Bit}
|
|
@see: L{RawBits}
|
|
"""
|
|
pass
|
|
|
|
class Bit(RawBits):
|
|
"""
|
|
Single bit: value can be False or True, and size is exactly one bit.
|
|
|
|
@see: L{Bits}
|
|
"""
|
|
static_size = 1
|
|
|
|
def __init__(self, parent, name, description=None):
|
|
"""
|
|
Constructor: see L{Field.__init__} for parameter description
|
|
"""
|
|
RawBits.__init__(self, parent, name, 1, description=description)
|
|
|
|
def createValue(self):
|
|
return 1 == self._parent.stream.readBits(
|
|
self.absolute_address, 1, self._parent.endian)
|
|
|
|
def createRawDisplay(self):
|
|
return unicode(int(self.value))
|
|
|