Ticket #4212: mythweb_video.22.patch

File mythweb_video.22.patch, 3.3 KB (added by octoberblu3, 3 years ago)

updated patch for trunk

  • mythweb/classes/Video.php

    a b  
    6666    // Figure out the URL 
    6767        $this->url = '#'; 
    6868        if (file_exists('data/video/')) 
     69        { 
     70            $mythvideo_dir_ar = split(":", $mythvideo_dir); 
     71            $i = 1; 
     72            foreach ($mythvideo_dir_ar as &$path) { 
     73                $path = '#^' . $path . '/?#'; 
     74                $video_path[$i - 1] = "video$i/"; 
     75                $i++; 
     76            } 
     77            unset($path); 
     78            $video_path[0] = 'video/'; 
     79 
    6980            $this->url = implode('/', array_map('rawurlencode', 
    7081                                             array_map('utf8tolocal', 
    71                                              explode('/', 
    72                                              'data/video/' . preg_replace('#^'.$mythvideo_dir.'/?#', '', $this->filename) 
    73                                        )))); 
     82                                             explode('/', 'data/' .  
     83                                               preg_replace($mythvideo_dir_ar, $video_path, $this->filename) )))); 
     84        } 
     85 
    7486        $genre = $db->query('SELECT videometadatagenre.idgenre 
    7587                               FROM videometadatagenre 
    7688                              WHERE videometadatagenre.idvideo = ?', 
  • mythweb/modules/video/handler.php

    a b  
    3232        } 
    3333 
    3434// Make sure the video directory exists 
    35     if (file_exists('data/video')) { 
     35    $mythvideo_dir_ar = split(":", $mythvideo_dir); 
     36    $i = 1; 
     37 
     38    foreach ($mythvideo_dir_ar as $path) { 
     39    $datapath = 'data/video' . ($i == 1 ? "" : "$i"); 
     40 
     41    if (file_exists($datapath)) { 
    3642    // File is not a directory or a symlink 
    37         if (!is_dir('data/video') && !is_link('data/video')) { 
    38             custom_error('An invalid file exists at data/video.  Please remove it in' 
     43        if (!is_dir($datapath) && !is_link($datapath)) { 
     44            custom_error("An invalid file exists at $datapath.  Please remove it in" 
    3945                        .' order to use the video portions of MythWeb.'); 
    4046        } 
    4147    } 
    4248// Create the symlink, if possible. 
    4349    else { 
    44         if ($mythvideo_dir) { 
     50        if ($path) { 
    4551        // You can't symlink on windows 
    4652            if (strtoupper(substr(php_uname('s'), 0, 3)) != 'WIN') { 
    47                 $ret = @symlink($mythvideo_dir, 'data/video'); 
     53                $ret = @symlink($path, $datapath); 
    4854                if (!$ret) { 
    49                     custom_error("Could not create a symlink to $mythvideo_dir, the local MythVideo" 
     55                    custom_error("Could not create a symlink to $path, the local MythVideo" 
    5056                                .' directory for this hostname ('.hostname.').  Please create a' 
    51                                 .' symlink to your MythVideo directory at data/video in order to' 
     57                                ." symlink to your MythVideo directory at $datapath in order to" 
    5258                                .' use the video portions of MythWeb.'); 
    5359                } 
    5460            } 
     
    6066                        .' to point to the correct location.'); 
    6167        } 
    6268    } 
     69    $i++; } 
    6370 
    6471// Make sure the video covers directory exists 
    6572    if (file_exists('data/video_covers')) {