Fix piece hash calculation
This commit is contained in:
parent
d83cc109b5
commit
e4da61a05d
3 changed files with 16 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
|
||||
from peewee import JOIN_LEFT_OUTER, fn, SQL
|
||||
from peewee import JOIN_LEFT_OUTER, fn, SQL, IntegrityError
|
||||
|
||||
from data.model import (config, db_transaction, InvalidImageException, TorrentInfoDoesNotExist,
|
||||
DataModelException, _basequery)
|
||||
|
@ -255,7 +255,11 @@ def get_storage_locations(uuid):
|
|||
|
||||
|
||||
def save_torrent_info(storage_object, piece_length, pieces):
|
||||
TorrentInfo.create(storage=storage_object, piece_length=piece_length, pieces=pieces)
|
||||
try:
|
||||
TorrentInfo.create(storage=storage_object, piece_length=piece_length, pieces=pieces)
|
||||
except IntegrityError:
|
||||
# TorrentInfo already exists for this storage.
|
||||
pass
|
||||
|
||||
def get_torrent_info(blob):
|
||||
try:
|
||||
|
|
Reference in a new issue