From de5c637241c89daa2d2ab524b604206607604a1d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 12 Jul 2019 21:51:02 +0100 Subject: [PATCH] Notes on archiving posts --- README.md | 22 +++++++++++++++++++++- epicyon.py | 40 ++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 2c0fe24b..1aaec490 100644 --- a/README.md +++ b/README.md @@ -314,4 +314,24 @@ With your server running you can then follow other accounts with: python3 epicyon.py --nickname [yournick] --domain [name] --follow othernick@domain ``` -You may or may not need to use the *--port*, *--https* and *--tor* options, depending upon how your server was set up. \ No newline at end of file +You may or may not need to use the *--port*, *--https* and *--tor* options, depending upon how your server was set up. + +## Archiving posts + +You can archive old posts with: + +``` bash +python3 epicyon.py --archive [directory] +``` + +Which will move old posts to the given directory. You can also specify the number of weeks after which images will be archived, and the maximum number of posts within in/outboxes. + +``` bash +python3 epicyon.py --archive [directory] --archiveweeks 4 --maxposts 256 +``` + +If you want old posts to be deleted for data minimization purposes then the archive location can be set to */dev/null*. + +``` bash +python3 epicyon.py --archive /dev/null --archiveweeks 4 --maxposts 256 +``` diff --git a/epicyon.py b/epicyon.py index 393720d7..c161ecd1 100644 --- a/epicyon.py +++ b/epicyon.py @@ -408,6 +408,26 @@ if args.changepassword: print('Passwords file not found') sys.exit() +archiveWeeks=4 +if args.archiveWeeks: + archiveWeeks=args.archiveWeeks +archiveMaxPosts=256 +if args.archiveMaxPosts: + archiveMaxPosts=args.archiveMaxPosts + +if args.archive: + if args.archive.lower().endswith('null') or \ + args.archive.lower().endswith('delete') or \ + args.archive.lower().endswith('none'): + args.archive=None + print('Archiving with deletion of old posts...') + else: + print('Archiving to '+args.archive+'...') + archiveMedia(baseDir,args.archive,archiveWeeks) + archivePosts(baseDir,args.archive,archiveMaxPosts) + print('Archiving complete') + sys.exit() + if not args.domain and not domain: print('Specify a domain with --domain [name]') sys.exit() @@ -439,26 +459,6 @@ if args.backgroundImage: else: print('Background image was not added for '+args.nickname) sys.exit() - -archiveWeeks=4 -if args.archiveWeeks: - archiveWeeks=args.archiveWeeks -archiveMaxPosts=256 -if args.archiveMaxPosts: - archiveMaxPosts=args.archiveMaxPosts - -if args.archive: - if args.archive.lower().endswith('null') or \ - args.archive.lower().endswith('delete') or \ - args.archive.lower().endswith('none'): - args.archive=None - print('Archiving with deletion of old posts...') - else: - print('Archiving to '+args.archive+'...') - archiveMedia(baseDir,args.archive,archiveWeeks) - archivePosts(baseDir,args.archive,archiveMaxPosts) - print('Archiving complete') - sys.exit() if federationList: print('Federating with: '+str(federationList))