- <?
-
- /////////////////
- /// PHPlaylist GTmaKer v0.1
- ///////////////// function make_playlist($homedir,$sous_rep,$name) //////////////////
- /// permet de créer une playlist
- /// $homedir => rep à explorer à la recherche de mp3
- /// $sous_rep => si = 1, on explore les sous répertoire de $homedir et le répertoire $homedir
- /// si = 0 on explore juste le répertoire $homedir
- ///$name => nom du fichier
- ///////////////// fichiers générés testés avec media player classic 6.4.6.5
-
-
- set_time_limit(0);
-
- function make_playlist($homedir,$sous_rep,$name)
- {
-
- $dir = openDir($homedir);
- if (!$fp)
- {
- $fp = fopen($name.".m3u",a);
- }
- while ($file = readdir($dir))
- {
- if($file != "." && $file !="..")
- {
- if (is_dir($homedir."/".$file) && $sous_rep == 1)
- {
- make_playlist($homedir."/".$file,1,$name);
- }
-
- $ext = substr($file,strlen($file) - 3,strlen($file));
- $ext = strtolower($ext);
-
- if (is_file($homedir."/".$file) && $ext == "mp3")
- {
- $zik = $homedir."/".$file;
- fputs($fp,$zik."\n");
- }
- }
- }
- closedir($dir);
- return true;
- }
-
- //// PHP GTK
-
- if (!class_exists('gtk')) {
- if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
- {
- dl('php_gtk.dll');
- $winxp_session = "Scullder";
- } else {
- dl('php_gtk.so');
- }
- }
-
- //// Fonctions gtk
-
-
- function DeleteEventFunction()
- {
- return false;
- }
-
- function DestroyFunction()
- {
- Gtk::main_quit();
- }
-
- function QuitFunction()
- {
- global $window,$chemin,$name,$sousrep,$winxp_session;
- $dossier = $chemin->get_text();
- $sous_rep = $sousrep->get_text();
- $nom = $name->get_text();
- make_playlist($dossier,$sous_rep,$nom);
- if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { copy($nom.".m3u","C:/Documents and Settings/".$winxp_session."/Bureau/".$nom.".m3u"); }
- $window->destroy();
-
- }
-
- ////
-
- $window = &new GtkWindow(GTK_WINDOW_TOPLEVEL);
- $window->connect('destroy', 'DestroyFunction');
- $window->connect('delete-event', 'DeleteEventFunction');
- $window->set_border_width(5);
- $window->set_title("PHPlaylist GTmaKer v0.1");
- $window->set_default_size(400, 50);
- $window->realize();
-
-
- $VerticalBox=&new GtkVBox();
- $VerticalBox->set_spacing(5);
- $VerticalBox->set_border_width(0);
-
- $HorizontalBox=&new GtkHBox();
- $HorizontalBox->set_spacing(5);
- $HorizontalBox->set_border_width(0);
-
- $chemin = &new GtkEntry();
- $name = &new GtkEntry();
- $sousrep = &new GtkEntry();
- $Create = &new GtkButton("Chemin - Nom - Explorer les sous-dossiers ? (0-1) => Créer la playlist");
- $Create->connect('pressed', 'QuitFunction');
-
- $HorizontalBox->add($chemin);
- $HorizontalBox->add($name);
- $HorizontalBox->add($sousrep);
- $VerticalBox->add($HorizontalBox);
- $VerticalBox->add($Create);
- $window->add($VerticalBox);
-
- $window->show_all();
-
- Gtk::main();
-
- ?>
<?
/////////////////
/// PHPlaylist GTmaKer v0.1
///////////////// function make_playlist($homedir,$sous_rep,$name) //////////////////
/// permet de créer une playlist
/// $homedir => rep à explorer à la recherche de mp3
/// $sous_rep => si = 1, on explore les sous répertoire de $homedir et le répertoire $homedir
/// si = 0 on explore juste le répertoire $homedir
///$name => nom du fichier
///////////////// fichiers générés testés avec media player classic 6.4.6.5
set_time_limit(0);
function make_playlist($homedir,$sous_rep,$name)
{
$dir = openDir($homedir);
if (!$fp)
{
$fp = fopen($name.".m3u",a);
}
while ($file = readdir($dir))
{
if($file != "." && $file !="..")
{
if (is_dir($homedir."/".$file) && $sous_rep == 1)
{
make_playlist($homedir."/".$file,1,$name);
}
$ext = substr($file,strlen($file) - 3,strlen($file));
$ext = strtolower($ext);
if (is_file($homedir."/".$file) && $ext == "mp3")
{
$zik = $homedir."/".$file;
fputs($fp,$zik."\n");
}
}
}
closedir($dir);
return true;
}
//// PHP GTK
if (!class_exists('gtk')) {
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
{
dl('php_gtk.dll');
$winxp_session = "Scullder";
} else {
dl('php_gtk.so');
}
}
//// Fonctions gtk
function DeleteEventFunction()
{
return false;
}
function DestroyFunction()
{
Gtk::main_quit();
}
function QuitFunction()
{
global $window,$chemin,$name,$sousrep,$winxp_session;
$dossier = $chemin->get_text();
$sous_rep = $sousrep->get_text();
$nom = $name->get_text();
make_playlist($dossier,$sous_rep,$nom);
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { copy($nom.".m3u","C:/Documents and Settings/".$winxp_session."/Bureau/".$nom.".m3u"); }
$window->destroy();
}
////
$window = &new GtkWindow(GTK_WINDOW_TOPLEVEL);
$window->connect('destroy', 'DestroyFunction');
$window->connect('delete-event', 'DeleteEventFunction');
$window->set_border_width(5);
$window->set_title("PHPlaylist GTmaKer v0.1");
$window->set_default_size(400, 50);
$window->realize();
$VerticalBox=&new GtkVBox();
$VerticalBox->set_spacing(5);
$VerticalBox->set_border_width(0);
$HorizontalBox=&new GtkHBox();
$HorizontalBox->set_spacing(5);
$HorizontalBox->set_border_width(0);
$chemin = &new GtkEntry();
$name = &new GtkEntry();
$sousrep = &new GtkEntry();
$Create = &new GtkButton("Chemin - Nom - Explorer les sous-dossiers ? (0-1) => Créer la playlist");
$Create->connect('pressed', 'QuitFunction');
$HorizontalBox->add($chemin);
$HorizontalBox->add($name);
$HorizontalBox->add($sousrep);
$VerticalBox->add($HorizontalBox);
$VerticalBox->add($Create);
$window->add($VerticalBox);
$window->show_all();
Gtk::main();
?>