Imdb movie cover for torrent poster

Started by Payaa, January 11, 2013, 07:24:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BamBam0077

Don't mean to be an arse but can someone provide a demo picture of what it does as some of us like to read code and admire the image.  8) Okay!
"When Darkness Shadows Your Doubts, Deep Within Us Is Our Key, Not Success But Everything" ~ Anonymous

DragonCoder

Quote from: djlive on May 22, 2016, 10:48:18 PM
try to add this in details if not work ill give the rest of source code

if (!empty($row["url"])){
                require_once "imdb/imdb.class.php";
                require_once "imdb/imdbpage.php";
                }

yes post rest of source code please

djlive

try to add this in details if not work ill give the rest of source code

if (!empty($row["url"])){
                require_once "imdb/imdb.class.php";
                require_once "imdb/imdbpage.php";
                }

Falken


whocares

Replace files imdb folder from zip file here can ignore the rest of the post
Unless stated otherwise code is untested

Falken

poster not work, but that i use work, så anyone know how to get it to catch the poster?

DragonCoder


Payaa

#2
ADDON for this mod:

Show imdb rating in browse (or where U want):

SQL
ALTER TABLE torrents ADD `imdbrating` varchar(5) character set utf8 collate utf8_bin NOT NULL;

In takeupload.php where the imdb cover pulled out replace the code with this:
if (($imdb != "")AND(strpos($imdb, 'imdb'))AND(strpos($imdb, 'title')))
  {
$rurl = trim($imdb);
  $thenumbers = ltrim(strrchr($rurl,'tt'),'tt'); 
  $thenumbers = ($thenumbers[strlen($thenumbers)-1] == "/" ? substr($thenumbers,0,strlen($thenumbers)-1) : $thenumbers);
  $thenumbers = preg_replace("[^A-Za-z0-9]", "", $thenumbers);
  $movie = new imdb ($thenumbers);
  $movieid = $thenumbers;
  $movie->setid ($movieid);
  $mvrating = $movie->rating();
  $imdbrating = floatval($mvrating);

if (empty($poster) && ($photo_url = $movie->photo_localurl() ) != FALSE)
$poster = unesc("{$BASEURL}/".$photo_url); ///in u-232 source $BASEURL = $INSTALLER09['baseurl']
}


Then in the big query add there the imdbrating and $imdbrating like this:
$ret = sql_query("INSERT INTO torrents (search_text, filename, owner, visible, imdbrating, ......... VALUES ....... , '".$imdbrating."', ........

Then add torrents.imdbrating in browse.php and details.php in the query.

And if U want to shown in browse.php then add this to the torrenttable_functions.php:
///imdb
if (!empty($row["imdb"]) && !empty($row["imdbrating"]))
$imdbrating= "<a href='{$row["imdb"]}' title='Imdb rating points' target='_blank'><font color='aqua'>[Imdb: ".htmlspecialchars($row['imdbrating'])."]</font></a>";
else
$imdbrating= '';


And where the free icon or moderated icon set just put $imdbrating! Thats it!

It can be used for u-232 too :)

Payaa

#1
Hi all!

I'm using tbdev05 but here not section for this :P But I think its working in u-232 too!

So U need poster mod and imdb mod (above ver. 2) installed :)

SQL:
ALTER TABLE torrents ADD `imdb` varchar(255) character set utf8 collate utf8_bin NOT NULL;

Then in browse and details query add torrents.imdb.

In imdb directory U must turn on the cache and to save the pictures. So in mdb_config_class.php (in u-232 source imdb_config_class.php) find this:

$this->usecache = false;

change false to true and the this row below there is more settings what is false change true and where the images url directory set there is a dot (.) remove it.

