{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pma_python import core\n", "from datetime import date\n", "from os import mkdir\n", "from os.path import exists" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# connect to PMA.start\n", "core.connect()\n", "\n", "# uncomment the following line for PMA.core\n", "# core.connect(\"https://server/core\", \"user\", \"S3CR3T\") " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "core.get_root_directories()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "slides = core.get_slides(\"C:/slides\", recursive=True)\n", "print(len(slides))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "f = open(\"c:/catalog/cat1.html\", \"w+\")\n", "f.write(\"\")\n", "f.write(\"Market slide catalog created on \" + str(date.today()) + \"\")\n", "f.write(\"\")\n", "for slide in slides:\n", " f.write(slide + \"
\")\n", "f.write(\"\")\n", "f.write(\"\")\n", "f.close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "f = open(\"c:/catalog/cat2.html\", \"w+\")\n", "f.write(\"\")\n", "f.write(\"Market slide catalog created on \" + str(date.today()) + \"\")\n", "f.write(\"\")\n", "for slide in slides:\n", " thumb = core.get_thumbnail_url(slide)\n", " f.write(\"\" + slide + \"
\")\n", "f.write(\"\")\n", "f.write(\"\")\n", "f.close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "f = open(\"c:/catalog/cat3.html\", \"w+\")\n", "f.write(\"\")\n", "f.write(\"Market slide catalog created on \" + str(date.today()) + \"\")\n", "f.write(\"\")\n", "for slide in slides:\n", " thumb = core.get_thumbnail_url(slide)\n", " f.write(\"\" + slide + \"
\")\n", "f.write(\"\")\n", "f.write(\"\")\n", "f.close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "dir = \"c:/catalog/cat4/\"\n", "if not exists(dir): \n", " mkdir(dir)\n", "f = open(\"c:/catalog/cat4.html\", \"w+\")\n", "f.write(\"\")\n", "f.write(\"Market slide catalog created on \" + str(date.today()) + \"\")\n", "f.write(\"\")\n", "for slide in slides:\n", " thumb = core.get_thumbnail_image(slide)\n", " fn = core.get_slide_file_name(slide) + \".jpg\"\n", " thumb_fn = dir + fn\n", " print(\"Saving thumbnail as \", thumb_fn)\n", " thumb.save(thumb_fn)\n", " f.write(\"\")\n", " f.write(\"\")\n", " f.write(\"\" + slide + \"
\")\n", "f.write(\"\")\n", "f.write(\"\")\n", "f.close()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }