Jump to content

Recommended Posts

Hi there...

 

First up let me say, I know nothing about coding in php. done a little with python and java script in the past. But i have a problem the need someone that knows what they are dong to fix. So i figure why not ask for help here.

 

I’m a big fan if mythtv and have used it for almost ten years along with mythweb, but one of the feature I liked a embedded player, that let you watch your recordings while away from home had stopped working. because. I like this feature I went looking for the problem and found a couple of things.  

 

First the code is looking for a file named ffmpeg that I believe is called actually called mythffmpeg. (easy fix)

 

The second thing is that after doing some research I have found that the Split() statement/command  was removed from php 7.0.0 so I think this whole file would need to be rewritten.( very not easy)

 

Posted this in the hope that someone might like to show me how to update this file to work on php 7

even after fixing this file it may not work as there may be other problems in other files but hay its worth a go... ::)

 thanks

<form class="form" method="post" action="<?php echo form_action ?>">

<div class="x-notice" style="width: 45em; text-align: left">
<?php echo t('info: flvplayer') ?>
</div>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
    <th><?php echo t('Enable Video Playback') ?>:</th>
    <td><input class="radio" type="checkbox" name="flvplayer"
         title="<?php echo t('Enable Flash Video player for recordings.') ?>"
        <?php
            $ffmpeg = '';
            foreach (split (':', getenv ('PATH').':/usr/local/bin:/usr/bin') as $path) {
                if (file_exists ($path."/ffmpeg")) {
                    $ffmpeg = $path."/ffmpeg";
                    break;
                }
                elseif (php_uname ('s') == 'Darwin' && file_exists ($path."/ffmpeg.app")) {
                    $ffmpeg = $path."/ffmpeg".app;
                    break;
                }
            }
            $ffmpeg_output = shell_exec ("$ffmpeg -formats 2>&1");
            $has_mp3_support = preg_match('/E\s+mp3/', $ffmpeg_output);
            if (!$has_mp3_support)
                echo ' DISABLED';
            if (setting('WebFLV_on'))
                echo ' CHECKED';
            echo '>';
            if (!$has_mp3_support)
                echo ' '.t('ffmpeg with MP3 support not detected');
            ?></td>
</tr><tr>
    <th valign="top"><?php echo t('Width') ?>:</th>
    <td><input type="text" name="width"
         size="5" title="<?php echo t('FLV Width') ?>"
         value="<?php echo intVal(_or(setting('WebFLV_w'), 320)) ?>" />
         <br>
         <?php echo t('(height is calculated automatically from the recording aspect ratio)') ?>
         </td>
</tr><tr>
    <th><?php echo t('Video Bitrate') ?>:</th>
    <td><input type="text" name="vbitrate"
         size="5" title="<?php echo t('Video Bitrate') ?>"
         value="<?php echo html_entities(_or(setting('WebFLV_vb'), 256)) ?>" />
         kbps</td>
</tr><tr>
    <th><?php echo t('Audio Bitrate') ?>:</th>
    <td><input type="text" name="abitrate"
         size="5" title="<?php echo t('Audio Bitrate') ?>"
         value="<?php echo html_entities(_or(setting('WebFLV_ab'), 64)) ?>" />
         kbps</td>
</tr><tr>
    <td align="right"><input type="reset"  class="submit" value="<?php echo t('Reset') ?>"></td>
    <td align="center"><input type="submit" class="submit" name="save" value="<?php echo t('Save') ?>"></td>
</tr>
</table>

</form>
Link to comment
https://forums.phpfreaks.com/topic/301691-update-a-file-for-php-7/
Share on other sites

It's pretty simple really.

You just follow this migration guide that's provided in the PHP.net manual
http://php.net/manual/en/migration70.php

Generally though, unless you've created something so complicated that it's way above average in its composition, it'll be a pretty smooth transition. Mainly, for your most basic PHP7 compatibility check, you'll just make a list of all the functions that you are using in your code, and check each one against what they show as compatible in the manual.
For instance, let's look at the isset() function. The manual says at the top that it's available with PPHP 4, PHP 5, and PHP 7.

The most important thing you need to make sure of is that you're aware of any changes to functions.

 

Regardless, PHP will give you the error messages you'll need to ask a proper and less broad question.

i guess a real question might be, how would i rewrite this section of the code so as to work with php7?

foreach (split (':', getenv ('PATH').':/usr/local/bin:/usr/bin') as $path) {
                if (file_exists ($path."/ffmpeg")) {
                    $ffmpeg = $path."/ffmpeg";
                    break;
Edited by benlyboy
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.