commit 6ee322316bcbd8c9719954b5393aad6e6967c36e Author: buttle Date: Sat Apr 17 19:13:22 2021 +0200 first commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9bd6b00 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Neo-Inspiration + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Module.php b/Module.php new file mode 100644 index 0000000..276abe9 --- /dev/null +++ b/Module.php @@ -0,0 +1,27 @@ + 'Video', + 'audio' => 'Audio', + ]; + + const RATIOS = [ + '1.777' => '16:9', + '1.333' => '4:3', + '2' => '2:1', + ]; + + public function getConfig() + { + return include __DIR__ . '/config/module.config.php'; + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..40e678d --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# Archive.org media for Omeka S + +[Archive.org media] is a module for [Omeka S] that integrates [Archive.org] media. + +## Install + +``` +cd ./modules +https://git.hangar.org/arcHIVE-tech/ArchiveOrg/archive/main.zip +unzip main.zip +mv panoramaviewer/ ArchiveOrg +``` + +## LISENCE +The module is released under the [MIT] License. + + +[arc-hive]: https://arc-hive.zone/ +[Archive Viewer]: https://git.hangar.org/arcHIVE-tech/ArchiveOrg +[Omeka S]: https://omeka.org/s +[MIT]: http://opensource.org/licenses/MIT diff --git a/asset/css/panoramaviewer.css b/asset/css/panoramaviewer.css new file mode 100644 index 0000000..24b6e1f --- /dev/null +++ b/asset/css/panoramaviewer.css @@ -0,0 +1,7 @@ +/* Panaorama viewer custom */ +@media screen { + .panorama-viewer { + /* width: 600px; */ + /* height: 400px; */ + } +} diff --git a/config/module.config.php b/config/module.config.php new file mode 100644 index 0000000..dae5a19 --- /dev/null +++ b/config/module.config.php @@ -0,0 +1,40 @@ + [ + 'template_path_stack' => [ + dirname(__DIR__) . '/view', + ] + ], + 'block_layouts' => [ + 'factories' => [ + 'archiveOrg' => Service\BlockLayout\ArchiveOrgFactory::class, + ], + ], + 'form_elements' => [ + 'invokables' => [ + Form\ArchiveOrgBlockForm::class => Form\ArchiveOrgBlockForm::class, + ], + ], + 'media_ingesters' => [ + 'factories' => [ + 'ArchiveOrg_media' => Service\Media\Ingester\ArchiveOrgMediaFactory::class, + ], + ], + 'media_renderers' => [ + 'invokables' => [ + 'ArchiveOrg_media' => Media\Renderer\ArchiveOrgMediaRenderer::class, + ], + ], + 'DefaultSettings' => [ + 'ArchiveOrgBlockForm' => [ + 'media_type' => 'video', + 'title' => '', + 'width' => 600, + 'ratio' => '2', + 'autoLoad' => false, + 'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;', + ] + ] +]; diff --git a/config/module.ini b/config/module.ini new file mode 100644 index 0000000..44925b2 --- /dev/null +++ b/config/module.ini @@ -0,0 +1,12 @@ +[info] +name = "Archive.org media viewer" +description = "Embed Archive.org media" +tags = "" +license = "MIT" +author = "Hangar.org" +author_link = "https://git.hangar.org/chris" +module_link = "https://git.hangar.org/arcHIVE-tech/ArchiveOrg" +support_link = "https://git.hangar.org/arcHIVE-tech/ArchiveOrg/issues" +configurable = false +version = "1.0.0" +omeka_version_constraint = "^3.0.1" diff --git a/src/Form/ArchiveOrgBlockForm.php b/src/Form/ArchiveOrgBlockForm.php new file mode 100644 index 0000000..3e07061 --- /dev/null +++ b/src/Form/ArchiveOrgBlockForm.php @@ -0,0 +1,51 @@ +add([ + 'name' => 'o:block[__blockIndex__][o:data][title]', + 'type' => Element\Text::class, + 'options' => [ + 'label' => 'Title (option)', + ] + ]); + + $this->add([ + 'name' => 'o:block[__blockIndex__][o:data][media_type]', + 'type' => Element\Select::class, + 'options' => [ + 'label' => 'Media type', + 'value_options' => Module::MEDIA_TYPE, + ], + ]); + + $this->add([ + 'name' => 'o:block[__blockIndex__][o:data][width]', + 'type' => Element\Number::class, + 'options' => [ + 'label' => 'Video width in pixels', + ], + 'attributes' => [ + 'min' => '100', + ], + ]); + + $this->add([ + 'name' => 'o:block[__blockIndex__][o:data][ratio]', + 'type' => Element\Select::class, + 'options' => [ + 'label' => 'Video ratio', + 'value_options' => Module::RATIOS, + ], + ]); + + } +} diff --git a/src/Media/Ingester/ArchiveOrgMediaIngester.php b/src/Media/Ingester/ArchiveOrgMediaIngester.php new file mode 100644 index 0000000..8801982 --- /dev/null +++ b/src/Media/Ingester/ArchiveOrgMediaIngester.php @@ -0,0 +1,49 @@ +client = $client; + } + public function getLabel() + { + return 'Archive.org media'; // @translate + } + public function getRenderer() + { + return 'ArchiveOrg_media'; + } + public function form(PhpRenderer $view, array $options = []) + { + $input = new Text('o:media[__index__][o:identifier]'); + $input->setOptions([ + 'label' => 'Indentifier', // @translate + ]); + $input->setAttributes([ + 'required' => true, + ]); + return $view->formRow($input); + } + public function ingest(Media $media, Request $request, ErrorStore $errorStore) + { + // Validate the request data. + $data = $request->getContent(); + if (!isset($data['o:identifier'])) { + $errorStore->addError('o:identifier', 'No identifier specified'); + return; + } + $url = 'https://archive.org/embed/' . $data['o:identifier']; + $media->setSource($url); + } +} diff --git a/src/Media/Renderer/ArchiveOrgMediaRenderer.php b/src/Media/Renderer/ArchiveOrgMediaRenderer.php new file mode 100644 index 0000000..337c50f --- /dev/null +++ b/src/Media/Renderer/ArchiveOrgMediaRenderer.php @@ -0,0 +1,23 @@ +source(); + $html = ' + + + + + + + + +