mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-11 03:45:01 -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!
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
"""
|
|
GNU ar archive : archive file (.a) and Debian (.deb) archive.
|
|
"""
|
|
|
|
from lib.hachoir_parser import Parser
|
|
from lib.hachoir_core.field import (FieldSet, ParserError,
|
|
String, RawBytes, UnixLine)
|
|
from lib.hachoir_core.endian import BIG_ENDIAN
|
|
|
|
class ArchiveFileEntry(FieldSet):
|
|
def createFields(self):
|
|
yield UnixLine(self, "header", "Header")
|
|
info = self["header"].value.split()
|
|
if len(info) != 7:
|
|
raise ParserError("Invalid file entry header")
|
|
size = int(info[5])
|
|
if 0 < size:
|
|
yield RawBytes(self, "content", size, "File data")
|
|
|
|
def createDescription(self):
|
|
return "File entry (%s)" % self["header"].value.split()[0]
|
|
|
|
class ArchiveFile(Parser):
|
|
endian = BIG_ENDIAN
|
|
MAGIC = '!<arch>\n'
|
|
PARSER_TAGS = {
|
|
"id": "unix_archive",
|
|
"category": "archive",
|
|
"file_ext": ("a", "deb"),
|
|
"mime":
|
|
(u"application/x-debian-package",
|
|
u"application/x-archive",
|
|
u"application/x-dpkg"),
|
|
"min_size": (8 + 13)*8, # file signature + smallest file as possible
|
|
"magic": ((MAGIC, 0),),
|
|
"description": "Unix archive"
|
|
}
|
|
|
|
def validate(self):
|
|
if self.stream.readBytes(0, len(self.MAGIC)) != self.MAGIC:
|
|
return "Invalid magic string"
|
|
return True
|
|
|
|
def createFields(self):
|
|
yield String(self, "id", 8, "Unix archive identifier (\"<!arch>\")", charset="ASCII")
|
|
while not self.eof:
|
|
data = self.stream.readBytes(self.current_size, 1)
|
|
if data == "\n":
|
|
yield RawBytes(self, "empty_line[]", 1, "Empty line")
|
|
else:
|
|
yield ArchiveFileEntry(self, "file[]", "File")
|
|
|