mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-15 04:22:17 -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!
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
from lib.hachoir_core.i18n import getTerminalCharset, guessBytesCharset, _
|
|
from lib.hachoir_core.stream import InputIOStream, InputSubStream, InputStreamError
|
|
|
|
def FileInputStream(filename, real_filename=None, **args):
|
|
"""
|
|
Create an input stream of a file. filename must be unicode.
|
|
|
|
real_filename is an optional argument used to specify the real filename,
|
|
its type can be 'str' or 'unicode'. Use real_filename when you are
|
|
not able to convert filename to real unicode string (ie. you have to
|
|
use unicode(name, 'replace') or unicode(name, 'ignore')).
|
|
"""
|
|
assert isinstance(filename, unicode)
|
|
if not real_filename:
|
|
real_filename = filename
|
|
try:
|
|
inputio = open(real_filename, 'rb')
|
|
except IOError, err:
|
|
charset = getTerminalCharset()
|
|
errmsg = unicode(str(err), charset)
|
|
raise InputStreamError(_("Unable to open file %s: %s") % (filename, errmsg))
|
|
source = "file:" + filename
|
|
offset = args.pop("offset", 0)
|
|
size = args.pop("size", None)
|
|
if offset or size:
|
|
if size:
|
|
size = 8 * size
|
|
stream = InputIOStream(inputio, source=source, **args)
|
|
return InputSubStream(stream, 8 * offset, size, **args)
|
|
else:
|
|
args.setdefault("tags",[]).append(("filename", filename))
|
|
return InputIOStream(inputio, source=source, **args)
|
|
|
|
def guessStreamCharset(stream, address, size, default=None):
|
|
size = min(size, 1024*8)
|
|
bytes = stream.readBytes(address, size//8)
|
|
return guessBytesCharset(bytes, default)
|
|
|