mirror of
https://github.com/nikdoof/tvorganise.git
synced 2025-12-13 06:42:16 +00:00
Get full path to file, rather than a realtive one. Decrappify files in less roundabout and problem-causing way (used to split dir/file name, then rejoin the filenames to the location, which breaks if there is sub-directories)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(/.*?)?")
|
||||
]
|
||||
|
||||
###################################
|
||||
|
||||
Reference in New Issue
Block a user