Added dev tools
This commit is contained in:
@@ -1720,7 +1720,7 @@ Substitution Description
|
||||
{lf} A line feed: '\n', alias for {newline}
|
||||
{cr} A carriage return: '\r'
|
||||
{crlf} a carriage return + line feed: '\r\n'
|
||||
{osxphotos_version} The osxphotos version, e.g. '0.44.8'
|
||||
{osxphotos_version} The osxphotos version, e.g. '0.44.9'
|
||||
{osxphotos_cmd_line} The full command line used to run osxphotos
|
||||
|
||||
The following substitutions may result in multiple values. Thus if specified for
|
||||
@@ -3622,7 +3622,7 @@ The following template field substitutions are availabe for use the templating s
|
||||
|{lf}|A line feed: '\n', alias for {newline}|
|
||||
|{cr}|A carriage return: '\r'|
|
||||
|{crlf}|a carriage return + line feed: '\r\n'|
|
||||
|{osxphotos_version}|The osxphotos version, e.g. '0.44.8'|
|
||||
|{osxphotos_version}|The osxphotos version, e.g. '0.44.9'|
|
||||
|{osxphotos_cmd_line}|The full command line used to run osxphotos|
|
||||
|{album}|Album(s) photo is contained in|
|
||||
|{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: fff79f4920939baa44eddc90423972ec
|
||||
config: 7f709983e4cb93aeb5bcc8c73a7d13f9
|
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||
|
||||
2
docs/_static/documentation_options.js
vendored
2
docs/_static/documentation_options.js
vendored
@@ -1,6 +1,6 @@
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
|
||||
VERSION: '0.44.8',
|
||||
VERSION: '0.44.9',
|
||||
LANGUAGE: 'None',
|
||||
COLLAPSE_INDEX: false,
|
||||
BUILDER: 'html',
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>osxphotos command line interface (CLI) — osxphotos 0.44.8 documentation</title>
|
||||
<title>osxphotos command line interface (CLI) — osxphotos 0.44.9 documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Index — osxphotos 0.44.8 documentation</title>
|
||||
<title>Index — osxphotos 0.44.9 documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Welcome to osxphotos’s documentation! — osxphotos 0.44.8 documentation</title>
|
||||
<title>Welcome to osxphotos’s documentation! — osxphotos 0.44.9 documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>osxphotos — osxphotos 0.44.8 documentation</title>
|
||||
<title>osxphotos — osxphotos 0.44.9 documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>osxphotos package — osxphotos 0.44.8 documentation</title>
|
||||
<title>osxphotos package — osxphotos 0.44.9 documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Search — osxphotos 0.44.8 documentation</title>
|
||||
<title>Search — osxphotos 0.44.9 documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" />
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ _PHOTOS_5_VERSION = "5000" # I've seen both 5001 and 6000. 6000 is most common
|
||||
# Ranges for model version by Photos version
|
||||
_PHOTOS_5_MODEL_VERSION = [13000, 13999]
|
||||
_PHOTOS_6_MODEL_VERSION = [14000, 14999]
|
||||
_PHOTOS_7_MODEL_VERSION = [15000, 15999] # Monterey developer preview is 15134
|
||||
_PHOTOS_7_MODEL_VERSION = [15000, 15999] # Monterey developer preview is 15134, 12.1 is 15331
|
||||
|
||||
# some table names differ between Photos 5 and Photos 6
|
||||
_DB_TABLE_NAMES = {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
""" version info """
|
||||
|
||||
__version__ = "0.44.8"
|
||||
__version__ = "0.44.9"
|
||||
|
||||
@@ -4361,12 +4361,12 @@ def debug_dump(ctx, cli_obj, db, photos_library, dump, uuid, verbose):
|
||||
print(f"Did not find attribute {attr} in PhotosDB")
|
||||
|
||||
|
||||
@cli.command(name="snap", hidden=True)
|
||||
@cli.command(name="snap")
|
||||
@click.pass_obj
|
||||
@click.pass_context
|
||||
@DB_OPTION
|
||||
def snap(ctx, cli_obj, db):
|
||||
"""Create a snapshot of a Photos library database for use with `osxphotos diff`
|
||||
"""Create snapshot of Photos database to use with diff command
|
||||
|
||||
Snapshots only the database files, not the entire library. If OSXPHOTOS_SNAPSHOT
|
||||
environment variable is defined, will use that as snapshot directory, otherwise
|
||||
@@ -4403,7 +4403,7 @@ def snap(ctx, cli_obj, db):
|
||||
print(f"Copied {count} files from {db_path} to {destination_path}")
|
||||
|
||||
|
||||
@cli.command(name="diff", hidden=True)
|
||||
@cli.command(name="diff")
|
||||
@click.pass_obj
|
||||
@click.pass_context
|
||||
@DB_OPTION
|
||||
@@ -4414,10 +4414,20 @@ def snap(ctx, cli_obj, db):
|
||||
default=False,
|
||||
help="Print raw output (don't use syntax highlighting).",
|
||||
)
|
||||
@click.option(
|
||||
"--style",
|
||||
"-s",
|
||||
metavar="STYLE",
|
||||
nargs=1,
|
||||
default="monokai",
|
||||
help = "Specify style/theme for syntax highlighting. "
|
||||
"Theme may be any valid pygments style (https://pygments.org/styles/). "
|
||||
"Default is 'monokai'.",
|
||||
)
|
||||
@click.argument("db2", nargs=-1, type=click.Path(exists=True))
|
||||
@click.option("--verbose", "-V", "verbose", is_flag=True, help="Print verbose output.")
|
||||
def diff(ctx, cli_obj, db, raw_output, db2, verbose):
|
||||
"""Compares two Photos libraries and prints out differences
|
||||
def diff(ctx, cli_obj, db, raw_output, style, db2, verbose):
|
||||
"""Compare two Photos databases and print out differences
|
||||
|
||||
To use the diff command, you'll need to install sqldiff via homebrew:
|
||||
|
||||
@@ -4481,12 +4491,14 @@ def diff(ctx, cli_obj, db, raw_output, db2, verbose):
|
||||
|
||||
verbose_(f"Comparing databases {db_1} and {db_2}")
|
||||
|
||||
output = os.popen(f"{sqldiff} {db_2} {db_1}").read()
|
||||
diff_proc = subprocess.Popen([sqldiff, db_2, db_1], stdout=subprocess.PIPE)
|
||||
console = Console()
|
||||
for line in iter(diff_proc.stdout.readline, b""):
|
||||
line = line.decode("UTF-8").rstrip()
|
||||
if raw_output:
|
||||
print(output)
|
||||
print(line)
|
||||
else:
|
||||
syntax = Syntax(
|
||||
output, "sql", theme="monokai", line_numbers=False, code_width=1000
|
||||
line, "sql", theme=style, line_numbers=False, code_width=1000
|
||||
)
|
||||
console = Console()
|
||||
console.print(syntax)
|
||||
|
||||
Reference in New Issue
Block a user