PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Kalle Sommer Nielsen   Play List Importer   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Play List Importer
Retrieve and parse Windows Media player play lists
Author: By
Last change:
Date: 18 years ago
Size: 2,109 bytes
 

Contents

Class file image Download
<?php
   
// Assuming the class is included

    // Begin Class
   
$media = new MediaImporter;

   
// Get Array
   
$playlist = $media->build('./playlists/mediaplayer.wpl', MEDIA_WMP);
?>
<!-- General info -->
    <h1>Windows Media Player - Playlist info</h1>
    <table border="0" width="700">
        <tr>
            <td width="60%">
                <b>Title:</b>
            </td>
            <td width="40%">
                <?= $playlist['title'] . "\n"; ?>
</td>
        </tr>
        <tr>
            <td>
                <b>Generator Program:</b>
            </td>
            <td>
                <?= $playlist['generator']['program'] . "\n"; ?>
</td>
        </tr>
        <tr>
            <td>
                <b>Generator Version:</b>
            </td>
            <td>
                <?= $playlist['generator']['version'] . "\n"; ?>
</td>
        </tr>
        <tr>
            <td>
                <b>Average Rating:</b>
            </td>
            <td>
                <?= $playlist['averagerating'] . "\n"; ?>
</td>
        </tr>
        <tr>
            <td>
                <b>Total Duration:</b>
            </td>
            <td>
                <?= $playlist['totalduration'] . "\n"; ?>
</td>
        </tr>
        <tr>
            <td>
                <b>Item Count - Original from Media Player:</b>
            </td>
            <td>
                <?= $playlist['itemcount']['original'] . "\n"; ?>
</td>
        </tr>
        <tr>
            <td>
                <b>Item Count - Total entries:</b>
            </td>
            <td>
                <?= $playlist['itemcount']['total'] . "\n"; ?>
</td>
        </tr>
    </table>
    <!-- / General info -->

<?php
   
if($playlist['itemcount']['total'])
    {
       
$current = 1;
?>
<!-- Play list files -->

    <h1>Playlist Files</h1>
    <table border="0" width="90%">
        <tr>
            <td style="background-color: #204060; color: #FFF;" width="10%">
                Path
            </td>
        </tr>
<?php
       
foreach($playlist['body'] as $bb)
        {
?>
<!-- List output for #<?= $current; ?> -->
        <tr>
            <td>
                <?= $bb['path']; ?>
</td>
            <td align="center">
                <input style="width: 100%;" type="button" onclick="window.open('./mediaimporter.php?player=' +getElementById('player').value+ '&file=<?= rawurlencode($bb['path']); ?>', '_ct');" value=" Play " />
            </td>
        </tr>
        <!-- / List output for #<?= $current; ?> -->
<?php
           
++$current;
        }
?>
</table>

    <!-- / Play list files -->
<?php
   
}
?>