Occasionally, files will be missed because they have ambiguous filenames for the torrents, e.g. (HDTV-LOL), although the filename of the actual file will be fine, e.g. HDTV.XviD-LOL
This patch fixes this by checking that first. It's somewhat inefficient, in that it requires downloading the .torrent file to check, and if it matches, that will then get downloaded again. However, this is not really a large issue.
Check torrent files if the .torrent name has unknown quality
Split the torrent parser into a new file
Begin changing the cache
Actually add the parser
Merge branch 'master' into wantshow
Remove BDecoder from sceneHelpers
Instead of adding a new parser you could use the existing one from hachoir which is already included in Sick-Beard.
e.g. to extract the filename use something like:
from lib.hachoir_parser import createParser
from lib.hachoir_metadata import extractMetadata
from lib.hachoir_core.error import HachoirError
parser = createParser(u"/home/user/file.torrent")
metadata = extractMetadata(parser)
if not metadata.has('filename'):
filename = metadata.get('filename')
The problem with using that parser is that, AFAICT, we have to download the file first. Alternatively, we can use a stream from urllib2, but then we can't use helpers.getURL, and I believe we also lose the ability to parse gzipped torrents.
Should I convert this over?
hachoir is for reading a stream..