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 @@
Cherche ton code ici
- + @@ -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 0000000..eec5ff7 Binary files /dev/null and b/py/.DS_Store differ 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 0000000..d0568dd Binary files /dev/null and b/py/nathan/.DS_Store differ diff --git a/py/nathan/9782091317243/.DS_Store b/py/nathan/9782091317243/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/py/nathan/9782091317243/.DS_Store differ diff --git a/py/nathan/get.py b/py/nathan/get.py new file mode 100644 index 0000000..17a9156 --- /dev/null +++ b/py/nathan/get.py @@ -0,0 +1,49 @@ +# https://biblio.nathan.fr/epubs/web/4ebeff9ce5eb568f8142771fdac580b8aeb12f675d75fa4c1ebb4620050d6c01842394910eeee327/NATHAN/bibliomanuels/distrib_gp/2/1/10300/online/OEBPS/TOC.xhtml + +import requests +from bs4 import BeautifulSoup +import re + + +def getimg(url, nb): + response = requests.get(url) + if response.status_code == 200: + save_path = f"9782091317243/{nb}.jpg" + with open(save_path, 'wb') as file: + file.write(response.content) + print(f"The image has been saved as '{save_path}'") + else: + print(f"Failed to download the image. Status code: {response.status_code}") + + +url = 'https://biblio.nathan.fr/epubs/web/4ebeff9ce5eb568f8142771fdac580b8aeb12f675d75fa4c1ebb4620050d6c01842394910eeee327/NATHAN/bibliomanuels/distrib_gp/2/1/10300/online/OEBPS/TOC.xhtml' +debut = 'https://biblio.nathan.fr/epubs/web/4ebeff9ce5eb568f8142771fdac580b8aeb12f675d75fa4c1ebb4620050d6c01842394910eeee327/NATHAN/bibliomanuels/distrib_gp/2/1/10300/online/OEBPS/' +r = requests.get(url) +soup = BeautifulSoup(r.text, 'html.parser') +pagelist = soup.find('nav', {'epub:type': 'page-list'}) +links = pagelist.find_all('a') + +i = 1 +for link in links: + lien = link.get('href') + texte = link.text + + r = requests.get(debut + lien) + soup = BeautifulSoup(r.text, 'html.parser') + div_element = soup.find('div', class_='page') + style_attribute = div_element.get('style') + + background_image_url_match = re.search(r'background-image:url\(\'(.*?)\'\)', style_attribute) + + if background_image_url_match: + background_image_url = background_image_url_match.group(1) + parts = lien.split('/')[0] + image_url = debut + parts + '/' + background_image_url + + print('image_url: ', image_url) + + getimg(image_url, i) + else: + print("Image d'arrière-plan non trouvée.") + + i += 1 \ No newline at end of file diff --git a/.py/numtest.py b/py/numtest.py similarity index 100% rename from .py/numtest.py rename to py/numtest.py diff --git a/.py/png saver.py b/py/png saver.py similarity index 100% rename from .py/png saver.py rename to py/png saver.py diff --git a/.py/script like.py b/py/script like.py similarity index 100% rename from .py/script like.py rename to py/script like.py diff --git a/.py/test 1.0.py b/py/test 1.0.py similarity index 100% rename from .py/test 1.0.py rename to py/test 1.0.py diff --git a/.py/test 1.1.py b/py/test 1.1.py similarity index 100% rename from .py/test 1.1.py rename to py/test 1.1.py diff --git a/.py/test2.py b/py/test2.py similarity index 100% rename from .py/test2.py rename to py/test2.py