So mine look like this:
$this->cachedir = dirname(__FILE__).'/cache/';
    /** Use a cached page to retrieve the information if available?
     * @attribute boolean usecache
     */
    $this->usecache = true;
    /** Store the pages retrieved for later use?
     * @attribute boolean storecache
     */
    $this->storecache = true;
    /** Use zip compression for caching the retrieved html-files?
     * @attribute boolean usezip
     */
    $this->usezip = true;
    /** Convert non-zip cache-files to zip (check file permissions!)?
     * @attribute boolean converttozip
     */
    $this->converttozip = true;
    /** Cache expiration - cache files older than this value (in seconds) will
     *  be automatically deleted.
     * @attribute integer cache_expire
     */
    $this->cache_expire = 3600;
    /** Where to store images retrieved from the IMDB site by the method photo_localurl().
     *  This needs to be under documentroot to be able to display them on your pages.
     * @attribute string photodir
     */
    $this->photodir = 'imdb/images/';
    /** URL corresponding to photodir, i.e. the URL to the images, i.e. start at
     *  your servers DOCUMENT_ROOT when specifying absolute path
     * @attribute string photoroot
     */
    $this->photoroot = 'imdb/images/';
    /** Where the local IMDB images reside (look for the "showtimes/" directory)
     *  This should be either a relative, an absolute, or an URL including the
     *  protocol (e.g. when a different server shall deliver them)
     * @attribute string imdb_img_url
     */
    $this->imdb_img_url = 'imdb/imgs/';


Upload.php where U want:
tr("&nbsp;&nbsp;Imdb link:<br />", "<input type='text' name='imdb' size='95' value=''><br />(Full <a href='http://www.imdb.com/' target='_blank' /><u>IMDb</u></a> link!)", 1);

Then in takeupload where the poster mod below we add that we need the feckin cover from imdb and put in the database LOL.

So looke like this:

if (!empty($_POST['poster']))
$poster = unesc($_POST['poster']);

require_once('imdb/imdb.class.php');

if (!empty($_POST['imdb']))
{
$imdb = unesc($_POST['imdb']);
if(!preg_match("|^http://(www.)?(akas.)?(hungarian.)?imdb.com/title/[a-z0-9]+/?$|", $imdb)) //basic check
bark("This is not a fuckin IMDb url!");
}

if (($imdb != "")AND(strpos($imdb, 'imdb'))AND(strpos($imdb, 'title')))
  {
$rurl = trim($imdb);
  $thenumbers = ltrim(strrchr($rurl,'tt'),'tt'); 
  $thenumbers = ($thenumbers[strlen($thenumbers)-1] == "/" ? substr($thenumbers,0,strlen($thenumbers)-1) : $thenumbers);
  $thenumbers = preg_replace("[^A-Za-z0-9]", "", $thenumbers);
  $movie = new imdb ($thenumbers);
  $movieid = $thenumbers;
  $movie->setid ($movieid);

if (empty($poster) && ($photo_url = $movie->photo_localurl() ) != FALSE)
$poster = unesc("{$BASEURL}/".$photo_url); ///in u-232 source $BASEURL = $INSTALLER09['baseurl']
}
if ( preg_match( "/^http:\/\/$/i", $poster )
    or !preg_match("#^https?://(?:[^<>*\"]+|[a-z0-9/\._\-!]+)$#iU", $poster ) )
    $poster='';


Then find the big query and add imdb and $imdb in it! Mine is look like this:
$ret = sql_query("INSERT INTO torrents (search_text, filename, owner, visible, imdb, ......... VALUES ....... , '".$imdb."', ........

Then what I wrote above add torrents.imdb in browse.php and details.php in the query.

Then in details.php where U wants to show:
if ($row["imdb"] != "")
tr("Imdb&nbsp;link",format_urls(htmlspecialchars($row["imdb"])), 1);


Then in edit.php:
tr("Imdb link<br />", "<input type='text' name='imdb' size='80' value='".$row["imdb"]."' />", 1);

And takeedit.php:
if (!empty($_POST['imdb']))
{
$imdb = unesc($_POST['imdb']);
if(!preg_match("|^http://(www.)?(akas.)?(hungarian.)?imdb.com/title/[a-z0-9]+/?$|", $imdb)) //basic check
bark("This is not a fuckin IMDb url!");
}


I think its all :)