Advertisement
Guest User

Untitled

a guest
Jul 12th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.32 KB | None | 0 0
  1. <?PHP
  2.  
  3. /*-------USTAWIENIA------*/
  4. $ts3_ip = 'localhost';
  5. $ts3_queryport = 10011;
  6. $ts3_user = 'serveradmin';
  7. $ts3_pass = 'RdBeoeZO';
  8. $ts3_port = 9987;
  9. $czas = 1*60*60;    /*  co ile sekund ma aktualizować kanały
  10.                         możesz wpisać 60*ilość minut, bądź 3600*ilość godzin
  11.                     */ 
  12.  
  13. //$youtube[] = array("nazwa kanału","ID KANAŁU YOUTUBE", ID KANAŁU TEAMSPEAK);
  14. $youtube[] = array("ProstoTV","UCQuSMKcwirmoLvzR4qlKjoQ",1);
  15. $youtube[] = array("Long&Junior","UCFEusnvhH4uYvzcDVWaOP4A",2);
  16. $youtube[] = array("EwaFarnaVEVO","UCSebDIT3FRWq5lUV61UT6JQ",3);
  17. /*----------------------*/
  18.  
  19. #Include ts3admin.class.php
  20. require("src/ts3admin.class.php");
  21.  
  22. #build a new ts3admin object
  23. $tsAdmin = new ts3admin($ts3_ip, $ts3_queryport);
  24. echo "<pre>";
  25. if($tsAdmin->getElement('success', $tsAdmin->connect())) {
  26.     #login as serveradmin
  27.     $tsAdmin->login($ts3_user, $ts3_pass);
  28.    
  29.     #select teamspeakserver
  30.     $tsAdmin->selectServer($ts3_port);
  31.     //while (1){
  32.        
  33.         foreach($youtube as $yter){
  34.             $zmiany = false;
  35.             $page = "http://151.80.111.114/subscribeyoutube.php?id=".$yter[1];
  36.             $page = file_get_contents($page);
  37.             $page = json_decode($page, true);
  38.             //$data = "channel_description=viewCount".$page['viewCount'];
  39.             $data_channelname = $yter[0]."\s(".$page['subscriberCount'].")";
  40.             $data_channeldesc = "[url=https://www.youtube.com/channel/".$yter[1]."]".$yter[0]."[/url] \nSubskrybcji: ".$page['subscriberCount']."\nWyświetleń: ".$page['viewCount']."\nIlość filmów na kanale: ".$page['videoCount'];
  41.            
  42.             $aktualne = $tsAdmin->channelInfo($yter[2]);
  43.             print_r($aktualne['data']);
  44.             $aktualnanazwa = $aktualne['data']['channel_name'];
  45.             $aktualnydesc = $aktualne['data']['channel_description'];
  46.            
  47.             if($data_channelname != $aktualnanazwa){
  48.                 $data['channel_name'] = $data_channelname;
  49.                 $zmiany = true;
  50.             }
  51.             if($data_channeldesc != $aktualnydesc){
  52.                 $data['channel_description'] = $data_channeldesc;
  53.                 $zmiany = true;
  54.             }
  55.             if($zmiany == true)$tsAdmin->channelEdit($yter[2], $data);
  56.         }
  57.         sleep($czas);
  58.     //}
  59.    
  60. }else{
  61.     echo 'Connection could not be established.';
  62. }
  63. echo "</pre>";
  64. /**
  65.  * This code retuns all errors from the debugLog
  66.  */
  67. if(count($tsAdmin->getDebugLog()) > 0) {
  68.     foreach($tsAdmin->getDebugLog() as $logEntry) {
  69.         echo '<script>alert("'.$logEntry.'");</script>';
  70.     }
  71. }
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement