[résolu]dailymotion et phpdirector


hm19000
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 492
Inscription: 2 Oct 2005

[résolu]dailymotion et phpdirector

Message le Dim Juil 20, 2008 0:03

Bonjour,


J'ai installé phpdiretor, mais il y aun probleme avec les vidéos de dailymotion, l'image de la vidéo n'est pas détecté.


J'ai trouvé la version 0.2 , est-ce qu'il y a une version plus récente qui corrige ce probleme ou avez vous une solution ?


Mercu
Dernière édition par hm19000 le Dim Juil 20, 2008 20:01, édité 1 fois.


h4ni
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 486
Inscription: 11 Juil 2005

Message le Dim Juil 20, 2008 10:49

ca patch reglera le probleme normalement
Code: Tout sélectionner
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP Director -Youtube Image Fixer</title>
</head>

<body>
<?php
require("config.php");

$mysql_link = mysql_connect($cfg["db_host"], $cfg["db_user"], $cfg["db_pass"]) or die(mysql_error());
echo "Connected<br />";


mysql_select_db($cfg["db_name"], $mysql_link) or die(mysql_error());
echo "Selected DB<br />";

//$sql = "SELECT * FROM `pp_files` WHERE `picture` LIKE '%static-02%'";
$sql = "SELECT * FROM `pp_files` WHERE `picture` LIKE '%static-%' AND `video_type` = 'dailymotion'";
echo "Found Images<br />";

$result = mysql_query($sql, $mysql_link);

while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
   echo '<br /><b>Old Url</b>'.$row['picture'].'<br />';
   $motion = explode(".dailymotion.com", $row['picture']);
  // echo "http://limelight-450.static.dailymotion.com".$motion[1];
   echo '<img src="http://limelight-450.static.dailymotion.com'.$motion[1].'" />';
   echo "<br />";
 
 
  mysql_query('UPDATE `pp_files` SET `picture` = \'http://limelight-450.static.dailymotion.com'.$motion[1].'\' WHERE id = '.$id.' LIMIT 1;');
}

mysql_free_result($result);
?>
---<br /><br />
---<br />
Thanks for using the script
</body>

</html>
Dernière édition par h4ni le Dim Juil 20, 2008 17:08, édité 1 fois.


hm19000
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 492
Inscription: 2 Oct 2005

Message le Dim Juil 20, 2008 16:55

tu veut dire mettre ca dans un fichier puis l'exécuter ? si c le cas ca n'as pas marché


h4ni
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 486
Inscription: 11 Juil 2005

Message le Dim Juil 20, 2008 17:09

Je viens d'éditer le code
ressaye une autre fois


hm19000
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 492
Inscription: 2 Oct 2005

Message le Dim Juil 20, 2008 18:56

ca n'as pas marché !!! j'utilise la version 0.21 peut etre qu'il y a une version plus récente


h4ni
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 486
Inscription: 11 Juil 2005

Message le Dim Juil 20, 2008 19:00

hm19000 a écrit:ca n'as pas marché !!! j'utilise la version 0.21 peut etre qu'il y a une version plus récente

non y'a pas plus recent, peut tu poster le lien du patch que t'a essayé?


hm19000
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 492
Inscription: 2 Oct 2005

Message le Dim Juil 20, 2008 19:02



h4ni
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 486
Inscription: 11 Juil 2005

Message le Dim Juil 20, 2008 19:22

aucune idée!
et avec youtube , ca donne la meme chose?


hm19000
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 492
Inscription: 2 Oct 2005

Message le Dim Juil 20, 2008 19:32

avec youtube c trés bien, mais dailymotion l'image n"est pas détecté


h4ni
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 486
Inscription: 11 Juil 2005

Message le Dim Juil 20, 2008 19:48

change ton fichier /processes/process_dailymotion.inc.php avec ca

Code: Tout sélectionner
<?php
function getdmid($url){

//checks if valid youtube link

$checkdm = explode(".", $url);

if ($checkdm[1] == "dailymotion" ){

   //gets vid id
$dm_start = explode("/video/",$url,2);
$dm_end = explode("&",$dm_start[1],2);
$gotid = $dm_end[0];
return $gotid;
}
}
/**
* Gets thumb from dailymotion id
*
* @param dailymotion Id
* @return $dm_pic
*/
function getthumb($file){
$dm_xml_pic_start = explode("/preview/",$file,2);
$dm_xml_pic_end = explode("?",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
$dm_pic_1 = "http://limelight-450.static.dailymotion.com/dyn/preview/160x120/".$dm_pic;

return $dm_pic_1;
}

/**
* Gets Author from dailymotion id
*
* @param dailymotion Id
* @return $dm_author
*/
function getauthor($file){
$dm_xml_pic_start = explode("<author><name>",$file,2);
$dm_xml_pic_end = explode("</name><uri>",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}
/**
* Gets Title from dailymotion id
*
* @param dailymotion Id
* @return $dm_title_noslash
*/
function gettitle($file){
$dm_xml_pic_start = explode("<title>",$file,2);
$dm_xml_pic_end = explode("</title>",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}

/**
* Gets description from dailymotion id
*
* @param dailymotion Id
* @return $dm_description
*/
function getdescription($file){
$dm_xml_pic_start = explode("<content type=\"html\">",$file,2);
$dm_xml_pic_end = explode("<",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}

/**
* Gets description from dailymotion id
*
* @param dailymotion Id
* @return $dm_description
*/
function getswf($file){
$dm_xml_pic_start = explode("/swf/",$file,2);
$dm_xml_pic_end = explode("\"",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}

      $did = getdmid($videourl);
      $file = @file_get_contents("http://www.dailymotion.com/atom/fr/cluster/extreme/featured/video/".$did);
      $videoid = getswf($file);
      if($did != null){
      $title  = safe_sql_insert(gettitle($file));
      $author = safe_sql_insert(getauthor($file));
      $des    = safe_sql_insert(getdescription($file));
      $thumb[0]  = safe_sql_insert(getthumb($file));
      $file    = safe_sql_insert(getswf($file));
      $ip     = safe_sql_insert($_SERVER['REMOTE_ADDR']);
      $smarty->assign('file2', $did);
      $smarty->assign('title', $title);
      $smarty->assign('author', $author);
      $smarty->assign('description', $des);
      $smarty->assign('image', $thumb);
      $smarty->assign('videoid', $file);
      $smarty->assign('vidtype', 'dailymotion');

      }//check for blank end

         $didfile = mysql_query("SELECT * FROM `pp_files` WHERE `file2` = CONVERT(_utf8 '$did' USING latin1) COLLATE latin1_swedish_ci  LIMIT 0 , 1")or die(mysql_error());
         $rowdid = mysql_fetch_array($didfile);
         if ($rowdid['file2'] == $did){
            $smarty->assign('error', 'This Video Has Allready Been Submitted');
            $smarty->display('error.tpl');
            exit;
         }
?>


hm19000
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 492
Inscription: 2 Oct 2005

Message le Dim Juil 20, 2008 19:54

ca marche enfin, merci beaucoup hani


h4ni
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 486
Inscription: 11 Juil 2005

Message le Dim Juil 20, 2008 19:57

de rien , n'oublie pas de mettre Résolu dans le titre :P


hm19000
WRInaute occasionnel
WRInaute occasionnel
 
Messages: 492
Inscription: 2 Oct 2005

Message le Dim Juil 20, 2008 20:01

c fait


Si vous avez aimé cette discussion, partagez-la sur vos réseaux sociaux préférés :

Lectures recommandées sur ce thème :



Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 2 invités