Skip to content

Commit

Permalink
Merge pull request #31 from iscc/develop
Browse files Browse the repository at this point in the history
XHTML Support and bugfixes
  • Loading branch information
titusz authored Feb 18, 2020
2 parents dd0c77b + 0b12d68 commit c4bf075
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ You may also want join our developer chat on Telegram at <https://t.me/iscc_dev>

## Change Log

### [0.9.3] - 2020-02-18
- Add support for XHTML
- Fix error on unsupported media types

### [0.9.2] - 2020-01-30
- Add support for bmp, psd, xls, xlsx
- Add tika server live testing
Expand Down
2 changes: 1 addition & 1 deletion iscc_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import click
from tika import tika

__version__ = "0.9.2"
__version__ = "0.9.3"

APP_NAME = "iscc-cli"
APP_DIR = click.get_app_dir(APP_NAME, roaming=False)
Expand Down
3 changes: 3 additions & 0 deletions iscc_cli/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def batch(path, recursive, guess):
elif gmt == GMT.VIDEO:
features = video_id.get_frame_vectors(abspath(f))
cid = video_id.content_id_video(features)
else:
click.echo("Could not generate ISCC")
continue

did = iscc.data_id(f)
iid, tophash = iscc.instance_id(f)
Expand Down
1 change: 1 addition & 0 deletions iscc_cli/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class GMT:
"application/pdf": {"gmt": GMT.TEXT, "ext": "pdf"},
"application/epub+zip": {"gmt": GMT.TEXT, "ext": "epub"},
"application/xml": {"gmt": GMT.TEXT, "ext": "xml"},
"application/xhtml+xml": {"gmt": GMT.TEXT, "ext": "xhtml"},
"application/vnd.oasis.opendocument.text": {"gmt": GMT.TEXT, "ext": "odt"},
"text/html": {"gmt": GMT.TEXT, "ext": "html"},
"text/plain": {"gmt": GMT.TEXT, "ext": "txt"},
Expand Down
3 changes: 3 additions & 0 deletions iscc_cli/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def gen(file, guess, title, extra, verbose):
elif gmt == GMT.VIDEO:
features = video_id.get_frame_vectors(abspath(file.name))
cid = video_id.content_id_video(features)
else:
click.echo("Could not generate ISCC")
return

did = iscc.data_id(file.name)
iid, tophash = iscc.instance_id(file.name)
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "iscc-cli"
version = "0.9.2"
version = "0.9.3"
description = "ISCC CLI - Creates ISCC Codes from Media Files"
authors = ["Titusz Pan <[email protected]>"]
license = "MIT"
Expand Down
20 changes: 20 additions & 0 deletions tests/test_formats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
from tests import ROOT_DIR
from iscc_cli.cli import cli
from click.testing import CliRunner


os.chdir(ROOT_DIR)
r = CliRunner()


def test_unsupported():
result = r.invoke(cli, ["gen", "tests/text/demo.json"])
assert result.exit_code == 0
assert "Unsupported media type" in result.output


def test_xhtml():
result = r.invoke(cli, ["gen", "tests/text/demo.xhtml"])
assert result.exit_code == 0
assert "CTMjk4o5H96BV" in result.output
18 changes: 18 additions & 0 deletions tests/text/demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"title": "The Neverending Story",
"meta":
[{
"schema": "schema.org",
"mediatype": "application/ld+json",
"data":
{
"@context": "http://schema.org",
"@type": "Movie",
"name": "The Neverending Story",
"dateCreated": "6 April, 1984",
"director": "Wolfgang Petersen",
"actors": ["Noah Hathaway", "Barret Oliver", "Tami Stronach"],
"duration": "1:42:00"
}
}]
}
34 changes: 34 additions & 0 deletions tests/text/demo.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>demo</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<h1 id="iscc-test-document">ISCC Test Document</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
<p>Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.</p>
<p>At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.</p>
<p>Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.</p>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</p>
<p>Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</body>
</html>

0 comments on commit c4bf075

Please sign in to comment.