name fix
parent
2d95cad3e5
commit
9c76442136
2
Core.py
2
Core.py
|
@ -1482,7 +1482,7 @@ class Core:
|
||||||
if append_filesize:
|
if append_filesize:
|
||||||
fileTitle += ' [%d MB]' % (size / 1024 / 1024)
|
fileTitle += ' [%d MB]' % (size / 1024 / 1024)
|
||||||
hasSize = True
|
hasSize = True
|
||||||
contentList.append((unescape(fileTitle), str(filedict.get('ind')), size))
|
contentList.append([unescape(fileTitle), str(filedict.get('ind')), size])
|
||||||
#contentList = sorted(contentList, key=lambda x: x[0])
|
#contentList = sorted(contentList, key=lambda x: x[0])
|
||||||
|
|
||||||
dirList, contentListNew = cutFolder(contentList, tdir)
|
dirList, contentListNew = cutFolder(contentList, tdir)
|
||||||
|
|
33
functions.py
33
functions.py
|
@ -422,45 +422,44 @@ def cutFolder(contentList, tdir=None):
|
||||||
|
|
||||||
if len(contentList) > 1:
|
if len(contentList) > 1:
|
||||||
common_folder = contentList[0][0]
|
common_folder = contentList[0][0]
|
||||||
if '\\' in common_folder:
|
debug('[cutFolder]: common_folder '+common_folder)
|
||||||
common_folder = common_folder.split('\\')[0]
|
if u'\\' in common_folder:
|
||||||
elif '/' in common_folder:
|
common_folder = common_folder.split(u'\\')[0]
|
||||||
common_folder = common_folder.split('/')[0]
|
elif u'/' in common_folder:
|
||||||
|
common_folder = common_folder.split(u'/')[0]
|
||||||
|
|
||||||
common = True
|
common = True
|
||||||
for item in contentList:
|
for item in contentList:
|
||||||
fileTitle = item[0]
|
if common_folder not in item[0]:
|
||||||
if common_folder not in fileTitle:
|
|
||||||
common = False
|
common = False
|
||||||
break
|
break
|
||||||
|
|
||||||
# print common_folder
|
|
||||||
for item in contentList:
|
for item in contentList:
|
||||||
fileTitle = item[0]
|
|
||||||
contentId = item[1]
|
|
||||||
dir = None
|
dir = None
|
||||||
if common:
|
if common:
|
||||||
fileTitle = fileTitle[len(common_folder) + 1:]
|
item[0] = item[0][len(common_folder) + 1:]
|
||||||
|
|
||||||
# print fileTitle
|
#debug('[cutFolder]: item[0] '+item[0])
|
||||||
|
|
||||||
if '\\' in fileTitle:
|
if u'\\' in item[0]:
|
||||||
dir = fileTitle.split('\\')[0]
|
dir = item[0].split(u'\\')[0]
|
||||||
elif '/' in fileTitle:
|
elif u'/' in item[0]:
|
||||||
dir = fileTitle.split('/')[0]
|
dir = item[0].split(u'/')[0]
|
||||||
elif not tdir:
|
elif not tdir:
|
||||||
contentListNew.append(item)
|
contentListNew.append(item)
|
||||||
|
|
||||||
if tdir and dir == tdir:
|
if tdir and dir == tdir:
|
||||||
tupleContent = list(item)
|
tupleContent = list(item)
|
||||||
tupleContent[0] = fileTitle[len(dir) + 1:]
|
tupleContent[0] = item[0][len(dir) + 1:]
|
||||||
contentListNew.append(tuple(tupleContent))
|
contentListNew.append(list(tupleContent))
|
||||||
|
|
||||||
if not tdir and dir and dir not in dirList:
|
if not tdir and dir and dir not in dirList:
|
||||||
dirList.append(dir)
|
dirList.append(dir)
|
||||||
|
|
||||||
|
debug('[cutFolder]: dirList, contentListNew '+str(dirList)+str(contentListNew))
|
||||||
return dirList, contentListNew
|
return dirList, contentListNew
|
||||||
else:
|
else:
|
||||||
|
debug('[cutFolder]: dirList, contentList '+str(dirList)+str(contentList))
|
||||||
return dirList, contentList
|
return dirList, contentList
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue