Ticket #4212: mythweb_video2.patch

File mythweb_video2.patch, 3.4 KB (added by octoberblu3, 3 years ago)
  • modules/video/handler.php

    old new  
    3232            default:            return "http://www.imdb.com/Title?".$num; 
    3333        } 
    3434       } 
    3535 
    3636// Make sure the video directory exists 
    37     if (file_exists('data/video')) { 
    38     // File is not a directory or a symlink 
    39         if (!is_dir('data/video') && !is_link('data/video')) { 
    40             custom_error('An invalid file exists at data/video.  Please remove it in' 
    41                         .' order to use the video portions of MythWeb.'); 
    42         } 
    43     } 
    44 // Create the symlink, if possible. 
    45     else { 
    46         if ($mythvideo_dir) { 
    47         // You can't symlink on windows 
    48             if (strtoupper(substr(php_uname('s'), 0, 3)) != 'WIN') { 
    49                 $ret = @symlink($mythvideo_dir, 'data/video'); 
    50                 if (!$ret) { 
    51                     custom_error("Could not create a symlink to $mythvideo_dir, the local MythVideo" 
    52                                 .' directory for this hostname ('.hostname.').  Please create a' 
    53                                 .' symlink to your MythVideo directory at data/video in order to' 
    54                                 .' use the video portions of MythWeb.'); 
    55                 } 
     37 
     38    $mythvideo_dir_ar = split(":", $mythvideo_dir); 
     39    $i = 1; 
     40    foreach ($mythvideo_dir_ar as $path) {  
     41        $datapath = 'data/video' . ($i == 1 ? "" : "$i"); 
     42 
     43        if (file_exists($datapath)) { 
     44        // File is not a directory or a symlink 
     45            if (!is_dir($datapath) && !is_link($datapath)) { 
     46                custom_error("An invalid file exists at $datapath.  Please remove it in" 
     47                            .' order to use the video portions of MythWeb.'); 
    5648            } 
    5749        } 
     50    // Create the symlink, if possible. 
    5851        else { 
    59             custom_error('Could not find a value in the database for the' 
    60                         .' MythVideo directory for this hostname ('.hostname.').' 
    61                         .' Please update your <a href="'.root.'settings/mythweb">settings</a>' 
    62                         .' to point to the correct location.'); 
     52            if ($mythvideo_dir) { 
     53            // You can't symlink on windows 
     54                if (strtoupper(substr(php_uname('s'), 0, 3)) != 'WIN') { 
     55                   $ret = @symlink($path, $datapath); 
     56                   if (!$ret) { 
     57                       custom_error("Could not create a symlink to $path, the local MythVideo" 
     58                                   .' directory for this hostname ('.hostname.').  Please create a' 
     59                                   ." symlink to your MythVideo directory at $datapath in order to" 
     60                                   .' use the video portions of MythWeb.'); 
     61                   } 
     62     
     63                } 
     64            } 
     65            else { 
     66                custom_error('Could not find a value in the database for the' 
     67                            .' MythVideo directory for this hostname ('.hostname.').' 
     68                            .' Please update your <a href="'.root.'settings/mythweb">settings</a>' 
     69                            .' to point to the correct location.'); 
     70            } 
    6371        } 
     72        $i++; 
    6473    } 
    6574 
    6675// Make sure the video covers directory exists 
    6776    if (file_exists('data/video_covers')) { 
    6877    // File is not a directory or a symlink