Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-tools-x393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-tools-x393
Commits
fb3710ba
Commit
fb3710ba
authored
Apr 24, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added filter
parent
b23fde50
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
1 deletion
+147
-1
extract_images.php
extract_images.php
+2
-1
footage_filter.php
eyesis4pi393/footage_filter.php
+145
-0
No files found.
extract_images.php
View file @
fb3710ba
...
@@ -21,7 +21,8 @@
...
@@ -21,7 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
set_time_limit
(
60
*
60
*
24
);
//disable the default time limit for php scripts.
set_time_limit
(
0
);
$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"
));
...
...
eyesis4pi393/footage_filter.php
0 → 100644
View file @
fb3710ba
#!/usr/bin/env php
<?php
/**
* @file footage_filter.php
* @brief filters out incomplete panorama sets from the footage directory
* @copyright Copyright (C) 2017 Elphel Inc.
* @author Elphel Inc. <support-list@support.elphel.com>
*
* @par <b>License</b>:
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//disable the default time limit for php scripts.
set_time_limit
(
0
);
//CONSTANTS
$path
=
"/data/footage/test"
;
// footage root
$dest_path
=
"trash"
;
// folder for collecting non-matching results
function
print_help
(){
global
$argv
;
echo
<<<
"TXT"
Help
:
*
Usage
:
~
$
{
$argv
[
0
]}
path
=
[
path
-
to
-
dir
]
dest_path
=
[
dest
-
subdir
]
where
:
*
path
-
to
-
dir
-
string
-
work
at
this
path
+
1
dir
down
*
dest
-
subdir
-
string
-
save
results
to
"path-to-dir/dest-subdir/"
*
Examples
:
**
Filter
all
images
at
/
data
/
footage
/
test
/
0
puts
incomplete
images
to
'/data/footage/test/trash'
:
~
$
{
$argv
[
0
]}
path
=/
data
/
footage
/
test
/
0
dest_path
=/
data
/
footage
/
test
/
trash
TXT
;
}
if
(
$argv
){
foreach
(
$argv
as
$k
=>
$v
){
if
(
$k
==
0
)
continue
;
$args
=
explode
(
"="
,
$v
);
if
(
isset
(
$args
[
1
]))
$_GET
[
$args
[
0
]]
=
$args
[
1
];
if
(
$v
==
"-h"
||
$v
==
"--help"
||
$v
==
"help"
)
{
print_help
();
die
();
}
}
}
if
(
isset
(
$_GET
[
'path'
])){
$path
=
$_GET
[
'path'
];
}
if
(
isset
(
$_GET
[
'dest_path'
])){
$dest_path
=
$_GET
[
'dest_path'
];
}
if
(
!
is_dir
(
$dest_path
))
{
//creating a folder with access rights - 0777
$old
=
umask
(
0
);
@
mkdir
(
$dest_path
);
umask
(
$old
);
}
$filelist
=
scandir
(
$path
);
echo
"<pre>
\n
"
;
foreach
(
$filelist
as
$value
)
{
//echo $value."\n";
if
(
$value
!=
$dest_path
)
process_folder
(
$value
,
"jp4"
);
}
function
process_folder
(
$file
,
$type
)
{
global
$path
;
global
$processing_folder
;
global
$dest_path
;
$tmp_arr
=
Array
();
$url
=
"
$pre_path
/
$processing_folder
"
;
$ext
=
get_file_extension
(
$file
);
// exclude "." & ".."
if
(
substr
(
$file
,
0
,
1
)
!=
"."
)
{
if
(
$ext
==
""
)
{
if
(
is_dir
(
$url
.
"/"
.
$file
))
{
//echo $url." ".$file."\n";
if
(
$type
==
""
)
{
// do nothing
}
else
{
$list
=
scandir
(
$url
.
"/"
.
$file
);
// getting deeper into indexed subfodlers
foreach
(
$list
as
$elem
){
if
(
get_file_extension
(
$url
.
"/"
.
$file
.
"/"
.
$elem
)
==
$type
)
{
//echo $url."/".$file."/".$elem."\n";
// initialize array
if
(
!
isset
(
$tmp_arr
[
substr
(
$elem
,
0
,
17
)]))
$tmp_arr
[
substr
(
$elem
,
0
,
17
)]
=
0
;
// 9th and 10th images are not part of the panorama
//if (!strstr($elem,"_9.")&&!strstr($elem,"_10."))
$tmp_arr
[
substr
(
$elem
,
0
,
17
)]
++
;
}
}
//do actual copying
//print_r($tmp_arr);
foreach
(
$tmp_arr
as
$key
=>
$val
){
if
(
$val
!=
10
)
{
for
(
$i
=
1
;
$i
<
11
;
$i
++
){
if
(
is_file
(
"
$url
/
$file
/
{
$key
}
_
$i
.
$type
"
)){
//echo "$url/$file/{$key}_$i.$type to $url/$dest_path/{$key}_$i.$type\n";
rename
(
"
$url
/
$file
/
{
$key
}
_
$i
.
$type
"
,
"
$url
/
$dest_path
/
{
$key
}
_
$i
.
$type
"
);
}
}
}
}
}
}
}
else
{
//do nothing
}
}
}
function
get_file_extension
(
$filename
)
{
//return substr(strrchr($filename, '.'), 1);
return
pathinfo
(
$filename
,
PATHINFO_EXTENSION
);
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment