Private GIT

Skip to content
Snippets Groups Projects
Select Git revision
  • 743e7d3707687e79ea64f27bec8b084d53758833
  • master default protected
  • fix_nzb_cat
  • develop
  • guessit2-minimal
  • ssl_warning
  • UHD-qualities
  • fix_providers8
  • !
  • tvvault
  • provider_alpharatio
  • v5.1.1
  • v5.1
  • v5.0.3
  • v5.0.2
  • v5.0.1
  • v5.0
  • v4.2.1.07
  • v4.2.1.06
  • v4.2.1.05
  • v4.2.1.04
  • v4.2.1.03
  • v4.2.1.02
  • v4.2.1.01
  • v4.2.1.0
  • v4.2.0.6
  • v4.2.0.5
  • v4.2.0.4
  • v4.2.0.3
  • v4.2.0.2
  • v4.2.0.1
31 results

postProcessor.py

Blame
    • Dustyn Gibson's avatar
      7219208c
      Add some static urls for current available providers · 7219208c
      Dustyn Gibson authored
      If provider name is not found in urls dict (updated subliminal?),
      then the url is lmgtfy.com?q=curService until the urls are updated =P
      
      Rename language flags to alpha3
      
      Fix subtitles, single mode with only 1 subtitle and only 1 language set will now show the flag for your only configured sub language
      Fix flags display
      Fix Info Lang in template to use alpha3 images
      
      Note: Subtitle download history logging is funky atm.
      I don't think we can tell which provider subliminal downloaded the sub from,
      so for now I just made it use the language flag and language code in the log in place of the provider.
      7219208c
      History
      Add some static urls for current available providers
      Dustyn Gibson authored
      If provider name is not found in urls dict (updated subliminal?),
      then the url is lmgtfy.com?q=curService until the urls are updated =P
      
      Rename language flags to alpha3
      
      Fix subtitles, single mode with only 1 subtitle and only 1 language set will now show the flag for your only configured sub language
      Fix flags display
      Fix Info Lang in template to use alpha3 images
      
      Note: Subtitle download history logging is funky atm.
      I don't think we can tell which provider subliminal downloaded the sub from,
      so for now I just made it use the language flag and language code in the log in place of the provider.
    ddyoyock.php 7.44 KiB
    <?php
    
    /*
     * @category    Add on
     * @package     Mod Swizzin
     * @author      Christophe K. <ckforall@gmail.com> 
     * @copyright   2018 cklv
     * @license     http://opensource.org/licenses/bsd-license.php New BSD License
     * @link        https://www.nailis.fr
     */
    
    
    /* --------------------------------
     * @version 4.3c
     * --------------------------------
     */
    
    // DD 1
    // 1 YOYO SERIES
      $yoyolocation = "/home/data";
      $totheformatyoyo = createarrayinfdata($yoyolocation);
      //hard disk for percentages
      $dptotalyoyo   =  formatarrygetdf($totheformatyoyo["total"]); //Total
      $dpfreeyoyo    =  formatarrygetdf($totheformatyoyo["free"]); //Available
      $dpusedyoyo    =  formatarrygetdf($totheformatyoyo["used"]); //used
      $barWidthyoyo  =  str_ireplace("%", "", $totheformatyoyo["PUsed"]); // %P used;
      $linknetdatayoyo = '<embed src="https://www.nailis.fr/netdata/api/v1/badge.svg?chart=disk_space._home_data&alarm=disk_fill_rate&refresh=auto" type="image/svg+xml" height="20"/>';
      echo CreateTemplateDD("DD YOYO SERIES",$yoyolocation,$dptotalyoyo,$dpfreeyoyo,$dpusedyoyo,$barWidthyoyo,$linknetdatayoyo);
    
    
    // DD 4
    // 4 YOYO FILMS
      $yoyolocation4 = "/home/data4";
      $totheformatyoyo4 = createarrayinfdata($yoyolocation4);
      //hard disk for percentages
      $dptotalyoyo4   =  formatarrygetdf($totheformatyoyo4["total"]); //Total
      $dpfreeyoyo4    =  formatarrygetdf($totheformatyoyo4["free"]); //Available
      $dpusedyoyo4    =  formatarrygetdf($totheformatyoyo4["used"]); //used
      $barWidthyoyo4  =  str_ireplace("%", "", $totheformatyoyo4["PUsed"]); // %P used;
      $linknetdatayoyo4 = '<embed src="https://www.nailis.fr/netdata/api/v1/badge.svg?chart=disk_space._home_data4&alarm=disk_fill_rate&refresh=auto" type="image/svg+xml" height="20"/>';
      echo CreateTemplateDD("DD YOYO FILMS",$yoyolocation4,$dptotalyoyo4,$dpfreeyoyo4,$dpusedyoyo4,$barWidthyoyo4,$linknetdatayoyo4);
    
    // DD 2
    // 2 CK FILMS/SERIES
      $yoyolocation2 = "/home/data2";
      $totheformatyoyo2 = createarrayinfdata($yoyolocation2);
      //hard disk for percentages
      $dptotalyoyo2   =  formatarrygetdf($totheformatyoyo2["total"]); //Total
      $dpfreeyoyo2    =  formatarrygetdf($totheformatyoyo2["free"]); //Available
      $dpusedyoyo2    =  formatarrygetdf($totheformatyoyo2["used"]); //used
      $barWidthyoyo2  =  str_ireplace("%", "", $totheformatyoyo2["PUsed"]); // %P used;
      $linknetdatayoyo2 = '<embed src="https://www.nailis.fr/netdata/api/v1/badge.svg?chart=disk_space._home_data2&alarm=disk_fill_rate&refresh=auto" type="image/svg+xml" height="20"/>';
      echo CreateTemplateDD("DD CK FILMS/SERIES",$yoyolocation2,$dptotalyoyo2,$dpfreeyoyo2,$dpusedyoyo2,$barWidthyoyo2,$linknetdatayoyo2);
    
    // DD 3
    // 2 JK FILMS/SERIES
      $yoyolocation3 = "/home/data3";
      $totheformatyoyo3 = createarrayinfdata($yoyolocation3);
      //hard disk for percentages
      $dptotalyoyo3   =  formatarrygetdf($totheformatyoyo3["total"]); //Total
      $dpfreeyoyo3    =  formatarrygetdf($totheformatyoyo3["free"]); //Available
      $dpusedyoyo3    =  formatarrygetdf($totheformatyoyo3["used"]); //used
      $barWidthyoyo3  =  str_ireplace("%", "", $totheformatyoyo3["PUsed"]); // %P used;
      $linknetdatayoyo3 = '<embed src="https://www.nailis.fr/netdata/api/v1/badge.svg?chart=disk_space._home_data3&alarm=disk_fill_rate&refresh=auto" type="image/svg+xml" height="20"/>';
      echo CreateTemplateDD("DD JK FILMS/SERIES",$yoyolocation3,$dptotalyoyo3,$dpfreeyoyo3,$dpusedyoyo3,$barWidthyoyo3,$linknetdatayoyo3);
    
    
    // --------------------------------------------------------- Do not modify below
    // Fonctions
    // --------------------------------------------------------- Do not modify below
    
    /*
     ***************************
     * fonction de reformatage 
     * en humain de l affichage
     ***************************
     */
    
    // format numbers which have been retrieve with human understanding !
    function formatarrygetdf($vartoconvert) {
        
        $bytes = $vartoconvert;
        $s = array('B', 'Kb', 'MB', 'GB', 'TB', 'PB');
        $e = floor(log($bytes)/log(1024));
        return sprintf('%.2f '.$s[$e], ($bytes/pow(1024, floor($e))));
    }
    
    
    /* ************
     * Fonction to extract
     * df value from debian sys
     * may not compatible with
     * other system
    */
    function createarrayinfdata($location) {
        // 1 = TOTAL
        // 2 =  USED
        // 3 = DISPO
        // 4 = Pourcent Used
        // 5 = path
        
        $getdf = exec("df ".$location,$returnval);
        $arrey_getdf = explode(' ', $getdf) ;
        
        $compt =0;
        foreach ($arrey_getdf as &$value) {
        
             if ($value > "")
            {
             $arrey_getdf2[$compt] = $value;
            $compt++;
        
            }
    }
    
    //var_dump($arrey_getdf2);
    //exit;
    
    $thebase = 1024;
    
    $toreturn4  = array(
                          "total" => $arrey_getdf2[1] * $thebase,
                          "used"  => $arrey_getdf2[2] * $thebase,
                          "free"  => $arrey_getdf2[3] * $thebase,
                          "PUsed" => $arrey_getdf2[4],
                          "path" => $location
                         );
    
    return $toreturn4;
    }
    
    
    
    
    
    /* ************
     * Fonction to generate 
     * the html code from the 
     * var which are defined
     * 
    */
    
    
    function CreateTemplateDD ($namedd,                 /*DDNAME*/
                               $location,               /*Target to get information, ex hard drive or folder*/
                               $dptotal="",             /*Total space of HD*/ 
                               $dpfree="",                   /*Free space*/  
                               $dpused="",                   /*Used space*/
                               $barwidth_fonc,               /*Barsized width */
                               $netdatalink="")            /*Netdata Link  */
     
    { // BEGIN function CreateTemplateDD
    
    
        if ($barwidth_fonc < "70") { $diskcolor="progress-bar-success"; }
        if ($barwidth_fonc > "70") { $diskcolor="progress-bar-warning"; }
        if ($barwidth_fonc > "80") { $diskcolor="progress-bar-danger"; }
        
        if ($barwidth_fonc < "70") { $diskcolor2="disk-good"; }
        if ($barwidth_fonc > "70") { $diskcolor2="disk-warning"; }
        if ($barwidth_fonc > "80") { $diskcolor2="disk-danger"; }
    
    
    
    // constant -> var
    $STF = T('FREE');
    $STS = T('SIZE');
    $STU = T('USED');
    $STP = T('DISK_SPACE');
    
    
    $tocompile = <<<LECODE
    <!-- ADDON CK - {$namedd} -->
    <p class="nomargin">{$namedd} {$location} {$barWidth}</p>
    <p class="nomargin">{$STF}: <span style="color:yellow; font-weight: 700; position: absolute; left: 100px;">{$dpfree}</span></p>
    <p class="nomargin">{$STU}: <span style="font-weight: 700; position: absolute; left: 100px;">{$dpused}</span></p>
    <p class="nomargin">{$STS}: <span style="font-weight: 700; position: absolute; left: 100px;">{$dptotal}</span></p>
      <div class="row">
        <div class="col-sm-8">
        <h3>{$STP}</h3>
          <div class="progress">
          <div class="progress-bar {$diskcolor}" style="color:yellow;font-weight: 700;width:{$barwidth_fonc}%">{$barwidth_fonc}&nbsp;%&nbsp;</div>
          </div>
      </div> 
     <div class="col-sm-4 text-right">
      <i class="fa fa-hdd-o {$diskcolor2}" style="font-size: 90px;"></i>
    </div>
    &nbsp;&nbsp;&nbsp;{$netdatalink}
    </div><hr />
    
    LECODE;
     
    return  $tocompile;
    } // END function CreateTemplateDD
    
    //<!-- version git add on -->
    $versionAPP = exec('cd /modddyoyock/ddyoyock/ && git rev-parse --short HEAD', $returnval );
    $versionAPP_long = exec('cd /modddyoyock/ddyoyock/ && git rev-parse HEAD', $returnval );
    
    ?>
    <!-- version git add on -->
    <span style="font-size:10pt">version de l'add on ck : < <span style="color:yellow"><a href="https://github.nailis.fr/ckbox/ddyoyock/commit/<?=$versionAPP_long;?>" title="add onck" target="_blank" > <?=$versionAPP;?> </a></span> ></span>
    			<h3>LOCAL /HOME </h3>
    <!--FIN  ADDON CK -->