Merge pull request #1 from aidik/patch-1

A few improvements and fixes
This commit is contained in:
Juraj Bednar 2024-08-01 21:05:18 +02:00 committed by GitHub
commit 7815f55da4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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: