parent
436e8cb760
commit
366bddd20a
2 changed files with 12 additions and 4 deletions
|
@ -338,10 +338,14 @@ def get_storage_locations(uuid):
|
|||
|
||||
def save_torrent_info(storage_object, piece_length, pieces):
|
||||
try:
|
||||
return TorrentInfo.create(storage=storage_object, piece_length=piece_length, pieces=pieces)
|
||||
except IntegrityError:
|
||||
# TorrentInfo already exists for this storage.
|
||||
pass
|
||||
return TorrentInfo.get(storage=storage_object, piece_length=piece_length)
|
||||
except TorrentInfo.DoesNotExist:
|
||||
try:
|
||||
return TorrentInfo.create(storage=storage_object, piece_length=piece_length, pieces=pieces)
|
||||
except IntegrityError:
|
||||
# TorrentInfo already exists for this storage.
|
||||
return TorrentInfo.get(storage=storage_object, piece_length=piece_length)
|
||||
|
||||
|
||||
def get_torrent_info(blob):
|
||||
try:
|
||||
|
|
Reference in a new issue