Browse Source

add useful debug info when a file cannot be found..

main
John-Mark Gurney 2 years ago
parent
commit
51c68c27c0
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      ui/medashare/btv/__init__.py

+ 3
- 1
ui/medashare/btv/__init__.py View File

@@ -156,15 +156,17 @@ def validate_file(fname, with_file_hashes=None):


finddname = glob_escape(torrent['info']['name'].decode(_encoding)) finddname = glob_escape(torrent['info']['name'].decode(_encoding))


missingfname = None
for dirname in fname.parent.rglob(finddname): for dirname in fname.parent.rglob(finddname):
tordir = dirname.parent tordir = dirname.parent


try: try:
return validate(torrent, tordir, with_file_hashes) return validate(torrent, tordir, with_file_hashes)
except FileNotFoundError as e: except FileNotFoundError as e:
missingfname = e.filename
continue continue
else: else:
raise FileNotFoundError('unable to find directory for %s' % (repr(fname.name)))
raise FileNotFoundError('unable to find directory for %s%s' % (repr(fname.name), (', missing file %s' % repr(missingfname)) if missingfname else ''))


def validate(torrent, basedir, with_file_hashes=None): def validate(torrent, basedir, with_file_hashes=None):
'''Take a decode torrent file, where it was stored in basedir, '''Take a decode torrent file, where it was stored in basedir,


Loading…
Cancel
Save