The forum is here for legacy reasons. No new posts will be created. User registration is disabled! If you have any questions, please email us or check https://www.adultscriptpro.com for more details!
You are not logged in.
Pages: 1
i have made a file to show video thumbs in xml for the jw player to show thumbs at the seek bar
but i want to use cache and if this is the right way to do it.
Here is the code
<?php
define('_VALID', true);
require '/var/www/vhosts/mysite.com/httpdocs/libraries/bootstrap.php';
error_reporting(E_ALL);
ini_set('display_errors', 1);
$video_id = (isset($_GET['id'])) ? (int) $_GET['id'] : 0;
if ($video_id === 0) {
die('Invalid video id!');
}
header("content-type:text/xml;charset=utf-8");
ob_start();
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<data>";
$db = VF::factory('database');
$current_date = date('Y-m-d');
$index = array();
$sql = "SELECT v.video_id, v.thumb,
GROUP_CONCAT(DISTINCT c.cat_id) AS categories,
GROUP_CONCAT(DISTINCT c.slug) AS slugs,
GROUP_CONCAT(DISTINCT c.name) AS name,
GROUP_CONCAT(DISTINCT t.name) AS tags
FROM #__video AS v
LEFT JOIN #__video_category AS vc ON (vc.video_id = v.video_id)
LEFT JOIN #__video_categories AS c ON (vc.cat_id = c.cat_id)
LEFT JOIN #__video_tags AS t ON (t.video_id = v.video_id)
LEFT JOIN #__video_meta AS vm ON (vm.video_id = v.video_id)
LEFT JOIN #__user AS u ON (u.user_id = v.user_id)
WHERE v.video_id = ".$video_id."";
$videos = $db->get_rows($sql);
foreach ($videos as $video) {
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/1.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/2.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/3.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/4.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/5.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/6.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/7.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/8.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/9.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/10.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/11.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/12.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/13.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/14.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/15.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/16.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/17.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/18.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/19.jpg</link>',"\n";
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video['video_id']).'/20.jpg</link>',"\n"; }
echo "</data>";
VF::close();
?>
Offline
For the video thumbs you only need the following v.video_id, v.thumb, v.thumbs. The query will become:
$db = VF::factory('db');
$cache = VF::factory('cache');
if (!$video = $cache->get('video_thumbs_'.$video_id, 86400)) {
$db->query("SELECT video_id, thumb, thumbs FROM #__video WHERE video_id = ".$video_id." LIMIT 1");
if ($db->affected_rows()) {
$video = $db->fetch_assoc();
$cache->store('video_thumbs_'.$video_id, $video, 86400);
} else {
$video = array();
}
}
// just checking if this video exists
echo '<data>',"\n";
if (isset($video['thumbs'])) {
$thumbs = (int) $video['thumbs'];
for ($i=1; $i<=$thumbs; $i++) {
echo '<link>'.BASE_URL.'/media/videos/tmb/'.path($video_id).'/'.$i.'.jpg</link>',"\n";
}
}
echo '</data>',"\n";
Didnt test the code. Let me know if it works as expected, if not i fix.
Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds
Offline
getting this error
<b>Fatal error</b>: VF::load() [<a href='function.require'>function.require</a>]: Failed opening required '/var/www/vhosts/mysite.com/httpdocs/libraries/framework/db.php' (include_path='.:/usr/share/pear:/usr/share/php') in <b>/var/www/vhosts/mysite.com/httpdocs/libraries/framework.php</b> on line <b>22</b><br />
Offline
You need to replace /var/www/vhosts/mysite.com/httpdocs/ with /where/aspro/is/installed/
Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds
Offline
And it still doesnt work?
Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds
Offline
Please email me FTP access.
Adult Scripts: Adult Script Pro - Adult Search Script
Adult Advertising/Traffic: Plug Rush - EXOClick - PopAds
Offline
Pages: 1