Запись CD при помощи PHP
конкретная задача: запись MP3 дисков для моего любимого плеера, давая на вход M3U файл с путями. иногда составляю хорошую подборку, но файлы приходится записывать по отдельности из разных мест.
если, сильно захотеть, я конечно реализую.
хотелось бы узнать ваши мнения и идеи.
известно, что PHP хорошо дружит с CLI (командной строкой), отсюда...
Ты прав это действительно извращение
РНР просто как интерфейс к бибилиотеке.
Кстати для тех кто в танке - никто не говорит что на РНР можно писать только гостевые книги и сайты знакомств. Это вполне полноценный язык, на котором можно написать вполне локальные приложения. Писалку СД/ДВД в частности.
Думаю, если бы PHP был изначально GUI, то те кого удивила тема топика совсем бы не удивились. Вот она - сила графического интерфейса!
Между тем на PHP это сделать так же легко, как скажем на Delphi.
Можетен ачинающему привести один примерчик маленький, если не сложно??
делал для баловства. преобразует IP в доменное имя.
/**
* new1
* 0.01a
*
* by
* fox
* f_mulder@list.ru
* http://foxweb.net.ru
*
* The sample PHP-GTK Application is just a small test
* how easy it is to create desktop-php-applications with
* the php-gtk.
* It has no more function, just a small test!
*
* So don't mind inspecting the code!
*
* And now it is time to create your own app...
*
* Changelog:
* 0.01a
* - first version, so no changes ;)
*/
//Load GTK if not happened yet
if( !class_exists("gtk")) {
dl( "php_gtk." . ( strstr( PHP_OS, "WIN") ? "dll" : "so"));
}
require_once( "GTK_FileDialog.inc");
require_once( "GTK_MessageBox.inc");
require_once( "xml.inc");
$GLOBALS["new1"] = new window1();
$GLOBALS["new1"]->run();
/**
* @author fox f_mulder@list.ru
* @version 0.01a
*
*/
class window1
{
/**
* The main dialog object
* @var GtkWindow/GtkDialog
*/
var $window1;
/**
* Array with all loaded GTK widgets for easy access
* @var array
*/
var $arWidgets;
var $strPathSeparator = "/";
/**
* Title of the dialog window
* Use this variable as MessageBox title
*/
var $strTitle = "window1";
/**
* Constructor
* This function is called when you create an object of window1
*/
function window1() {
$this->InitDialog();
}//function window1()
/**
* let the program enter the gtk input loop - start the user interface
*/
function run()
{
GTK::main();
}//function run()
/**
* Main function
* Loads the user interface, shows the dialog and
* runs the main loop
*/
function InitDialog()
{
$this->BuildDialog();
//Add here your extra initialization
//like loading data/settings
$this->window1->show();
}//function InitDialog()
/**
* dialog creation
* This one loads the widgets and connnects functions
*/
function BuildDialog()
{
$strStyle = "Aqua_mini";
if( isset( $strStyle)) {
GTK::rc_parse( GTK::rc_get_theme_dir() . "/" . $strStyle . "/gtk/gtkrc");
}
strstr( PHP_OS, "WIN") ? $this->strPathSeparator = "\\" : $this->strPathSeparator = "/";
//use libglade for user interface loading
//Main window
$this->glWindow1 = &new GladeXML( dirname( __FILE__) . $this->strPathSeparator . "new1.xml");
$this->window1 = $this->glWindow1->get_widget( "window1");
$this->window1 ->set_title( $this->strTitle);
//$this->window1 ->set_usize( 600, 450);
$this->window1 ->connect( "destroy" , array( &$this, "OnDestroy"));
$this->window1 ->connect( "delete-event" , array( &$this, "OnDelete"));
$this->arWidgets["btnQuit"] = $this->glWindow1->get_widget( "btnQuit");
$this->arWidgets["button2"] = $this->glWindow1->get_widget( "button2");
$this->arWidgets["text1"] = $this->glWindow1->get_widget( "text1");
$this->arWidgets["entry1"] = $this->glWindow1->get_widget( "entry1");
$this->arWidgets["btnQuit"] ->connect( "clicked" , array( &$this, "OnClickedButtonQuit"));
$this->arWidgets["button2"] ->connect( "clicked" , array( &$this, "OnClickedButton2"));
}//function BuildDialog()
/**
* If the dialog is being destroyed, the loop should end
* Place the SaveSettings calls and so here
*/
function OnDestroy()
{
Gtk::main_quit();
}//function OnDestroy()
/**
* Call this function if you want to quit by hand
*/
function OnQuit()
{
if( true) {
$this->window1->destroy();
}
}//function OnQuit()
/**
* This function is called if you click the "x" in the upper right of the window
* The question is: Do you want to keep the window?
* if you return false, the app is closed
* if you return true, the app keeps on working
*/
function OnDelete()
{
if( true) {
return false;
} else {
return true;
}
}//function OnDelete()
function OnClickedButtonQuit( $objPara1)
{
exit;
}//function OnClickedButtonQuit( $objPara1)
function OnClickedButton2( $objPara1)
{
$str = $this->arWidgets["entry1"]->get_text();
$str = gethostbyaddr( $str );
$this->arWidgets["text1"]->insert(null, null, null, "$str\n" );
}
}//class window1
?>
дайте консооооооль!!!
подумал заюзать php_w32api и воспользоваться стандартными средствами записи дисков Windows XP, правда в WinAPI я не то чтобы не силён, а вообще никак ). просто как один из вариантов.
По-моему, ты параноик. Это в качестве диагноза.
Если стоит задача записи дисков из командной строки, найди порты под Win32 юниксовых mkisofs и cdrtools/cdrdao, например, тут. Сама программа, кстати, весьма неплоха, прекрасно держит стандарты, в отличие от Nero. Пишу ею, Nero уже много лет назад отправил в печь.
Если же сыр-бор из-за возможности составления - ищущий да обрящет. Не верю, что подобной проблемой уже кто-то не озаботился и не решил.
Запись дисков - штука неоднозначная, и не факт, что будешь пользоваться собственным решением, даже если и дойдет до пригодного состояния. ИМХО, не та вещь, на которой учатся программированию, да ещё с извращениями.