From 7ac5a429b41acd2b71f064d72a63f982eb3370bd Mon Sep 17 00:00:00 2001 From: NohamR Date: Sun, 10 Sep 2023 01:18:36 +0200 Subject: [PATCH] add nathan --- .py/code1.0.ipynb | 1 - index.html | 43 +++++++++++++++++++++++-- py/.DS_Store | Bin 0 -> 6148 bytes py/code1.0.ipynb | 1 + {.py => py}/converter.py | 0 {.py => py}/csvpourprendreliens.py | 0 {.py => py}/libmanuelsaver.py | 0 py/nathan/.DS_Store | Bin 0 -> 10244 bytes py/nathan/9782091317243/.DS_Store | Bin 0 -> 6148 bytes py/nathan/get.py | 49 +++++++++++++++++++++++++++++ {.py => py}/numtest.py | 0 {.py => py}/png saver.py | 0 {.py => py}/script like.py | 0 {.py => py}/test 1.0.py | 0 {.py => py}/test 1.1.py | 0 {.py => py}/test2.py | 0 16 files changed, 90 insertions(+), 4 deletions(-) delete mode 100644 .py/code1.0.ipynb create mode 100644 py/.DS_Store create mode 100644 py/code1.0.ipynb rename {.py => py}/converter.py (100%) rename {.py => py}/csvpourprendreliens.py (100%) rename {.py => py}/libmanuelsaver.py (100%) create mode 100644 py/nathan/.DS_Store create mode 100644 py/nathan/9782091317243/.DS_Store create mode 100644 py/nathan/get.py rename {.py => py}/numtest.py (100%) rename {.py => py}/png saver.py (100%) rename {.py => py}/script like.py (100%) rename {.py => py}/test 1.0.py (100%) rename {.py => py}/test 1.1.py (100%) rename {.py => py}/test2.py (100%) diff --git a/.py/code1.0.ipynb b/.py/code1.0.ipynb deleted file mode 100644 index bbb8ed9..0000000 --- a/.py/code1.0.ipynb +++ /dev/null @@ -1 +0,0 @@ -{"cells":[{"cell_type":"code","execution_count":1,"metadata":{"cellView":"form","colab":{"base_uri":"https://localhost:8080/","height":375},"executionInfo":{"elapsed":7,"status":"error","timestamp":1680434191416,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"Q_VOKTuxaUwS","outputId":"41dcdd09-f7a8-469d-c660-422034f0a6ed"},"outputs":[{"ename":"MessageError","evalue":"ignored","output_type":"error","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mMessageError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msystem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'sudo apt install /usr/bin/wkhtmltox_0.12.6-1.bionic_amd64.deb'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mgoogle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolab\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mdrive\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0mdrive\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'/content/gdrive'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 16\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msystem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'pip install git+https://github.com/Wyattjoh/pushover'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.9/dist-packages/google/colab/drive.py\u001b[0m in \u001b[0;36mmount\u001b[0;34m(mountpoint, force_remount, timeout_ms, readonly)\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmount\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmountpoint\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mforce_remount\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_ms\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m120000\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreadonly\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0;34m\"\"\"Mount your Google Drive at the specified mountpoint path.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 103\u001b[0;31m return _mount(\n\u001b[0m\u001b[1;32m 104\u001b[0m \u001b[0mmountpoint\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 105\u001b[0m \u001b[0mforce_remount\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mforce_remount\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.9/dist-packages/google/colab/drive.py\u001b[0m in \u001b[0;36m_mount\u001b[0;34m(mountpoint, force_remount, timeout_ms, ephemeral, readonly)\u001b[0m\n\u001b[1;32m 130\u001b[0m )\n\u001b[1;32m 131\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mephemeral\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 132\u001b[0;31m _message.blocking_request(\n\u001b[0m\u001b[1;32m 133\u001b[0m \u001b[0;34m'request_auth'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m'authType'\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m'dfs_ephemeral'\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_sec\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 134\u001b[0m )\n","\u001b[0;32m/usr/local/lib/python3.9/dist-packages/google/colab/_message.py\u001b[0m in \u001b[0;36mblocking_request\u001b[0;34m(request_type, request, timeout_sec, parent)\u001b[0m\n\u001b[1;32m 175\u001b[0m \u001b[0mrequest_type\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrequest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparent\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mparent\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexpect_reply\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 176\u001b[0m )\n\u001b[0;32m--> 177\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mread_reply_from_input\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrequest_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout_sec\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;32m/usr/local/lib/python3.9/dist-packages/google/colab/_message.py\u001b[0m in \u001b[0;36mread_reply_from_input\u001b[0;34m(message_id, timeout_sec)\u001b[0m\n\u001b[1;32m 102\u001b[0m ):\n\u001b[1;32m 103\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m'error'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mreply\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mMessageError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreply\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'error'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mreply\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'data'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;31mMessageError\u001b[0m: Error: credential propagation was unsuccessful"]}],"source":["#@title Initialisation\n","!pip install pdfkit\n","!pip install pypdf\n","!mkdir gen\n","!chmod 777 /root/content/Manuel/wkhtmltopdf.exe\n","!cat /etc/os-release\n","!pip install pdfkit\n","\n","!wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb\n","\n","!cp wkhtmltox_0.12.6-1.bionic_amd64.deb /usr/bin\n","\n","!sudo apt install /usr/bin/wkhtmltox_0.12.6-1.bionic_amd64.deb\n","from google.colab import drive\n","drive.mount('/content/gdrive')\n","!pip install git+https://github.com/Wyattjoh/pushover"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"QoAsZb7mcKOZ"},"outputs":[],"source":["!mkdir /root/\n","!mkdir /root/content/\n","!mkdir /root/content/Manuel/\n","!mkdir /root/content/Manuel/gen/\n","!ls /root/content/Manuel/gen/\n","#be sure it return true "]},{"cell_type":"code","execution_count":2,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":189},"executionInfo":{"elapsed":450,"status":"error","timestamp":1680434256652,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"0lBO9lBT8o7q","outputId":"033fe8e9-0ebf-47d1-828c-6fffb4baa585"},"outputs":[{"ename":"NameError","evalue":"ignored","output_type":"error","traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mpdfkit\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_url\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"https://exobank.hachette-livre.fr/contents/final/9782017102106-fxl/OEBPS/Page_1.html?interface=postMessage\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"/root/content/Manuel/out.pdf\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m","\u001b[0;31mNameError\u001b[0m: name 'pdfkit' is not defined"]}],"source":["pdfkit.from_url(\"https://exobank.hachette-livre.fr/contents/final/9782017102106-fxl/OEBPS/Page_1.html?interface=postMessage\", \"/root/content/Manuel/out.pdf\")"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":132814,"status":"ok","timestamp":1680379287318,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"a1_iqy6WaIfD","outputId":"54588e2f-defc-4db5-d4ff-2b85d276bf6a"},"outputs":[{"name":"stdout","output_type":"stream","text":["eleve.pdf gdrive gen\tsample_data wkhtmltox_0.12.6-1.bionic_amd64.deb\n","Quel est l'id eleve ? 9782016291894\n","Quelle est l'édition ? \n","Quel est le nombre de pages ? 416\n","Quel est l'id professeur ? 9782016291900\n","Quel est le nom du manuel ? Histoire-Géographie-EMC 4e - Ed. 2021 Plaza\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_386.html\n","386/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_387.html\n","387/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_388.html\n","388/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_389.html\n","389/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_390.html\n","390/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_391.html\n","391/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_392.html\n","392/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_393.html\n","393/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_394.html\n","394/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_395.html\n","395/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_396.html\n","396/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_397.html\n","397/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_398.html\n","398/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_399.html\n","399/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_400.html\n","400/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_401.html\n","401/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_402.html\n","402/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_403.html\n","403/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_404.html\n","404/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_405.html\n","405/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_406.html\n","406/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_407.html\n","407/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_408.html\n","408/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_409.html\n","409/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_410.html\n","410/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_411.html\n","411/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_412.html\n","412/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_413.html\n","413/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_414.html\n","414/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_415.html\n","415/416\n","https://exobank.hachette-livre.fr/contents/final/9782016291900-fxl/OEBPS/Page_416.html\n","416/416\n","Gen pdfs en 116.2006 secondes\n","Gen pdf unique en 16.0256 secondes\n","Tout en 132.2262 secondes\n","DONE\n","\n","Histoire-Géographie-EMC 4e - Ed. 2021 Plaza\n"]},{"data":{"text/plain":["True"]},"execution_count":21,"metadata":{},"output_type":"execute_result"}],"source":["#@title Code\n","import pdfkit\n","import re\n","\n","from pushover import Pushover\n","from pdfkit.api import configuration\n","from pypdf import PdfMerger\n","import time\n","import os\n","import sys\n","import shutil\n","from tkinter import messagebox\n","\n","toc = time.perf_counter()\n","\n","options = {}\n","# clear(2)\n","!ls\n","\n","id = int(input(\"Quel est l'id eleve ? \"))\n","edition = input(\"Quelle est l'édition ? \")\n","nbpages = int(input(\"Quel est le nombre de pages ? \"))\n","id2 = int(input(\"Quel est l'id professeur ? \"))\n","nomdulivre = input(\"Quel est le nom du manuel ? \")\n","\n","if edition == 'hachette' or edition == '':\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/Page_{}.html'\n","elif (edition == 'hatier') or (edition == 'didier'):\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/page{}.xhtml?interface=postMessage'\n","else:\n"," print(\"L'édition entrée n'existe pas encore\")\n","\n","url = debuturl + str(id) + finurl\n","# url = \"https://exobank.hachette-livre.fr/contents/final/9782278093472-fxl/OEBPS/page{}.xhtml?interface=postMessage\"\n","output = '/root/content/Manuel/gen/eleve{}.pdf'\n","# for offset in range(1, nbpages + 1, 1):\n","# newurl = url.format(offset)\n","# print(newurl)\n","# newoutput = output.format(offset)\n","# print(str(offset) + \"/\" + str(nbpages))\n","\n","# pdfkit.from_url(newurl, newoutput)\n","\n","# pdfs = '/root/content/Manuel/gen/eleve{}.pdf'\n","# pdfsnewpdfs = []\n","\n","# for offset in range(1, nbpages + 1, 1):\n","# newpdfs = pdfs.format(offset)\n","# pdfsnewpdfs.append(str(newpdfs))\n","# # print(pdfsnewpdfs)\n","\n","# finpage = time.perf_counter()\n","\n","# debutmerge = time.perf_counter()\n","# merger = PdfMerger()\n","\n","# for pdf in pdfsnewpdfs:\n","# merger.append(pdf)\n","\n","# merger.write(\"eleve.pdf\")\n","# merger.close()\n","# finmerge = time.perf_counter()\n","\n","#version prof\n","\n","\n","if edition == 'hachette' or edition == '':\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/Page_{}.html'\n","elif (edition == 'hatier') or (edition == 'didier'):\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/page{}.xhtml?interface=postMessage'\n","else:\n"," print(\"L'édition entrée n'existe pas encore\")\n","\n","url = debuturl + str(id2) + finurl\n","# url = \"https://exobank.hachette-livre.fr/contents/final/9782278093472-fxl/OEBPS/page{}.xhtml?interface=postMessage\"\n","output = '/root/content/Manuel/gen/prof{}.pdf'\n","for offset in range(386, nbpages + 1, 1):\n"," newurl = url.format(offset)\n"," print(newurl)\n"," newoutput = output.format(offset)\n"," print(str(offset) + \"/\" + str(nbpages))\n","\n"," pdfkit.from_url(newurl, newoutput)\n","\n","pdfs = '/root/content/Manuel/gen/prof{}.pdf'\n","pdfsnewpdfs = []\n","\n","for offset in range(1, nbpages + 1, 1):\n"," newpdfs = pdfs.format(offset)\n"," pdfsnewpdfs.append(str(newpdfs))\n","# print(pdfsnewpdfs)\n","\n","finpage = time.perf_counter()\n","\n","debutmerge = time.perf_counter()\n","merger = PdfMerger()\n","\n","for pdf in pdfsnewpdfs:\n"," merger.append(pdf)\n","\n","merger.write(\"prof.pdf\")\n","merger.close()\n","finmerge = time.perf_counter()\n","\n","# clear(2)\n","print(f\"Gen pdfs en {finpage - toc:0.4f} secondes\")\n","print(f\"Gen pdf unique en {finmerge - debutmerge:0.4f} secondes\")\n","print(f\"Tout en {finmerge - toc:0.4f} secondes\")\n","print('DONE')\n","\n","print(edition)\n","print(nomdulivre)\n","\n","po = Pushover(\"a73uqu1px5w9aq84tnsbcgyf14c7zz\")\n","po.user(\"ub91t4nporrc2nv374ed9kk9nwnd2p\")\n","msg = po.msg(\"Les téléchargements sont terminés\")\n","msg.set(\"title\", \"Finis\")\n","po.send(msg)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":4468,"status":"ok","timestamp":1680379380281,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"xXQewjziafxv","outputId":"5d0f2649-5490-4961-c916-179068e66b53"},"outputs":[{"name":"stdout","output_type":"stream","text":["Quel est le nom du livre ?test\n"]}],"source":["nomdulivre = input(\"Quel est le nom du livre ?\")\n","! mkdir nomdulivre"]}],"metadata":{"colab":{"authorship_tag":"ABX9TyM0RR0xQd14H7d+wWpbuv6z","provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.9"}},"nbformat":4,"nbformat_minor":0} diff --git a/index.html b/index.html index 0325c61..ba1452d 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@ - + @@ -49,6 +49,7 @@ +

@@ -210,13 +211,23 @@ document.documentElement.style.setProperty('--iframe-height', '2050px'); } else if (editionchoisie == 'delagrave') { - console.log("magnard"); - document.getElementById("editionesthcoisieest").innerHTML = "Le serveur n°1 devrait marcher mais au cas où les autres sont dispos."; + console.log("delagrave"); + document.getElementById("editionesthcoisieest").innerHTML = ""; diviframe.style.display = ''; slider.style.display = ''; divimg.style.display = 'none'; divserver.style.display = ''; } + else if (editionchoisie == 'nathan') { + console.log("nathan"); + document.getElementById("editionesthcoisieest").innerHTML = ""; + diviframe.style.display = ''; + slider.style.display = ''; + divimg.style.display = 'none'; + divserver.style.display = 'none'; + document.documentElement.style.setProperty('--iframe-width', '1152px'); + document.documentElement.style.setProperty('--iframe-height', '1594px'); + } else { document.getElementById("editionesthcoisieest").innerHTML = "⚠ Cette édition n'est pas encore supportée ⚠"; diviframe.style.display = 'none'; @@ -286,6 +297,12 @@ iframe1.src = newUrl1; iframe2.src = newUrl2; } + else if (editionchoisie == 'nathan') { + var newUrl1 = "https://raw.githubusercontent.com/NohamR/Manuelcontent/main/Nathan/" + code + "/page0.jpg"; + var newUrl2 = "https://raw.githubusercontent.com/NohamR/Manuelcontent/main/Nathan/" + code + "/page1.jpg"; + img1.src = newUrl1; + img2.src = newUrl2; + } else { } @@ -421,6 +438,26 @@ console.log(img2.src); nbpage.value = page1; } + else if (editionchoisie == 'nathan') { + // console.log("nathan"); + page1 += delta; + page2 += delta; + if (page1 < 1) { + page1 = 1; + } else if (page1 > 600) { + page1 = 600; + } + if (page2 < 1) { + page2 = 2; + } else if (page2 > 600) { + page2 = 600; + } + img1.src = url1.replace(/\d+(?=\.jpg)/, page1); + img2.src = url2.replace(/\d+(?=\.jpg)/, page2); + console.log(img1.src); + console.log(img2.src); + nbpage.value = page1; + } } function changerNBpage() { diff --git a/py/.DS_Store b/py/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..eec5ff7400673ae30ac362ce7fdda6aeddb01702 GIT binary patch literal 6148 zcmeHKPm2>V6o2W~ZFlQR1rH3 z@&UB`LkV(37Zo$2V{ivFRB0J||73;tZiROZyacQm{f@wlp&j%WC=79aa4Eq_l4?ub zTxshvvAs`y^1vB^8G`AVF|BLi^-2qy;CUGRA-CXX~~)F*D59F&VFq=-O69Rb^G3v)=}7xBu@Y$aOf)8 zF?a^2$Sh4N>{i{j?5jgL_u^J^TK?D&U}lc0+Tq%&tviCO0iTpFS7FUzG`djdF>bNQT$WkC4l4$8f|Jl zU_D?xF!unT4-S;EZg8ei9UVy269AaSXC=tGrf@Ab2tO68=Psx7l{24P;Rh^ J^}t{Cz)$uh0dxQW literal 0 HcmV?d00001 diff --git a/py/code1.0.ipynb b/py/code1.0.ipynb new file mode 100644 index 0000000..1f5abd2 --- /dev/null +++ b/py/code1.0.ipynb @@ -0,0 +1 @@ +{"cells":[{"cell_type":"code","execution_count":null,"metadata":{"cellView":"form","colab":{"base_uri":"https://localhost:8080/","height":375},"executionInfo":{"elapsed":7,"status":"error","timestamp":1680434191416,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"Q_VOKTuxaUwS","outputId":"41dcdd09-f7a8-469d-c660-422034f0a6ed"},"outputs":[],"source":["#@title Initialisation\n","!pip install pdfkit\n","!pip install pypdf\n","!mkdir gen\n","!chmod 777 /root/content/Manuel/wkhtmltopdf.exe\n","!cat /etc/os-release\n","!pip install pdfkit\n","\n","!wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb\n","\n","!cp wkhtmltox_0.12.6-1.bionic_amd64.deb /usr/bin\n","\n","!sudo apt install /usr/bin/wkhtmltox_0.12.6-1.bionic_amd64.deb\n","from google.colab import drive\n","drive.mount('/content/gdrive')\n","!pip install git+https://github.com/Wyattjoh/pushover"]},{"cell_type":"code","execution_count":null,"metadata":{"id":"QoAsZb7mcKOZ"},"outputs":[],"source":["!mkdir /root/\n","!mkdir /root/content/\n","!mkdir /root/content/Manuel/\n","!mkdir /root/content/Manuel/gen/\n","!ls /root/content/Manuel/gen/\n","#be sure it return true "]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":189},"executionInfo":{"elapsed":450,"status":"error","timestamp":1680434256652,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"0lBO9lBT8o7q","outputId":"033fe8e9-0ebf-47d1-828c-6fffb4baa585"},"outputs":[],"source":["pdfkit.from_url(\"https://exobank.hachette-livre.fr/contents/final/9782017102106-fxl/OEBPS/Page_1.html?interface=postMessage\", \"/root/content/Manuel/out.pdf\")"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":132814,"status":"ok","timestamp":1680379287318,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"a1_iqy6WaIfD","outputId":"54588e2f-defc-4db5-d4ff-2b85d276bf6a"},"outputs":[],"source":["#@title Code\n","import pdfkit\n","import re\n","\n","from pushover import Pushover\n","from pdfkit.api import configuration\n","from pypdf import PdfMerger\n","import time\n","import os\n","import sys\n","import shutil\n","from tkinter import messagebox\n","\n","toc = time.perf_counter()\n","\n","options = {}\n","# clear(2)\n","!ls\n","\n","id = int(input(\"Quel est l'id eleve ? \"))\n","edition = input(\"Quelle est l'édition ? \")\n","nbpages = int(input(\"Quel est le nombre de pages ? \"))\n","id2 = int(input(\"Quel est l'id professeur ? \"))\n","nomdulivre = input(\"Quel est le nom du manuel ? \")\n","\n","if edition == 'hachette' or edition == '':\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/Page_{}.html'\n","elif (edition == 'hatier') or (edition == 'didier'):\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/page{}.xhtml?interface=postMessage'\n","else:\n"," print(\"L'édition entrée n'existe pas encore\")\n","\n","url = debuturl + str(id) + finurl\n","# url = \"https://exobank.hachette-livre.fr/contents/final/9782278093472-fxl/OEBPS/page{}.xhtml?interface=postMessage\"\n","output = '/root/content/Manuel/gen/eleve{}.pdf'\n","# for offset in range(1, nbpages + 1, 1):\n","# newurl = url.format(offset)\n","# print(newurl)\n","# newoutput = output.format(offset)\n","# print(str(offset) + \"/\" + str(nbpages))\n","\n","# pdfkit.from_url(newurl, newoutput)\n","\n","# pdfs = '/root/content/Manuel/gen/eleve{}.pdf'\n","# pdfsnewpdfs = []\n","\n","# for offset in range(1, nbpages + 1, 1):\n","# newpdfs = pdfs.format(offset)\n","# pdfsnewpdfs.append(str(newpdfs))\n","# # print(pdfsnewpdfs)\n","\n","# finpage = time.perf_counter()\n","\n","# debutmerge = time.perf_counter()\n","# merger = PdfMerger()\n","\n","# for pdf in pdfsnewpdfs:\n","# merger.append(pdf)\n","\n","# merger.write(\"eleve.pdf\")\n","# merger.close()\n","# finmerge = time.perf_counter()\n","\n","#version prof\n","\n","\n","if edition == 'hachette' or edition == '':\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/Page_{}.html'\n","elif (edition == 'hatier') or (edition == 'didier'):\n"," debuturl = 'https://exobank.hachette-livre.fr/contents/final/'\n"," finurl = '-fxl/OEBPS/page{}.xhtml?interface=postMessage'\n","else:\n"," print(\"L'édition entrée n'existe pas encore\")\n","\n","url = debuturl + str(id2) + finurl\n","# url = \"https://exobank.hachette-livre.fr/contents/final/9782278093472-fxl/OEBPS/page{}.xhtml?interface=postMessage\"\n","output = '/root/content/Manuel/gen/prof{}.pdf'\n","for offset in range(386, nbpages + 1, 1):\n"," newurl = url.format(offset)\n"," print(newurl)\n"," newoutput = output.format(offset)\n"," print(str(offset) + \"/\" + str(nbpages))\n","\n"," pdfkit.from_url(newurl, newoutput)\n","\n","pdfs = '/root/content/Manuel/gen/prof{}.pdf'\n","pdfsnewpdfs = []\n","\n","for offset in range(1, nbpages + 1, 1):\n"," newpdfs = pdfs.format(offset)\n"," pdfsnewpdfs.append(str(newpdfs))\n","# print(pdfsnewpdfs)\n","\n","finpage = time.perf_counter()\n","\n","debutmerge = time.perf_counter()\n","merger = PdfMerger()\n","\n","for pdf in pdfsnewpdfs:\n"," merger.append(pdf)\n","\n","merger.write(\"prof.pdf\")\n","merger.close()\n","finmerge = time.perf_counter()\n","\n","# clear(2)\n","print(f\"Gen pdfs en {finpage - toc:0.4f} secondes\")\n","print(f\"Gen pdf unique en {finmerge - debutmerge:0.4f} secondes\")\n","print(f\"Tout en {finmerge - toc:0.4f} secondes\")\n","print('DONE')\n","\n","print(edition)\n","print(nomdulivre)\n","\n","po = Pushover(\"a73uqu1px5w9aq84tnsbcgyf14c7zz\")\n","po.user(\"ub91t4nporrc2nv374ed9kk9nwnd2p\")\n","msg = po.msg(\"Les téléchargements sont terminés\")\n","msg.set(\"title\", \"Finis\")\n","po.send(msg)"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":4468,"status":"ok","timestamp":1680379380281,"user":{"displayName":"Ghjklm G","userId":"09208431433424498357"},"user_tz":-120},"id":"xXQewjziafxv","outputId":"5d0f2649-5490-4961-c916-179068e66b53"},"outputs":[{"name":"stdout","output_type":"stream","text":["Quel est le nom du livre ?test\n"]}],"source":["nomdulivre = input(\"Quel est le nom du livre ?\")\n","! mkdir nomdulivre"]}],"metadata":{"colab":{"authorship_tag":"ABX9TyM0RR0xQd14H7d+wWpbuv6z","provenance":[]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.10"}},"nbformat":4,"nbformat_minor":0} diff --git a/.py/converter.py b/py/converter.py similarity index 100% rename from .py/converter.py rename to py/converter.py diff --git a/.py/csvpourprendreliens.py b/py/csvpourprendreliens.py similarity index 100% rename from .py/csvpourprendreliens.py rename to py/csvpourprendreliens.py diff --git a/.py/libmanuelsaver.py b/py/libmanuelsaver.py similarity index 100% rename from .py/libmanuelsaver.py rename to py/libmanuelsaver.py diff --git a/py/nathan/.DS_Store b/py/nathan/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d0568dd653deec0a6ffc66cebb9e25e0c2ab121b GIT binary patch literal 10244 zcmeHMU2GIp6uxI#=!_lc@KgD*14|c7fdboIOetvCcDHB+EOcA?2W)qDMmjJ%Q+8&z zXstFrkpLQbP!wN`e=#w}C_kbvO4JZFF_8uXPyRijzL=;OP4wJ*XMs{EAwffMZgS`B zx#ygF=YDg(nVh?X5NOJ4b%X>6AtH7v6&WvAY1B^pxF&cb)Cd?)NQg9$IugNNKhE19 z@DcD4@DcD4@DcD4xD^na zS;OC02e6ocC!?Mm;gW^ooV z+zCXv^shbwJ_6$rptPBSReL>IMZ#n1_b^#WBI!YAAZ^-d^g59qFb&5Ih0cIbQaWjJ z8MgAWZHaz+FyW@$ywjA*^-`_fw#{_$cPhQb&d~bVs>7MeXeB?&+12 z%Jc&6ymi1eY|GiA=NyztrNTjkS~9k^DW_9=XT~=3S<6W((=sVDlQ&bY-e{T$<53;Q zDx6HtHqA}8W6){3yIg&bOKsy!T|JJSb7O3>E(7Q1UP|84+jN}NDClvV+EGAyYwE1| z3u~5z>+g*=w>;D~TA@svK0~gQdk}leH6AwfTzAUJ=$2+!J30mp&F$|j7>!vuvC-D(Dw?Pq#d&b` zMQXL$OD(aSj#teKSgbCU+a27ksHC{#aycZo@4}>!6o-#Qsi)3ciz;DCRaGpGlblk-o0aCDk<;WX`Ih{QY5q5qf&{Z+0Va0@8elC;?>MZ3 zR@elaApsq*9g@%oX-xDiSYX3$a4^k>G0{ihN!SPb;Q%}f&%q&h0bYbxS+c(Y@4&lo z1dhRbnD!^(b4>ZO@ZA+jykTq-!}k*>an_EF;k_U6Ir=eK;)c)bYi1|tUgFZ+mn z@gcpz320SFg!`fYNv(-h=>Ls~DhX?E&n4*lDAFBV4i&yigZ9&W__zq34S1Py@%jQw(O0dVV8Z kvT%%J;VAiO{=fcbz<+q!=GXr>>6pu}|0k&EZ@m8h2NV;*?f?J) literal 0 HcmV?d00001 diff --git a/py/nathan/9782091317243/.DS_Store b/py/nathan/9782091317243/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0