add remove command
This commit is contained in:
parent
f3cb5c4069
commit
8bdaea3910
@ -8,7 +8,29 @@ from concurrent.futures import as_completed, wait
|
||||
import argparse, logging, threading
|
||||
from lib.WPImport import WPimport
|
||||
from lib.WPExport import WPExport
|
||||
from lib.WPRemove import WPRemove
|
||||
|
||||
def remove(args, basic, logger):
|
||||
removeWp = WPRemove(basic=basic, wordpress="", logger=logger)
|
||||
if args.remove:
|
||||
for i in args.wordpress.split(","):
|
||||
removeWp.setUrl(i)
|
||||
removeWp.cleanPosts()
|
||||
removeWp.cleanTags()
|
||||
removeWp.cleanCategories()
|
||||
removeWp.cleanMedia()
|
||||
else:
|
||||
for i in args.wordpress.split(","):
|
||||
removeWp.setUrl(i)
|
||||
if args.posts:
|
||||
removeWp.cleanPosts()
|
||||
if args.categories:
|
||||
removeWp.cleanCategories()
|
||||
if args.tags:
|
||||
removeWp.cleanTags()
|
||||
if args.media:
|
||||
removeWp.cleanMedia()
|
||||
del removeWp
|
||||
|
||||
|
||||
def download(name_thread, max_thread, url, logger, parser, directory, html, img):
|
||||
@ -187,10 +209,7 @@ if __name__ == '__main__':
|
||||
importWp.setUrl(i)
|
||||
importWp.fromFile(files=args.file.split(","))
|
||||
if len(args.directory) > 0:
|
||||
if args.remove:
|
||||
for i in args.wordpress.split(","):
|
||||
importWp.setUrl(i)
|
||||
importWp.removeAll()
|
||||
remove(args, basic, logger)
|
||||
try:
|
||||
with futures.ThreadPoolExecutor(max_workers=int(args.parallel)) as ex:
|
||||
wait_for = [
|
||||
@ -200,10 +219,7 @@ if __name__ == '__main__':
|
||||
except Exception as err:
|
||||
logger.error("Threading error : {0}".format(err))
|
||||
if len(args.canalblog) > 0:
|
||||
if args.remove:
|
||||
for i in args.wordpress.split(","):
|
||||
importWp.setUrl(i)
|
||||
importWp.removeAll()
|
||||
remove(args, basic, logger)
|
||||
try:
|
||||
with futures.ThreadPoolExecutor(max_workers=int(args.parallel)) as ex:
|
||||
wait_for = [
|
||||
@ -246,5 +262,15 @@ if __name__ == '__main__':
|
||||
except Exception as err:
|
||||
logger.error("Threading error : {0}".format(err))
|
||||
|
||||
|
||||
|
||||
if args.command == "remove":
|
||||
password = args.password
|
||||
if len(args.password) == 0:
|
||||
password = getpass()
|
||||
if len(password) == 0:
|
||||
logger.error("No password error !!! ")
|
||||
exit(1)
|
||||
|
||||
basic = HTTPBasicAuth(args.user, password)
|
||||
remove(args, basic, logger)
|
||||
exit(0)
|
Loading…
x
Reference in New Issue
Block a user