Browse Source

little modification

pull/16/head
Nzix 6 years ago
parent
commit
66e310f7bf
  1. 16
      app.py

16
app.py

@ -38,19 +38,19 @@ group.add_argument(
) )
args = parser.parse_args() args = parser.parse_args()
def validate_name(file_name): def validate_name(name):
pattern = {u'\\': u'', u'/': u'', u':': u'', u'*': u'', u'?': u'', u'"': u'', u'<': u'', u'>': u'', u'|': u''} pattern = {u'\\': u'', u'/': u'', u':': u'', u'*': u'', u'?': u'', u'"': u'', u'<': u'', u'>': u'', u'|': u''}
for character in pattern: for character in pattern:
file_name = file_name.replace(character, pattern[character]) name = name.replace(character, pattern[character])
return file_name return name
def validate_collision(file_path): def validate_collision(path):
index = 1 index = 1
origin = file_path origin = path
while os.path.exists(file_path): while os.path.exists(path):
file_path = '({})'.format(index).join(os.path.splitext(origin)) path = '({})'.format(index).join(os.path.splitext(origin))
index += 1 index += 1
return file_path return path
def name_format(path, meta): def name_format(path, meta):
information = { information = {

Loading…
Cancel
Save