diff --git a/checkFilms.py b/checkFilms.py index 3d3f6a0..8bd75bc 100755 --- a/checkFilms.py +++ b/checkFilms.py @@ -49,24 +49,20 @@ def getError(invalid,errorno): allfiles=[] for (path,dirs,files) in os.walk(loc): for file in files: - filename = os.path.join(path,file) + filename = os.path.join(os.path.abspath(path),file) allfiles.append( str(filename) ) #end for f -files = [x for x in allfiles if os.path.isfile(x)] # only get files, not folders - # Strip out dotfiles/folder.jpg for current_file in allfiles: current_file_path,current_file_name = os.path.split(current_file) for cur_decrap in film_regex['decrappify']: if cur_decrap.match(current_file_name): - files.remove(current_file) + allfiles.remove(current_file) #end for file -files = [os.path.join(loc,x) for x in files] # append path to file name - # Warn if no files are found, then exit -if files.__len__() == 0: +if allfiles.__len__() == 0: print colour('No files found','red') sys.exit(0) @@ -83,7 +79,7 @@ errors = { valid = [] invalid = [] -for cur in files: +for cur in allfiles: cpath,cfile = os.path.split(cur) cfile,cext = os.path.splitext(cfile) @@ -93,6 +89,7 @@ for cur in files: if check: break else: + print cpath, "doesnt match" invalid.append({'errorno':3, 'path':cpath,'filename':cfile, 'cext':cext}) #end for cur_checker diff --git a/filename_config.py b/filename_config.py index 026f82d..6e2eb42 100644 --- a/filename_config.py +++ b/filename_config.py @@ -104,9 +104,11 @@ film_regex['missing_year'] = [ # Valid paths # # ./ +# film_regex['valid_path'] = [ - re.compile("/.$"), + re.compile(".*?/video/films$"), + re.compile(".*?/video/films/Short Films(/.*?)?") ] ###################################