diff --git a/nostr-backup.sh b/nostr-backup.sh index 60a7c4f..b1b715d 100644 --- a/nostr-backup.sh +++ b/nostr-backup.sh @@ -43,3 +43,5 @@ done echo "Publishing to ${TARGET_RELAY}..." sort -u ~/tmp/nostr-backup.json | nak event ${TARGET_RELAY} +#Remove duplicities again for future use. +sort -u -o ~/tmp/nostr-backup.json ~/tmp/nostr-backup.json diff --git a/slow-post-all.sh b/slow-post-all.sh index 3563837..13d3274 100644 --- a/slow-post-all.sh +++ b/slow-post-all.sh @@ -7,5 +7,5 @@ for RELAY in wss://relay.nostrplebs.com wss://relay.nostr.band do echo "Publishing to ${RELAY}" # We can post to different relays in parallel, they don't know about each other - do python3 slow-post.py "${RELAY}" < "${1}";done ) & + python3 slow-post.py "${RELAY}" < "${1}" & done diff --git a/slow-post.py b/slow-post.py index 52843b1..9b34399 100644 --- a/slow-post.py +++ b/slow-post.py @@ -9,7 +9,14 @@ if len(sys.argv) < 2: relay = sys.argv[1] -data = json.loads(sys.stdin.read()) +data = [] +for line in sys.stdin: + try: + item = json.loads(line) + data.append(item) + except json.JSONDecodeError as e: + print(f"Error decoding JSON: {e}", file=sys.stderr) + continue # Execute the binary for each element in the JSON array for item in data: