Japan Search Gallery client

Tools to interact with the Japan Search Gallery

source

JpsCuration

 JpsCuration (curationType='GALLERY', version=1, rightsType='ccby')

Initialize self. See help(type(self)) for accurate signature.


source

JpsCurationText

 JpsCurationText ()

Text


source

JpsCurationTimepoint

 JpsCurationTimepoint (name_ja, name_en, start, end, startFraction=0,
                       endFraction=0, labelHeight=1)

Timepoint


source

JpsCurationTimeline

 JpsCurationTimeline (start, end, layout='bar')

Timeline


source

Part

 Part (type, viewType=None)

Initialize self. See help(type(self)) for accurate signature.

Type Default Details
type
viewType NoneType None , viewType

source

JpsCurationIIIFImage

 JpsCurationIIIFImage (manifestUrl, infoJsonUrl, title, source, xywh=None)

Initialize self. See help(type(self)) for accurate signature.


source

Media

 Media (type, title, source)

Initialize self. See help(type(self)) for accurate signature.


source

Component

 Component ()

Initialize self. See help(type(self)) for accurate signature.

First import the JPSGalleryClient class.

from jps_gallery_tools.api import JPSGalleryClient

To initialise the JPSGalleryClient you need to provide the base url of your Omeka instance’s API.

gallery = JpsCuration()

ギャラリーのメタデータの設定

ギャラリーのメタデータを設定します。


source

Component.setLangMetadata

 Component.setLangMetadata (key, lang, value)

メタデータの設定

Parameters:
* key - title, description, etc…
* lang - one of 言語, eg: ‘ja’, ‘en’, ‘yomi’
* value - 値

タイトルの設定

gallery.setLangMetadata("title", "ja", "日本語タイトル")
gallery.setLangMetadata("title", "en", "English Title")
gallery.setLangMetadata("title", "yomi", "にほんごのよみ")

summaryの設定

gallery.setLangMetadata("summary", "ja", "日本語の概要文")
gallery.setLangMetadata("summary", "en", "English Summary")

responsibilityの設定

gallery.setLangMetadata("responsibility", "ja", "中村覚")
gallery.setLangMetadata("responsibility", "en", "Satoru Nakamura")

tagの設定


source

JpsCuration.addTag

 JpsCuration.addTag (tag)

タグを追加します。

Parameters:
* tag - タグ

gallery.addTag("はじめてのタグ")
gallery.addTag("二つ目のタグ")

画像の設定


source

JpsCurationUrlImage

 JpsCurationUrlImage (url, title, source, thumbnailUrl=None)

URLを指定して表示する画像に関するクラス

original_url = "https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s400"
thumbnail_url = "https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s180-c"
title = "初日の出のキャラクター"
source = "いらすとや"
top_image = JpsCurationUrlImage(original_url, title, source, thumbnail_url)

source

Part.setImage

 Part.setImage (image)
gallery.setImage(top_image)

パーツの追加


source

JpsCurationList

 JpsCurationList (viewType)

リストパーツ

part = JpsCurationList("tile")

メタデータの追加

part.setLangMetadata("title", "ja", "リストのタイトル")
part.setLangMetadata("title", "en", "List Title")

リストに画像の追加

item = JpsCurationListExternalLink()

source

Part.setUrl

 Part.setUrl (url)

外部リンクのURLを設定します。

Parameters:
* url - 外部リンクのURL

item.setUrl("https://www.irasutoya.com/2021/11/blog-post_91.html")

アイテムの追加


source

Component.addPart

 Component.addPart (part)

パーツの追加

Parameters: * part - パーツ

part.addPart(item)

Save json

設定した内容をjsonファイルに出力します。


source

JpsCuration.save

 JpsCuration.save (path)

JSONファイルの保存

Parameters:
* path - 出力先のパス

gallery.save("tmp/gallery.json")

source

JpsCuration.saveJsonl

 JpsCuration.saveJsonl (path)

JSONLファイルの保存

Parameters:
* path - 出力先のパス

gallery.saveJsonl("tmp/gallery.jsonl")

source

JpsCuration.encode

 JpsCuration.encode (curationType='NOTE')

Base64エンコード

Returns:
* str containing Base64 encoded representation of the gallery