Browse Source

Intial Commit

A script to get the files.
A script to show a random pick with it's text
Amelia A 7 months ago
commit
cafe47ab5e
Signed by: Amy Aronsohn <WagThatTail@Me.com> GPG Key ID: 70C320ABA95D38C1
7 changed files with 192 additions and 0 deletions
  1. 3
    0
      .gitignore
  2. 7
    0
      LICENCE
  3. 13
    0
      Pipfile
  4. 95
    0
      Pipfile.lock
  5. 13
    0
      README.md
  6. 29
    0
      get.py
  7. 32
    0
      pick.py

+ 3
- 0
.gitignore View File

@@ -0,0 +1,3 @@
1
+*.zip
2
+*.jpg
3
+*.png

+ 7
- 0
LICENCE View File

@@ -0,0 +1,7 @@
1
+Tarot of the Silicon Dawn is all Egypt Urnash
2
+http://egypt.urnash.com/tarot/
3
+
4
+I'd tell you to go buy it but you can't so instead this is licenced as follows;
5
+
6
+Be Gay
7
+Do Crimes

+ 13
- 0
Pipfile View File

@@ -0,0 +1,13 @@
1
+[[source]]
2
+url = "https://pypi.org/simple"
3
+verify_ssl = true
4
+name = "pypi"
5
+
6
+[packages]
7
+Pillow = "*"
8
+requests = "*"
9
+
10
+[dev-packages]
11
+
12
+[requires]
13
+python_version = "3.7"

+ 95
- 0
Pipfile.lock View File

@@ -0,0 +1,95 @@
1
+{
2
+    "_meta": {
3
+        "hash": {
4
+            "sha256": "0eef2c50ddd4643c54def68795ac5418e328bfbd582010a7c87c523cd668578d"
5
+        },
6
+        "pipfile-spec": 6,
7
+        "requires": {
8
+            "python_version": "3.7"
9
+        },
10
+        "sources": [
11
+            {
12
+                "name": "pypi",
13
+                "url": "https://pypi.org/simple",
14
+                "verify_ssl": true
15
+            }
16
+        ]
17
+    },
18
+    "default": {
19
+        "certifi": {
20
+            "hashes": [
21
+                "sha256:376690d6f16d32f9d1fe8932551d80b23e9d393a8578c5633a2ed39a64861638",
22
+                "sha256:456048c7e371c089d0a77a5212fb37a2c2dce1e24146e3b7e0261736aaeaa22a"
23
+            ],
24
+            "version": "==2018.8.24"
25
+        },
26
+        "chardet": {
27
+            "hashes": [
28
+                "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
29
+                "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
30
+            ],
31
+            "version": "==3.0.4"
32
+        },
33
+        "idna": {
34
+            "hashes": [
35
+                "sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e",
36
+                "sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"
37
+            ],
38
+            "version": "==2.7"
39
+        },
40
+        "pillow": {
41
+            "hashes": [
42
+                "sha256:00def5b638994f888d1058e4d17c86dec8e1113c3741a0a8a659039aec59a83a",
43
+                "sha256:026449b64e559226cdb8e6d8c931b5965d8fc90ec18ebbb0baa04c5b36503c72",
44
+                "sha256:03dbb224ee196ef30ed2156d41b579143e1efeb422974719a5392fc035e4f574",
45
+                "sha256:03eb0e04f929c102ae24bc436bf1c0c60a4e63b07ebd388e84d8b219df3e6acd",
46
+                "sha256:1be66b9a89e367e7d20d6cae419794997921fe105090fafd86ef39e20a3baab2",
47
+                "sha256:1e977a3ed998a599bda5021fb2c2889060617627d3ae228297a529a082a3cd5c",
48
+                "sha256:22cf3406d135cfcc13ec6228ade774c8461e125c940e80455f500638429be273",
49
+                "sha256:24adccf1e834f82718c7fc8e3ec1093738da95144b8b1e44c99d5fc7d3e9c554",
50
+                "sha256:2a3e362c97a5e6a259ee9cd66553292a1f8928a5bdfa3622fdb1501570834612",
51
+                "sha256:3832e26ecbc9d8a500821e3a1d3765bda99d04ae29ffbb2efba49f5f788dc934",
52
+                "sha256:4fd1f0c2dc02aaec729d91c92cd85a2df0289d88e9f68d1e8faba750bb9c4786",
53
+                "sha256:4fda62030f2c515b6e2e673c57caa55cb04026a81968f3128aae10fc28e5cc27",
54
+                "sha256:5044d75a68b49ce36a813c82d8201384207112d5d81643937fc758c05302f05b",
55
+                "sha256:522184556921512ec484cb93bd84e0bab915d0ac5a372d49571c241a7f73db62",
56
+                "sha256:5914cff11f3e920626da48e564be6818831713a3087586302444b9c70e8552d9",
57
+                "sha256:6661a7908d68c4a133e03dac8178287aa20a99f841ea90beeb98a233ae3fd710",
58
+                "sha256:79258a8df3e309a54c7ef2ef4a59bb8e28f7e4a8992a3ad17c24b1889ced44f3",
59
+                "sha256:7d74c20b8f1c3e99d3f781d3b8ff5abfefdd7363d61e23bdeba9992ff32cc4b4",
60
+                "sha256:81918afeafc16ba5d9d0d4e9445905f21aac969a4ebb6f2bff4b9886da100f4b",
61
+                "sha256:8194d913ca1f459377c8a4ed8f9b7ad750068b8e0e3f3f9c6963fcc87a84515f",
62
+                "sha256:84d5d31200b11b3c76fab853b89ac898bf2d05c8b3da07c1fcc23feb06359d6e",
63
+                "sha256:989981db57abffb52026b114c9a1f114c7142860a6d30a352d28f8cbf186500b",
64
+                "sha256:a3d7511d3fad1618a82299aab71a5fceee5c015653a77ffea75ced9ef917e71a",
65
+                "sha256:b3ef168d4d6fd4fa6685aef7c91400f59f7ab1c0da734541f7031699741fb23f",
66
+                "sha256:c1c5792b6e74bbf2af0f8e892272c2a6c48efa895903211f11b8342e03129fea",
67
+                "sha256:c5dcb5a56aebb8a8f2585042b2f5c496d7624f0bcfe248f0cc33ceb2fd8d39e7",
68
+                "sha256:e2bed4a04e2ca1050bb5f00865cf2f83c0b92fd62454d9244f690fcd842e27a4",
69
+                "sha256:e87a527c06319428007e8c30511e1f0ce035cb7f14bb4793b003ed532c3b9333",
70
+                "sha256:f63e420180cbe22ff6e32558b612e75f50616fc111c5e095a4631946c782e109",
71
+                "sha256:f8b3d413c5a8f84b12cd4c5df1d8e211777c9852c6be3ee9c094b626644d3eab"
72
+            ],
73
+            "index": "pypi",
74
+            "markers": "python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*' and python_version >= '2.7'",
75
+            "version": "==5.2.0"
76
+        },
77
+        "requests": {
78
+            "hashes": [
79
+                "sha256:63b52e3c866428a224f97cab011de738c36aec0185aa91cfacd418b5d58911d1",
80
+                "sha256:ec22d826a36ed72a7358ff3fe56cbd4ba69dd7a6718ffd450ff0e9df7a47ce6a"
81
+            ],
82
+            "index": "pypi",
83
+            "version": "==2.19.1"
84
+        },
85
+        "urllib3": {
86
+            "hashes": [
87
+                "sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf",
88
+                "sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"
89
+            ],
90
+            "markers": "python_version != '3.3.*' and python_version >= '2.6' and python_version != '3.2.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version < '4'",
91
+            "version": "==1.23"
92
+        }
93
+    },
94
+    "develop": {}
95
+}

