Skip to content

Commit

Permalink
3.0.040
Browse files Browse the repository at this point in the history
  • Loading branch information
chapmanjacobd committed Jan 18, 2025
1 parent a224ca1 commit 67853dd
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 131 deletions.
20 changes: 19 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ To stop playing press Ctrl+C in either the terminal or mpv
<details><summary>List all subcommands</summary>

$ library
library (v3.0.039; 101 subcommands)
library (v3.0.040; 101 subcommands)

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


</details>

###### getty-add

<details><summary>Create / Update a Getty Museum database</summary>

$ library getty-add -h
usage: library getty-add DATABASE

Download metadata

library getty-add getty.db -v

Download images

library download --fs getty.db --prefix ~/images/ -v


</details>

###### substack
Expand Down
2 changes: 1 addition & 1 deletion library/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from library.utils import argparse_utils, iterables
from library.utils.log_utils import log

__version__ = "3.0.039"
__version__ = "3.0.040"

progs = {
"Create database subcommands": {
Expand Down
10 changes: 5 additions & 5 deletions library/createdb/getty_add.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import random, sqlite3
import sqlite3

from library import usage
from library.utils import arggroups, argparse_utils, iterables, web
from library.utils.log_utils import log
from library.utils.objects import traverse_obj


def parse_args():
parser = argparse_utils.ArgumentParser()
parser = argparse_utils.ArgumentParser(usage=usage.getty_add)
arggroups.requests(parser)

arggroups.debug(parser)
Expand Down Expand Up @@ -187,20 +188,19 @@ def update_objects(args):
d["path"]
for d in args.db.query(
"""
SELECT path FROM activity_stream WHERE type = 'HumanMadeObject'
SELECT DISTINCT path FROM activity_stream WHERE type = 'HumanMadeObject'
EXCEPT
SELECT object_path FROM media
"""
)
]
except sqlite3.OperationalError:
unknown_objects = [
d["path"] for d in args.db.query("SELECT path FROM activity_stream WHERE type = 'HumanMadeObject'")
d["path"] for d in args.db.query("SELECT DISTINCT path FROM activity_stream WHERE type = 'HumanMadeObject'")
]

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

random.shuffle(unknown_objects)
for unknown_object in unknown_objects:
log.debug("Fetching %s...", unknown_object)

Expand Down
11 changes: 11 additions & 0 deletions library/usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2005,3 +2005,14 @@ def play(action) -> str:
library allocate-torrents computers.db torrents.db -s specific words or tracker
"""

getty_add = """library getty-add DATABASE
Download metadata
library getty-add getty.db -v
Download images
library download --fs getty.db --prefix ~/images/ -v
"""
244 changes: 124 additions & 120 deletions pdm.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/createdb/test_getty_add.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#
1 change: 1 addition & 0 deletions tests/playback/test_torrents_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#
8 changes: 4 additions & 4 deletions tests/tablefiles/test_markdown_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
["tests/data/test.xml"],
"""## tests/data/test.xml:0
| index | A | B | C |
|---------|-----|-----|-----|
| 0 | 1 | 3 | 5 |
| 1 | 2 | 4 | 6 |
index A B C
------- --- --- ---
0 1 3 5
1 2 4 6
""",
),
],
Expand Down

0 comments on commit 67853dd

Please sign in to comment.