',$line,$match);
		$time = intval($match[1]);
		$second = $time / 1000;
		$milisec = $time % 1000;
		$mark = gmdate("H:i:s", $second);
		$pre_time = sprintf("%s.%03d", $mark, $milisec);
		return $pre_time;
	}

	function mb_urlencode($url)
	{
	   return str_replace(
		  array('%3A', '%2F', '%3F', '%3D', '%26'), 
		  array(':', '/', '?', '=', '&'),
		  rawurlencode($url) //urlencode($url)
	   );
	}

	$media = $_GET['media'];
	
	$t = $media;
	$vttname = substr( $t, 0,  strrpos($media, ".") ).".vtt";
	$sminame = substr( $t, 0,  strrpos($media, ".") ).".smi";

	if ( file_exists($vttname) )
	{
//		unlink($vttname);
	}
	else
	{
		if ( file_exists($sminame) )
		{

			$f = fopen($vttname,"w");
			# Now UTF-8 - Add byte order mark 
			fwrite($f, pack("CCC",0xef,0xbb,0xbf)); 
			fwrite($f, "WEBVTT\n\n");

			$begins = false;
			$org = file($sminame);
			$pre_time = "Working";
			$pre_text = "";

			foreach($org as $line)
			{	
				
				$line = iconv("EUC-KR", "UTF-8", $line);
				$line = strtolower($line);
				$line = strip_tags($line, '');
				$line = str_replace( array(" ",""), "", $line);

				
				if ( startsWith($line, ' %s\n", $pre_time, $cur_time);
						fprintf($f, "%s\n", $pre_text);
						$pre_text = "";
					}
					else
					{
						$begins = true;
					}

					$pre_time = GetVVTTimeFormat($line);
				}
				else if ( $begins )
				{
					$pre_text = $pre_text.$line;
					
				}
				else { }
			}
			fclose($f);
		}
	}

	$file = strchr(substr($media, 1), "/");
	$file = strchr(substr($file, 1), "/");
	$file = substr($file, 1);
	//echo "파일:<".$file.">";

	$path_parts = pathinfo($media);
	//echo "Org:".$media, "
"; //echo "Dir:".$path_parts['dirname'], "
"; //echo "Base:".$path_parts['basename'], "
"; //echo "Ext:.".$path_parts['extension'], "
"; //echo "Filename:".$path_parts['filename'], "
"; // since PHP 5.2.0 $smi = $path_parts['dirname']."/".$path_parts['filename'].".smi"; $smi = strchr(substr($smi, 1), "/"); $srt = $path_parts['dirname']."/".$path_parts['filename'].".srt"; $srt = strchr(substr($srt, 1), "/"); $vtt = $path_parts['dirname']."/".$path_parts['filename'].".vtt"; $vtt = strchr(substr($vtt, 1), "/"); $vtt = strchr(substr($vtt, 1), "/"); ?> <? echo substr(strrchr($media, "/"), 1); ?>
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기