40 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| <?php
 | |
| 
 | |
| $list = scandir("../../../Serien");
 | |
| 
 | |
| $path = "../../rsc/thumbnailsseries/";
 | |
| 
 | |
| for($i=2;$i<=count($list)-1;$i++){
 | |
|   echo $list[$i];
 | |
|     $list[$i]=str_replace(' ', '%20',$list[$i]);
 | |
|     if (file_exists($path.str_replace('%20', ' ', $list[$i]).".jpg")) {
 | |
|       echo "exists!\n";
 | |
|     }else {
 | |
|       echo("exists not: ".str_replace('%20', ' ', $list[$i]).".jpg");
 | |
| 
 | |
|       $moviename = $list[$i];
 | |
|       $year = 0;
 | |
|       if( preg_match( '!\(([^\)]+)\)!', $list[$i], $match ) ){
 | |
|         $text = $match[0];
 | |
|         $year = $match[1];
 | |
|         $moviename = str_replace($text,"",$list[$i]);
 | |
|         echo $text."\n\n";
 | |
|       }
 | |
| 
 | |
|       $query = "https://api.themoviedb.org/3/search/tv?api_key=9fd90530b11447f5646f8e6fb4733fb4&language=en-US&include_adult=true&query=".$moviename;
 | |
|       $result = json_decode(file_get_contents($query));
 | |
|       if ($result->total_results == 0) {
 | |
|         echo("\n\nno result found for".$moviename);
 | |
|       }else {
 | |
| 
 | |
|           echo("http://image.tmdb.org/t/p/original/".$result->results[0]->poster_path."\n\n");
 | |
|           copy("http://image.tmdb.org/t/p/w342/".$result->results[0]->poster_path, $path.str_replace('%20', ' ', $list[$i]).".jpg");
 | |
| 
 | |
|       }
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| 
 | |
|  ?>
 |