Skip to content

Commit

Permalink
Merge pull request #26 from iscc/fix-app-dir
Browse files Browse the repository at this point in the history
Fix app dir
  • Loading branch information
titusz authored Jan 5, 2020
2 parents 7b186ff + 2354f39 commit 9b961e5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,16 @@ You may also want join our developer chat on Telegram at <https://t.me/iscc_dev>

## Change Log

### [0.9.1] - 2020-01-05
- Fix issue with APP_DIR creation

### [0.9.0] - 2020-01-05
- Add experimental support for Video-ID
- Add special handling of YouTube URLs
- Add support for more Media Types (try & error)
- Add support for Python 3.8
- Remove support for Python 3.5


### [0.8.2] - 2019-12-22
- Add new `test` command for confromance testing
- Add support for .md (Markdown) files
Expand Down
3 changes: 2 additions & 1 deletion iscc_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import os
import click

__version__ = "0.9.0"
__version__ = "0.9.1"

APP_NAME = "iscc-cli"
APP_DIR = click.get_app_dir(APP_NAME, roaming=False)
os.makedirs(iscc_cli.APP_DIR, exist_ok=True)

os.environ["TIKA_PATH"] = APP_DIR
1 change: 0 additions & 1 deletion iscc_cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def download_file(url, md5=None, sanitize=False):
md5_calc = hashlib.md5(open(out_path, "rb").read()).hexdigest()
assert md5 == md5_calc
return out_path
os.makedirs(iscc_cli.APP_DIR, exist_ok=True)
r = requests.get(url, stream=True)
length = int(r.headers["content-length"])
chunk_size = 512
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "iscc-cli"
version = "0.9.0"
version = "0.9.1"
description = "ISCC CLI - Creates ISCC Codes from Media Files"
authors = ["Titusz Pan <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -37,10 +37,10 @@ click = "^7.0"
iscc = "1.0.5"
tika = "1.23"
click-default-group = "^1.2"
colorama = "^0.4.1"
imageio-ffmpeg = "^0.3.0"
lxml = "^4.4.2"
pytube = "^9.5.3"
colorama = "^0.4"
imageio-ffmpeg = "^0.3"
lxml = "^4.4"
pytube = "^9.5"

[tool.poetry.dev-dependencies]
pytest = "^5.0"
Expand Down
14 changes: 7 additions & 7 deletions tests/test_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ def test_gen_single_file():


def test_gen_single_guess():
result = r.invoke(cli, ["gen", "tests/text/demo.txt"])
result = r.invoke(cli, ["gen", "tests/text/demo.doc"])
assert result.exit_code == 0
assert "ISCC:CTMjk4o5H96BV-CDcDwBFVJ54fe-CR7LRzaAJGwqX" in result.output
result = r.invoke(cli, ["gen", "-g", "tests/text/demo.txt"])
assert "ISCC:CCKzUpp6U5hU7-CTMjk4o5H96BV-CDM6E14HcCZjQ-CR1LUvGDVrWye" in result.output
result = r.invoke(cli, ["gen", "-g", "tests/text/demo.doc"])
assert result.exit_code == 0
assert (
"ISCC:CCFZWbGjth3qz-CTMjk4o5H96BV-CDcDwBFVJ54fe-CR7LRzaAJGwqX" in result.output
"ISCC:CCKzUpp6U5hU7-CTMjk4o5H96BV-CDM6E14HcCZjQ-CR1LUvGDVrWye" in result.output
)


def test_gen_python_call():
from iscc_cli.gen import gen

file = open("tests/text/demo.txt")
file = open("tests/text/demo.doc")
result = gen.callback(file, True, "", "", True)
assert result["iscc"] == "CCFZWbGjth3qz-CTMjk4o5H96BV-CDcDwBFVJ54fe-CR7LRzaAJGwqX"
assert result["norm_title"] == "iscc test document"
assert result["iscc"] == "CCKzUpp6U5hU7-CTMjk4o5H96BV-CDM6E14HcCZjQ-CR1LUvGDVrWye"
assert result["norm_title"] == "demo doc title from metadata"

0 comments on commit 9b961e5

Please sign in to comment.