Commit ed1754f3 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

added channel number offset as a single command line parameter

parent 4141c71a
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -32,6 +32,11 @@ set_time_limit(60*60*24);


$chunksize=10000000; // 10MB 
$chunksize=10000000; // 10MB 
$startMarkerWithExif=chr(hexdec("ff")).chr(hexdec("d8")).chr(hexdec("ff")).chr(hexdec("e1"));
$startMarkerWithExif=chr(hexdec("ff")).chr(hexdec("d8")).chr(hexdec("ff")).chr(hexdec("e1"));
if (count($_SERVER ['argv']) > 1) {
    $chn_shift = $_SERVER ['argv'][1] + 0;
} else {
    $chn_shift = 0;
}


echo "<pre>\n";
echo "<pre>\n";


@@ -65,6 +70,7 @@ foreach ($files as $file) {




function split_mov($path,$mov_file,$dest,$ext,$startMarkerWithExif,$chunksize) {
function split_mov($path,$mov_file,$dest,$ext,$startMarkerWithExif,$chunksize) {
    global $chn_shift;


	$path_with_name = "$path/$mov_file";
	$path_with_name = "$path/$mov_file";


@@ -109,7 +115,7 @@ function split_mov($path,$mov_file,$dest,$ext,$startMarkerWithExif,$chunksize) {
		//converting GMT a local time GMT+7
		//converting GMT a local time GMT+7
		$DateTimeOriginal_local=strtotime($exif_data['DateTimeOriginal']);/*-25200;*/
		$DateTimeOriginal_local=strtotime($exif_data['DateTimeOriginal']);/*-25200;*/
//		$new_file_name = $exif_data['PageNumber'] . "_" . $DateTimeOriginal_local."_".$exif_data['SubSecTimeOriginal'].".".$ext;
//		$new_file_name = $exif_data['PageNumber'] . "_" . $DateTimeOriginal_local."_".$exif_data['SubSecTimeOriginal'].".".$ext;
		$new_file_name = $DateTimeOriginal_local."_".$exif_data['SubSecTimeOriginal']. "_". $exif_data['PageNumber'] . ".".$ext;
		$new_file_name = $DateTimeOriginal_local."_".$exif_data['SubSecTimeOriginal']. "_". ($exif_data['PageNumber']+$chn_shift) . ".".$ext;


		rename($old_file_name,"$path/$dest/$new_file_name");
		rename($old_file_name,"$path/$dest/$new_file_name");
	}    
	}