better torrent tests, add getMovieId test

This commit is contained in:
j 2008-05-08 12:43:35 +02:00
parent b9634887ff
commit 416ceb1ef9
3 changed files with 9 additions and 6 deletions

View file

@ -19,6 +19,10 @@ from oxutils.normalize import normalizeTitle, normalizeImdbId
import google
def getMovieId(title, director='', year=''):
'''
>>> getMovieId('The Matrix')
'0133093'
'''
if year:
title = "%s (%s)" % (title, year)
if director:

View file

@ -6,7 +6,6 @@ from datetime import datetime
import re
import socket
from urllib import quote
import sha
from oxutils.cache import getUrl, getUrlUnicode
from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, intValue, normalizeNewlines
@ -91,8 +90,8 @@ class Mininova(Torrent):
'''
>>> Mininova('123')
{}
>>> sha.sha(unicode(Mininova('1072195'))).hexdigest()
'ec98268a0aeaef8292f7bcf3585d0bc3910b3fac'
>>> Mininova('1072195')['infohash']
'72dfa59d2338e4a48c78cec9de25964cddb64104'
'''
def __init__(self, mininovaId):
self.data = getData(mininovaId)

View file

@ -7,7 +7,7 @@ import re
import socket
from urllib import quote, urlencode
from urllib2 import URLError
import sha
from oxutils.cache import getUrl, getUrlUnicode
from oxutils import findRe, cache, stripTags, decodeHtml, getTorrentInfo, normalizeNewlines
@ -104,8 +104,8 @@ class Thepiratebay(Torrent):
>>> Thepiratebay('123')
{}
>>> sha.sha(unicode(Thepiratebay('3951349'))).hexdigest()
'ef64e438e3eef6e6a05cac4eea56b9f0289d3f22'
>>> Thepiratebay('3951349')['infohash']
'4e84415d36ed7b54066160c05a0b0f061898d12b'
'''
def __init__(self, piratebayId):
self.data = getData(piratebayId)