Procházet zdrojové kódy

Add utility scripts, and document tnem at README

master
The Dod před 2 dny
rodič
revize
edbe09b9ad
5 změnil soubory, kde provedl 66 přidání a 1 odebrání
  1. 48
    1
      README.md
  2. 5
    0
      install.sh
  3. 5
    0
      register.py
  4. 4
    0
      register.sh
  5. 4
    0
      run.sh

+ 48
- 1
README.md Zobrazit soubor

@@ -1,3 +1,50 @@
1 1
 Bloomscroller is a [Mastodon](https://joinmastodon.org) bot that is run as a cron job in order to drip-toot a [Piwigo](https://piwigo.org) gallery one image at a time.
2 2
 
3
-_to be cotinued_
3
+Specifically, I wrote it in order to publish photos from a [gallery](https://photos.nandn.org.il/piwigo/index.php?/category/21) of flowers that grow in [our](https://nandn.org.il/) garden (hence the name).
4
+
5
+At [config.py](config.py) there are `TOOT_TEMPLATE` and `ALT_TEXT_TEMPLATE` that can contain fields from an album image's [json info](example.json). In my specific test case I don't use `{title}` and `{comment}`, but they're there if they're useful for you.
6
+
7
+### Installing
8
+
9
+* Run `./install.sh`
10
+* Edit [config.py](config.py) to suit your needs
11
+* Run `./register.sh` to register the bot with you mastodon server (make sure the instance's policy allows you to run the bot).
12
+
13
+
14
+### Running
15
+
16
+Run `[/path/to/here]/run.sh`. This can be done as a cron job.
17
+
18
+```
19
+      , .-.-,_,
20
+      )`-.>'` (
21
+     /     `\  |
22
+     |       | |
23
+      \     / /
24
+      `=(\ /.=`
25
+       `-;`.-' 
26
+         `)|     ,
27
+          ||  .-'|
28
+        ,_||  \_,/
29
+  ,      \|| .'
30
+  |\|\  , ||/
31
+ ,_\` |/| |Y_,
32
+  '-.'-._\||/
33
+     >_.-`Y|
34
+     ` .-"||"-.
35
+       \'----'/
36
+        |:.  |
37
+        |::. |
38
+       /::::  \
39
+     .:::'     '.
40
+    /:::         \
41
+   ;:::'          ;
42
+   |:::           |
43
+   |:::           |
44
+   |:::           |
45
+   ;:::           ;
46
+   \:::.          /
47
+jgs ':::..      .'
48
+     `""-----""`
49
+```
50
+ASCII art by [Joan G. Stark](https://en.wikipedia.org/wiki/Joan_Stark).

+ 5
- 0
install.sh Zobrazit soubor

@@ -0,0 +1,5 @@
1
+#!/bin/bash
2
+cd "$(basename "$0")"
3
+virtualenv venv
4
+source venv/bin/activate
5
+pip install -r requirements.txt

+ 5
- 0
register.py Zobrazit soubor

@@ -16,4 +16,9 @@ def register_app():
16 16
     print("Registration complete")
17 17
 
18 18
 if __name__=='__main__':
19
+    print("""
20
+This utility should only be run *once* (if you see the file "secrets.txt", you probably shouldn't run this).
21
+You should also make sure that you've edited "config.py" with the relevant APP_INSTANCE_URL etc.,
22
+and that you don't violate the instance's code of conduct by running your bot (ask an admin if unsure).""")
23
+    input("Hit enter if you're ready to register your app with your mastodon server, otherwise — hit Ctrl-C ")
19 24
     register_app()

+ 4
- 0
register.sh Zobrazit soubor

@@ -0,0 +1,4 @@
1
+#!/bin/bash
2
+cd "$(dirname "$0")"
3
+source venv/bin/activate
4
+python register.py

+ 4
- 0
run.sh Zobrazit soubor

@@ -0,0 +1,4 @@
1
+#!/bin/bash
2
+cd "$(dirname "$0")"
3
+source venv/bin/activate
4
+python bloomscroller.py

Načítá se…
Zrušit
Uložit