+ 13
- 0
README.md View File

@@ -0,0 +1,13 @@
1
+# Silicon Dawn
2
+
3
+I made this so I can pull random cards on my phone and review the text.
4
+
5
+I also want to make a card reference out of this as well.
6
+
7
+I designed this for use in [Pythonista](http://omz-software.com/pythonista/) but it's basic enough to be portable
8
+
9
+## Instructions
10
+
11
+1. Run `pipenv install` if running on a computer to pull deps
12
+1. Run `get.py` if you don't have the cards yet
13
+1. Run `pick.py` to get a random card and description

+ 29
- 0
get.py View File

@@ -0,0 +1,29 @@
1
+#!/usr/bin/env python3
2
+"""
3
+I didn't want to include the files in a git repo so I made this retriever.
4
+Like anything that grabs files from the internet it is annoying on many fronts.
5
+If Egypt Ernash moves this file it breaks; if cloudflare hates you, it breaks.
6
+"""
7
+
8
+from pathlib import Path
9
+from zipfile import ZipFile
10
+import requests
11
+
12
+CARDS_URL = "http://egypt.urnash.com/media/blogs.dir/1/files/2018/01/The-Tarot-of-the-Silicon-Dawn.zip"
13
+ZIP_FILE = "The-Tarot-of-the-Silicon-Dawn.zip"
14
+
15
+
16
+def main():
17
+    if not Path(ZIP_FILE).exists() and ZipFile(ZIP_FILE).testzip() is None:
18
+        zip_data = requests.get(CARDS_URL)
19
+        with open(ZIP_FILE, 'wb') as zip_file:
20
+            zip_file.write(zip_data.content)
21
+
22
+    with ZipFile(ZIP_FILE) as zip_file:
23
+        for file in zip_file.filelist:
24
+            if "_MACOSX" not in file.filename and "sand-home" not in file.filename:
25
+                zip_file.extract(file)
26
+
27
+
28
+if __name__ == '__main__':
29
+    main()

+ 32
- 0
pick.py View File

@@ -0,0 +1,32 @@
1
+#!/usr/bin/env python3
2
+"""
3
+Pick a card, any card
4
+"""
5
+from PIL import Image
6
+from pathlib import Path
7
+import random
8
+
9
+TAROT_FOLDER = "The Tarot of the Silicon Dawn"
10
+CARD_GLOB = "*.jpg"
11
+TEXT_ENDING = "-text.png"
12
+
13
+
14
+def main():
15
+    tarot_path = Path(TAROT_FOLDER)
16
+
17
+    cards = [x for x in tarot_path.glob(CARD_GLOB) if "sand-home" not in x]
18
+
19
+    pick_front = random.choice(cards)
20
+    pick_text = tarot_path.joinpath(f'{pick_front.stem}{TEXT_ENDING}')
21
+
22
+    print(f'My pick is {pick_front.stem}')
23
+
24
+    card_img = Image.open(pick_front)
25
+    card_img.show()
26
+
27
+    text_img = Image.open(pick_text)
28
+    text_img.show()
29
+
30
+
31
+if __name__ == '__main__':
32
+    main()

Loading…
Cancel
Save