<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Print on Blog GoHugo de Fredô : Linux, Proxmox, IA, Trail, Course, Randonnée, Gravel, Ski de Randonnée</title>
    <link>https://move.cyber-neurones.org/tags/print/</link>
    <description>Recent content in Print on Blog GoHugo de Fredô : Linux, Proxmox, IA, Trail, Course, Randonnée, Gravel, Ski de Randonnée</description>
    <generator>Hugo</generator>
    <language>fr</language>
    <lastBuildDate>Mon, 08 Feb 2021 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://move.cyber-neurones.org/tags/print/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Quand Python vient corriger un problème de script ... Merci</title>
      <link>https://move.cyber-neurones.org/post/2021/02/2021-02-08-quand-python-vient-corriger-un-probleme-de-script-merci/</link>
      <pubDate>Mon, 08 Feb 2021 00:00:00 +0000</pubDate>
      <guid>https://move.cyber-neurones.org/post/2021/02/2021-02-08-quand-python-vient-corriger-un-probleme-de-script-merci/</guid>
      <description>&lt;p&gt;Je me suis fait des doublons de fichiers dans mes photos, heureusement Python c&amp;rsquo;est simple et convivial :&lt;/p&gt;&#xA;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;import os&#xA;import sys&#xA;import re&#xA;import PIL&#xA;from PIL import Image&#xA;&#xA;walk_dir = &amp;#34;./Nextcloud/Photos/&amp;#34;&#xA;&#xA;print(&amp;#39;walk_dir = &amp;#39; + walk_dir)&#xA;print(&amp;#39;walk_dir (absolute) = &amp;#39; + os.path.abspath(walk_dir))&#xA;&#xA;for root, subdirs, files in os.walk(walk_dir):&#xA;    list_file_path = os.path.join(root, &amp;#39;my-directory-check.txt&amp;#39;)&#xA;    print(&amp;#39;list_file_path = &amp;#39; + list_file_path)&#xA;    with open(list_file_path, &amp;#39;wb&amp;#39;) as list_file:&#xA;        #for subdir in subdirs:&#xA;        #   print(&amp;#39;\t- subdirectory &amp;#39; + subdir)&#xA;        for filename in files:&#xA;            file_path = os.path.join(root, filename)&#xA;            # print(&amp;#39;\t- file %s (full path: %s)&amp;#39; % (filename, file_path))&#xA;            base = os.path.splitext(filename)[0]&#xA;            if (base.endswith(&amp;#39;_1&amp;#39;)):&#xA;                    #print(&amp;#39;\t- Doublon probable %s %s (full path: %s)&amp;#39; % (filename, base, file_path))&#xA;                    double = re.sub(&amp;#39;_1$&amp;#39;, &amp;#39;&amp;#39;, base)&#xA;                    double = double + &amp;#39;.jpg&amp;#39;&#xA;                    double2 = re.sub(&amp;#39;_1$&amp;#39;, &amp;#39;&amp;#39;, base)&#xA;                    double2 = double2 + &amp;#39;.JPG&amp;#39;&#xA;                    file_path_double = os.path.join(root, double)&#xA;                    file_path_double2 = os.path.join(root, double2)&#xA;                    if os.path.isfile(file_path_double):&#xA;                        #print(&amp;#39;\t- Doublon OK %s &amp;amp; %s&amp;#39; % (file_path, file_path_double))&#xA;                        img1 = PIL.Image.open(file_path)&#xA;                        img2 = PIL.Image.open(file_path_double)&#xA;                        wid1, hgt1 = img1.size &#xA;                        wid2, hgt2 = img2.size &#xA;                        if (wid1 == wid2) and (hgt1 == hgt2):&#xA;                            #print(&amp;#39;Meme resolution&amp;#39;)&#xA;                            size1 = os.path.getsize(file_path)&#xA;                            size2 = os.path.getsize(file_path_double)&#xA;                            if (size1 &amp;gt; size2):&#xA;                                    print(&amp;#34;%s &amp;gt; %s&amp;#34; % (file_path, file_path_double));&#xA;                                    os.remove(file_path_double);&#xA;                            else:&#xA;                                    print(&amp;#34;%s &amp;lt; %s&amp;#34; % (file_path, file_path_double));&#xA;                                    os.remove(file_path);&#xA;                    elif os.path.isfile(file_path_double2):&#xA;                        img1 = PIL.Image.open(file_path)&#xA;                        img2 = PIL.Image.open(file_path_double2)&#xA;                        wid1, hgt1 = img1.size&#xA;                        wid2, hgt2 = img2.size&#xA;                        if (wid1 == wid2) and (hgt1 == hgt2):&#xA;                            #print(&amp;#39;Meme resolution&amp;#39;)&#xA;                            size1 = os.path.getsize(file_path)&#xA;                            size2 = os.path.getsize(file_path_double2)&#xA;                            if (size1 &amp;gt; size2):&#xA;                                    print(&amp;#34;%s &amp;gt; %s&amp;#34; % (file_path, file_path_double2));&#xA;                                    os.remove(file_path_double2);&#xA;                            else:&#xA;                                    print(&amp;#34;%s &amp;lt; %s&amp;#34; % (file_path, file_path_double2));&#xA;                                    os.remove(file_path);&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Ensuite pour faire un clean des fichiers txt :&lt;/p&gt;</description>
    </item>
    <item>
      <title>ENEDIS : Migration des données  pour une utilisation dans Mariadb / Grafana (fait en Python)</title>
      <link>https://move.cyber-neurones.org/post/2020/04/2020-04-13-enedis-migration-des-donnees-pour-une-utilisation-dans-mariadb-grafana-fait-en-python/</link>
      <pubDate>Mon, 13 Apr 2020 00:00:00 +0000</pubDate>
      <guid>https://move.cyber-neurones.org/post/2020/04/2020-04-13-enedis-migration-des-donnees-pour-une-utilisation-dans-mariadb-grafana-fait-en-python/</guid>
      <description>&lt;p&gt;Je viens de faire un nouveau programme en Python afin de mettre les données de &lt;strong&gt;ENEDIS&lt;/strong&gt; sur MariaDB &amp;amp; Python. Pour avoir les données de &lt;strong&gt;ENEDIS&lt;/strong&gt; il faut aller sur &lt;a href=&#34;https://mon-compte-particulier.enedis.fr/home-connectee&#34;&gt;https://mon-compte-particulier.enedis.fr/home-connectee&lt;/a&gt;/ et se faire un compte. Puis relier ce compte à la facture EDF &amp;hellip; Je vais pas vous mentir c&amp;rsquo;est un peu de parcours du combattant. J&amp;rsquo;ai du faire appel à plusieurs fois au support afin que le lien puisse se faire. Misère.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
