Location: PHPKode > projects > Poddy > src/maintainance/recreate_markers.php
<html>
<head>
<title>Neue Marker laden</title>
</head>
<body>
<a href="list_pods.php">Zur Liste</a>

<?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");




$sql = "select podcast.id from podcast where has_icon=1 and deleted!=1 order by pubdate asc";
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 = FS_BASE_ICONS.get_icon_path_marker_base($podcast);

	$icon_png = FS_BASE_ICONS.get_icon_path_marker($podcast, "png");

	$icon_orig = FS_BASE_ICONS.get_icon_path($podcast, "png");
	
	if (is_file($icon_png) || !is_file($icon_orig)) continue;

	echo ("creating marker for podcast ".$i." von ".count($podcasts)." - ".$podcast["title"]."<br/>\n");
		
	$e3 = makeMarker($icon_orig, $icon, 32);
	echo $e3."<br/>\n";
	
	if (isset($argv)) {
		shell_exec("chown -R www-data.www-data ".$icon_dir."*");
	}
	
	flush();
}




$sql = "select item.id from item, podcast where item.podcast_id = podcast.id and (item.item_type like 'image%' or 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++;
	$podcast = get_podcast($item["podcast_id"]);

	echo ("handling item ".$i." von ".count($items)." - ".$podcast["title"]."/".$item["title"]."<br/>\n");


	$icon_dir = FS_BASE_ICONS.get_item_icon_dir($item);
	if (!is_dir($icon_dir)) {
		mkdir($icon_dir);
	}
	$icon = FS_BASE_ICONS.get_item_icon_path_marker_base($item);

	$icon_png = FS_BASE_ICONS.get_item_icon_path_marker($item, "png");

	echo $icon_png;
	
	if (is_file($icon_png)) continue;
		
	echo $icon_png;

	if (starts_with($item["item_type"], "image")) {
		$local_filename_src = FS_BASE_PODCASTS.get_item_path_converted($item, "image/png/400");
		echo $local_filename_src;
		if (!is_file($local_filename_src)) {
			$local_filename_src = FS_BASE_PODCASTS.get_item_path_converted($item, "image/jpg/400");
			echo $local_filename_src;
		}
		if (is_file($local_filename_src)) {
			echo ("creating marker for item ".$i." von ".count($items)." - ".$item["title"]."<br/>\n");
		
			$e3 = makeMarker($local_filename_src, $icon, 32);
			echo $e3."<br/>\n";
		}
	}
	if (starts_with($item["item_type"], "video")) {
		$local_filename_src = FS_BASE_ICONS.get_item_icon_path($item, "png");
		if (is_file($local_filename_src)) {
			echo ("creating marker for item ".$i." von ".count($items)." - ".$item["title"]."<br/>\n");
		
			$e3 = makeMarker($local_filename_src, $icon, 32);
			echo $e3."<br/>\n";
		}
	}
	
	if (isset($argv)) {
		shell_exec("chown -R www-data.www-data ".$icon_dir."*");
	}
	
	flush();
}




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