更新文件: webdav_simulator.amd64, webdav_simulator.exe, get115list.py, run.sh, get115list.exe 等7个文件
This commit is contained in:
@ -5,16 +5,23 @@ import argparse
|
||||
from p115 import P115Client, P115FileSystem
|
||||
import time
|
||||
import traceback
|
||||
import os
|
||||
|
||||
count=0
|
||||
|
||||
def walk_dir(fs,f):
|
||||
def walk_dir(fs,f,replaceroot):
|
||||
dirlist=list()
|
||||
file_list = fs.listdir_attr()
|
||||
for file_obj in file_list:
|
||||
if not file_obj.is_directory:
|
||||
print(file_obj.path+"\t"+str(file_obj.size))
|
||||
f.write(file_obj.path+"\t"+str(file_obj.size)+"\n")
|
||||
path = file_obj.path
|
||||
paths = path.split("/")
|
||||
if replaceroot!="":
|
||||
if len(paths)>=3:
|
||||
path=os.path.join("/",replaceroot,*paths[2:])
|
||||
|
||||
print(path+"\t"+str(file_obj.size))
|
||||
f.write(path+"\t"+str(file_obj.size)+"\n")
|
||||
f.flush()
|
||||
else:
|
||||
dirlist.append(file_obj.path)
|
||||
@ -24,7 +31,7 @@ def walk_dir(fs,f):
|
||||
count=count+1
|
||||
if count%4==0:
|
||||
time.sleep(1)
|
||||
walk_dir(fs,f)
|
||||
walk_dir(fs,f,replaceroot)
|
||||
return
|
||||
|
||||
def main():
|
||||
@ -32,6 +39,7 @@ def main():
|
||||
parser.add_argument('--cookie', type=str, required=True, help='115Cookie')
|
||||
parser.add_argument('--url', type=str, required=True, help='115ShareUrl')
|
||||
parser.add_argument('--output', type=str, required=True, help='outputfile')
|
||||
parser.add_argument('--replaceroot', type=str, default="", required=False, help='替换根目录名称')
|
||||
args = parser.parse_args()
|
||||
cookie=args.cookie
|
||||
shareUrl=args.url
|
||||
@ -45,7 +53,7 @@ def main():
|
||||
|
||||
count=0
|
||||
f=open(args.output, mode="a", encoding="utf-8")
|
||||
walk_dir(fs,f)
|
||||
walk_dir(fs,f,args.replaceroot)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Reference in New Issue
Block a user