Skip to content

Commit 67853dd

Browse files
committed
3.0.040
1 parent a224ca1 commit 67853dd

File tree

8 files changed

+166
-131
lines changed

8 files changed

+166
-131
lines changed

.github/README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ To stop playing press Ctrl+C in either the terminal or mpv
9999
<details><summary>List all subcommands</summary>
100100

101101
$ library
102-
library (v3.0.039; 101 subcommands)
102+
library (v3.0.040; 101 subcommands)
103103

104104
Create database subcommands:
105105
╭─────────────────┬──────────────────────────────────────────╮
@@ -897,6 +897,24 @@ BTW, for some cols like time_deleted you'll need to specify a where clause so th
897897
library hnadd --oldest hn.db
898898

899899

900+
</details>
901+
902+
###### getty-add
903+
904+
<details><summary>Create / Update a Getty Museum database</summary>
905+
906+
$ library getty-add -h
907+
usage: library getty-add DATABASE
908+
909+
Download metadata
910+
911+
library getty-add getty.db -v
912+
913+
Download images
914+
915+
library download --fs getty.db --prefix ~/images/ -v
916+
917+
900918
</details>
901919

902920
###### substack

library/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from library.utils import argparse_utils, iterables
66
from library.utils.log_utils import log
77

8-
__version__ = "3.0.039"
8+
__version__ = "3.0.040"
99

1010
progs = {
1111
"Create database subcommands": {

library/createdb/getty_add.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import random, sqlite3
1+
import sqlite3
22

3+
from library import usage
34
from library.utils import arggroups, argparse_utils, iterables, web
45
from library.utils.log_utils import log
56
from library.utils.objects import traverse_obj
67

78

89
def parse_args():
9-
parser = argparse_utils.ArgumentParser()
10+
parser = argparse_utils.ArgumentParser(usage=usage.getty_add)
1011
arggroups.requests(parser)
1112

1213
arggroups.debug(parser)
@@ -187,20 +188,19 @@ def update_objects(args):
187188
d["path"]
188189
for d in args.db.query(
189190
"""
190-
SELECT path FROM activity_stream WHERE type = 'HumanMadeObject'
191+
SELECT DISTINCT path FROM activity_stream WHERE type = 'HumanMadeObject'
191192
EXCEPT
192193
SELECT object_path FROM media
193194
"""
194195
)
195196
]
196197
except sqlite3.OperationalError:
197198
unknown_objects = [
198-
d["path"] for d in args.db.query("SELECT path FROM activity_stream WHERE type = 'HumanMadeObject'")
199+
d["path"] for d in args.db.query("SELECT DISTINCT path FROM activity_stream WHERE type = 'HumanMadeObject'")
199200
]
200201

201202
print("Fetching", len(unknown_objects), "unknown objects")
202203

203-
random.shuffle(unknown_objects)
204204
for unknown_object in unknown_objects:
205205
log.debug("Fetching %s...", unknown_object)
206206

library/usage.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,3 +2005,14 @@ def play(action) -> str:
20052005
20062006
library allocate-torrents computers.db torrents.db -s specific words or tracker
20072007
"""
2008+
2009+
getty_add = """library getty-add DATABASE
2010+
2011+
Download metadata
2012+
2013+
library getty-add getty.db -v
2014+
2015+
Download images
2016+
2017+
library download --fs getty.db --prefix ~/images/ -v
2018+
"""

pdm.lock

Lines changed: 124 additions & 120 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/createdb/test_getty_add.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#

tests/tablefiles/test_markdown_tables.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
["tests/data/test.xml"],
1515
"""## tests/data/test.xml:0
1616
17-
| index | A | B | C |
18-
|---------|-----|-----|-----|
19-
| 0 | 1 | 3 | 5 |
20-
| 1 | 2 | 4 | 6 |
17+
index A B C
18+
------- --- --- ---
19+
0 1 3 5
20+
1 2 4 6
2121
""",
2222
),
2323
],

0 commit comments

Comments
 (0)