$bit) { $tag = $bit['tag']; $level = $bit['level']; $type = $bit['type']; if (($level == 3) and ($tag == 'item')) { if ($type == 'open') { $addon = array(); $update = array( 'site' => 'curse', ); } elseif ($type == 'close') { $updates[] = $update; $addons[$addon['name']] = $addon; } } elseif ($level == 4) { $value = preg_replace('/<(div|p)[^>]*?>/im', "\n\n", $bit['value']); $value = preg_replace('/]*?>/im', "\n", $value); $value = trim(strip_tags($value)); switch ($tag) { // Arena Targetting Assistant case 'title': $update['addon'] = $value; $addon['name'] = $value; break; // http://wow.curseforge.com/projects/tb_crossguildchat/ // http://wow.curse.com/downloads/wow-addons/details/kevtool-queue.aspx case 'link': #$addon['url_curseforge'] = $value; $addon['url_curse'] = $value; $update['url'] = $addon['url_curseforge']; // save the Curse ID for later downloadery if (preg_match('%/([\w-.]+)/*$%', $addon['url_curse'], $m)) { $addon['id_curse'] = $m[1]; $update['id_curse'] = $addon['id_curse']; $addon['url_curse'] = "http://wow.curse.com/downloads/wow-addons/details/{$addon['id_curse']}.aspx"; $addon['url_curse'] = preg_replace('/(\.aspx)+/', '.aspx', $addon['url_curse']); $update['url'] = $addon['url_curse']; } break; // noreply@curseforge.com (Tiok) case 'author': $addon['author'] = trim(preg_replace('%([^(]*\(|\)[^)]*$)%', '', $value)); $update['author'] = $addon['author']; break; // CruizeT case 'dc:creator': $addon['author'] = trim(preg_replace('%([^(]*\(|\)[^)]*$)%', '', $value)); $update['author'] = $addon['author']; break; // Tue, 24 Jul 2007 01:59:10 -0000 case 'pubDate': $update['date'] = strtotime($value); $addon['last_change'] = $update['date']; break; // <p> description description ... case 'description': $addon['about'] = format_addontxt($value, $addon['name']); break; } } } // download and parse addon detail pages from the curse.com site $basedir = '/home/pgl/lib/wow/mods'; $pagedir = "$basedir/pages"; if ($updates) { foreach ($updates as $updidx => $update) { if ($update['id_curse']) { $addon = $addons[$update['addon']]; $addon_safename = addon_safename($addon['name']); $curseid = $update['id_curse']; $localpage = "$pagedir/curse-$curseid-$addon_safename.html"; $pageurl = "http://wow.curse.com/downloads/wow-addons/details/$curseid.aspx"; #$cmd = `/home/pgl/scripts/safe-geturl.sh $pageurl $localpage`; $docmd = "/home/pgl/scripts/safe-geturl.sh $pageurl $localpage"; $cachetime = 30; // don't bother downloading if file retrieved in last 30 minutes if (!file_exists($localpage) || (filemtime($localpage) > (time() - (30 * 60)))) { $out = `$docmd`; #echo "$docmd\n"; } @chgrp($localpage, 'www-data'); @chmod($localpage, 0664); list($addon, $update) = parse_curse_html($addon, $update, $localpage); if (!empty($addon)) { $addons[$addon['name']] = $addon; } if (!empty($update)) { $updates[$updidx] = $update; } } } } return array($updates, $addons); } function parse_curse_html($addon, $update, $file='') { if (empty($addon)) return array($addon, $update); if (!$file) return array($addon, $update); if (!$html = file_get_contents($file)) return array($addon, $update); if (preg_match("%([^<]*)<%msi", $html, $m)) { $update['version'] = trim($m[3]); $addon['version'] = $update['version']; if (!$update['url']) { $update['url'] = "http://wow.curse.com{$m[1]}"; } } if (preg_match('%]*id="tab_changes"[^>]*>(.*?)(?= $bit) { $tag = $bit['tag']; $level = $bit['level']; $type = $bit['type']; if (($level == 3) and ($tag == 'item')) { if ($type == 'open') { $addon = array(); $update = array( 'site' => 'ui', ); } elseif ($type == 'close') { $updates[] = $update; $addons[$addon['name']] = $addon; } } elseif ($level == 4) { $value = preg_replace('/<(div|p)[^>]*?>/im', "\n\n", $bit['value']); $value = preg_replace('/]*?>/im', "\n", $value); $value = trim(strip_tags($value)); switch ($tag) { // Natur EnemyCastBar 8.5.7 (WoW 2.2) // also: // Fishing Buddy v0.9.3 case 'title': #echo "
value: $value
"; $value = preg_replace('/\s*\(wow[^)]*\)/i', '', $value); #echo "value: $value
"; #if (preg_match('/(.*?)\s*(?:(?<=\b)([rv]?\d[\w\s.]*)|\(([^)]+)\)|((\d\.\d)+))?$/', $value, $m)) { if (preg_match('/(.*?)\s*(?:(?<=\b)([rv]?\d[\w\s.]*)|\(([^)]+)\))?$/', $value, $m)) { $addon['name'] = $m[1]; $addon['version'] = ($m[3] ? $m[3] : $m[2]); $update['version'] = $addon['version']; } else { $addon['name'] = $value; } $update['addon'] = $addon['name']; break; // http://ui.worldofwar.net/ui.php?id=4152 case 'link': #$addon['url_curse'] = $value; $addon['url_ui'] = preg_replace('%ui\.worldofwar\.net%i', 'wowui.incgamers.com', $value); $update['url'] = $addon['url_ui']; break; /* no author in ui's feed // Tiok case 'author': $addon['author'] = preg_replace('%(^\(|\)$)%', '', $value); break; */ // Tue, 24 Jul 2007 01:59:10 -0000 case 'date': $update['date'] = strtotime($value); $addon['last_change'] = $update['date']; break; // <p> description description ... case 'description': $tmpabout = preg_replace('/(.*) - \\1/', '$1', $value); if ($tmpabout != $addon['name']) { $addon['about'] = preg_replace('/(.*) - \\1/', '$1', $value); } $addon['about'] = format_addontxt($addon['about'], $addon['name']); break; // // 2007-09-12 21:29:33 // #case 'date' } } } #pre($updates); #pre($addons); return array($updates, $addons); } ?> $bit) { $tag = $bit['tag']; $level = $bit['level']; $type = $bit['type']; if (($level == 3) and ($tag == 'item')) { if ($type == 'open') { $addon = array(); $update = array( 'site' => 'wowi', ); } elseif ($type == 'close') { $updates[] = $update; $addons[$addon['name']] = $addon; } } elseif ($level == 4) { $value = preg_replace('/<(div|p)[^>]*?>/im', "\n\n", $bit['value']); $value = preg_replace('/]*?>/im', "\n", $value); $value = trim(strip_tags($value)); switch ($tag) { // OptionHouse (r526) // also: // TTSpellTimer (1.24.20100) case 'title': #echo "
value: $value
"; $value = preg_replace('/\s*\(wow[^)]*\)/i', '', $value); #echo "value: $value
"; if (preg_match('/(.*?)\s*\(([^)]*)\)$/', $value, $m)) { $addon['name'] = $m[1]; $addon['version'] = $m[2]; $update['version'] = $addon['version']; } else { $addon['name'] = $value; } $update['addon'] = $addon['name']; break; // http://www.wowinterface.com/downloads/info7386-1.1.0.1.html case 'link': $update['url'] = $value; $addon['url_wowi'] = $update['url']; if (preg_match('%/info([\d]+).*?\.html$%i', $update['url'], $m)) { $addon['id_wowi'] = $m[1]; $update['id_wowi'] = $addon['id_wowi']; } break; // Tiok case 'author': $addon['author'] = $value; $update['author'] = $addon['author']; break; // Tue, 24 Jul 2007 06:51:36 +0000 case 'pubDate': $update['date'] = strtotime($value); $addon['last_change'] = $update['date']; break; // <p> description description ... case 'description': $addon['about'] = preg_replace('%( (time() - (30 * 60)))) { $out = `$docmd`; #echo "$docmd\n"; } chgrp($localpage, 'www-data'); chmod($localpage, 0664); } } return array($updates, $addons); } ?> World of Warcraft addon update watcher (by Fin) http://fin.instinct.org/wowmods/ fin@instinct.org World of Warcraft addon updates from all major addon sites http://cyber.law.harvard.edu/rss/rss.html World of Warcraft addon update watcher (by Fin) World of Warcraft addon update watcher (by Fin) http://fin.instinct.org/images/mozzie.jpg http://fin.instinct.org/wowmods/