Location: PHPKode > projects > Poddy > src/maintainance/check_p_thumbnails.php
<html>
<head>
<title>Neue Thumbnails laden</title>
</head>
<body>
<a href="index.php">Zum Hauptmen├╝</a>
<hr/>

<?php
require_once("../config.php");
require_once("lib/db_utils.php");
require_once("lib/path_utils.php");
require_once("lib/guid_utils.php");
require_once("lib/img_utils.php");
require_once("lib/ingest_utils.php");
require_once("lib/form_utils.php");
require_once("lib/xml.php");

$my_log = LoggerManager::getLogger("update_pods");

$sql = "select item.id from item, podcast where item.podcast_id = podcast.id and item.item_type like 'video%' and item.has_icon=1 and item.deleted != 1 and podcast.deleted!=1 order by item.pubdate desc";
echo $sql."<br/>\n";

$items = array();
$rs = db_query($sql);
while ($row = db_next_row($rs)) {
	$items[] = get_item($row["id"]);
}
$i = 0;
foreach ($items as $item) {
	$i++;
	echo ("handling item ".$i." von ".count($items)." - ".$item["title"]."<br/>\n");

	$icon_dir = FS_BASE_ICONS.get_item_icon_dir($item);
	if (!is_dir($icon_dir)) {
		mkdir($icon_dir);
	}
	
	if (starts_with($item["item_type"], "video")) {
		$icon_png = FS_BASE_ICONS.get_item_icon_path($item, "png");
		$icon_png_big = FS_BASE_ICONS.get_item_icon_path_big($item, "png");
		$icon_jpg_large = FS_BASE_ICONS.get_item_icon_path_large($item, "jpg");
		
		if (is_file($icon_png) && is_file($icon_png_big) && is_file($icon_jpg_large)) {
			continue;
		} else {
			echo ("item ".$i." von ".count($items)." - ".$item["title"]." is missing icons ...<br/>\n");
			$item["has_icon"] = 0;
			$item["ingested"] = 0;
			update_item($item);
		}
	}
	flush();
}

$sql = "select podcast.id from podcast where podcast.has_icon=1 and podcast.deleted!=1";
echo $sql."<br/>\n";

$podcasts = array();
$rs = db_query($sql);
while ($row = db_next_row($rs)) {
	$podcasts[] = get_podcast($row["id"]);
}
$i = 0;
foreach ($podcasts as $podcast) {
	$i++;
	echo ("handling podcast ".$i." von ".count($podcasts)." - ".$podcast["title"]."<br/>\n");

	$icon_png = FS_BASE_ICONS.get_icon_path($podcast, "png");
	$icon_png_big = FS_BASE_ICONS.get_icon_path_big($podcast, "png");
	
	if (is_file($icon_png) && is_file($icon_png_big)) {
		continue;
	} else {
		echo ("podcast ".$i." von ".count($podcasts)." - ".$podcast["title"]." is missing icons ...<br/>\n");
		$podcast["has_icon"] = 0;
		update_podcast($podcast);
	}
	flush();
}


?>
</body>
</html>
Return current item: Poddy