projects
/
rarslave2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[RARSLAVE] Fix exception syntax
[rarslave2.git]
/
rarslave.py
diff --git
a/rarslave.py
b/rarslave.py
index
f40ac9c
..
27db583
100644
(file)
--- a/
rarslave.py
+++ b/
rarslave.py
@@
-5,7
+5,7
@@
VERSION="2.0.0"
PROGRAM="rarslave2"
import re, os, sys, optparse
PROGRAM="rarslave2"
import re, os, sys, optparse
-import
par2p
arser
+import
Par2P
arser
import RarslaveConfig
import RarslaveLogger
import RarslaveConfig
import RarslaveLogger
@@
-208,7
+208,11
@@
def find_likely_files (dir, p2file):
regex = re.compile ('^%s.*$' % (ename, ))
name_matches = [f for f in os.listdir (dir) if regex.match (f)]
regex = re.compile ('^%s.*$' % (ename, ))
name_matches = [f for f in os.listdir (dir) if regex.match (f)]
- parsed_matches = par2parser.get_protected_files (dir, p2file)
+ try:
+ parsed_matches = Par2Parser.get_protected_files (dir, p2file)
+ except (EnvironmentError, OSError, OverflowError):
+ parsed_matches = []
+ logger.addMessage ('Bad par2 file: %s' % p2file, RarslaveLogger.MessageType.Fatal)
return name_matches + parsed_matches
return name_matches + parsed_matches
@@
-277,9
+281,9
@@
def find_extraction_heads (dir, files):
for f in p2files:
done = False
try:
for f in p2files:
done = False
try:
- prot_files =
par2p
arser.get_protected_files (dir, f)
+ prot_files =
Par2P
arser.get_protected_files (dir, f)
done = True
done = True
- except
: #FIXME: add the actual exceptions
+ except
(EnvironmentError, OverflowError, OSError):
logger.addMessage ('Error parsing PAR2 file: %s', f)
continue
logger.addMessage ('Error parsing PAR2 file: %s', f)
continue
@@
-415,11
+419,12
@@
def delete_list (dir, files, interactive=False):
done = False
valid_y = ['Y', 'YES']
done = False
valid_y = ['Y', 'YES']
- valid_n = ['N', 'NO']
+ valid_n = ['N', 'NO'
, ''
]
if interactive:
while not done:
print 'Do you want to delete the following?:'
if interactive:
while not done:
print 'Do you want to delete the following?:'
+ printlist (files)
s = raw_input ('Delete [y/N]: ').upper()
if s in valid_y + valid_n:
s = raw_input ('Delete [y/N]: ').upper()
if s in valid_y + valid_n: