이윤영

Add two menu

......@@ -4,8 +4,10 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="delegatedBuild" value="false" />
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
......@@ -15,6 +17,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="testRunner" value="PLATFORM" />
</GradleProjectSettings>
</option>
</component>
......
......@@ -36,6 +36,7 @@ public class DBHelper {
db.execSQL(Databases.CreateDB_AppUsage_WEEK._CREATE_AppUsage_WEEK);
db.execSQL(Databases.CreateDB_AppUsage_DAY._CREATE_AppUsage_DAY);
db.execSQL(Databases.CreateDB_PhoneInfo._CREATE_PhoneInfo);
db.execSQL(Databases.CreateDB_Document._CREATE_Document);
db.execSQL(CallLogDataBase.CreateDB._CREATE0);
db.execSQL(ContactDataBase.CreateDB._CREATE0);
......@@ -57,6 +58,7 @@ public class DBHelper {
db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_AppUsage_WEEK.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_AppUsage_DAY.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_PhoneInfo.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_Document.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + CallLogDataBase.CreateDB._TABLENAME0);
db.execSQL("DROP TABLE IF EXISTS " + ContactDataBase.CreateDB._TABLENAME0);
......@@ -81,7 +83,7 @@ public class DBHelper {
}
public long insertPColumn(String title, int id, String date_added, String display_name
, String mime_type, String path, String latitude, String longitude){
, String mime_type, String path, String latitude, String longitude, String size){
ContentValues values = new ContentValues();
values.put(PhotoDataBase.CreateDB.TITLE, title);
values.put(PhotoDataBase.CreateDB.ID, id);
......@@ -91,12 +93,13 @@ public class DBHelper {
values.put(PhotoDataBase.CreateDB.PATH, path);
values.put(PhotoDataBase.CreateDB.LATITUDE, latitude);
values.put(PhotoDataBase.CreateDB.LONGITUDE, longitude);
values.put(PhotoDataBase.CreateDB.SIZE, size);
return mDB.insert(PhotoDataBase.CreateDB._TABLENAME0, null, values);
}
public long insertVColumn(String title, String date_added, String display_name, String mime_type
, String path, String latitude, String longitude, String album, String artist, String bookmark
,String category, String description, String language, String resolution, String tags){
,String category, String description, String language, String resolution, String tags, String size){
ContentValues values = new ContentValues();
values.put(VideoDataBase.CreateDB.TITLE, title);
values.put(VideoDataBase.CreateDB.DATE_ADDED, date_added);
......@@ -113,6 +116,7 @@ public class DBHelper {
values.put(VideoDataBase.CreateDB.LANGUAGE, language);
values.put(VideoDataBase.CreateDB.RESOLUTION, resolution);
values.put(VideoDataBase.CreateDB.TAGS, tags);
values.put(VideoDataBase.CreateDB.SIZE, size);
return mDB.insert(VideoDataBase.CreateDB._TABLENAME0, null, values);
}
......@@ -167,9 +171,9 @@ public class DBHelper {
values.put(Databases.CreateDB_App.CELLULARUSAGE, cellularbytes);
db.insert(Databases.CreateDB_App.TABLE_NAME, null, values);
Log.d("LogTest","addAppUsage");
//Log.d("LogTest","addAppUsage");
Log.d("LogTest", String.valueOf(cellularbytes));
//Log.d("LogTest", String.valueOf(cellularbytes));
}
public void addAccountInfo(String accountname, String accounttype) {
SQLiteDatabase db = mDBHelper.getWritableDatabase();
......@@ -177,7 +181,21 @@ public class DBHelper {
values.put(Databases.CreateDB_AccountInfo.ACCOUNTNAME, accountname);
values.put(Databases.CreateDB_AccountInfo.ACCOUNTTYPE, accounttype);
db.insert(Databases.CreateDB_AccountInfo.TABLE_NAME, null, values);
Log.d("LogTest","addAccountInfo");
//Log.d("LogTest","addAccountInfo");
}
public void addDocumentInfo(String name, String title, long date_added, long date_modified, String mime_type, String path, String size) {
SQLiteDatabase db = mDBHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(Databases.CreateDB_Document.NAME, name);
values.put(Databases.CreateDB_Document.TITLE, title);
values.put(Databases.CreateDB_Document.DATE_ADDED, date_added);
values.put(Databases.CreateDB_Document.DATE_MODIFIED, date_modified);
values.put(Databases.CreateDB_Document.MIME_TYPE, mime_type);
values.put(Databases.CreateDB_Document.PATH, path);
values.put(Databases.CreateDB_Document.SIZE, size);
db.insert(Databases.CreateDB_Document.TABLE_NAME, null, values);
//Log.d("LogTest","addAccountInfo");
}
public void addAppUsage_YEAR(String packageName, long firsttimestamp, long lasttimestamp,
......@@ -190,7 +208,7 @@ public class DBHelper {
values.put(Databases.CreateDB_AppUsage_YEAR.LASTTIMEUSED, lasttimeused);
values.put(Databases.CreateDB_AppUsage_YEAR.TOTALTIMEFOREGROUND, totaltimeforeground);
db.insert(Databases.CreateDB_AppUsage_YEAR.TABLE_NAME, null, values);
Log.d("LogTest","addAppUsageYear");
//Log.d("LogTest","addAppUsageYear");
}
public void addAppUsage_MONTH(String packageName, long firsttimestamp, long lasttimestamp,
......@@ -203,7 +221,7 @@ public class DBHelper {
values.put(Databases.CreateDB_AppUsage_MONTH.LASTTIMEUSED, lasttimeused);
values.put(Databases.CreateDB_AppUsage_MONTH.TOTALTIMEFOREGROUND, totaltimeforeground);
db.insert(Databases.CreateDB_AppUsage_MONTH.TABLE_NAME, null, values);
Log.d("LogTest","addAppUsageMonth");
//Log.d("LogTest","addAppUsageMonth");
}
public void addAppUsage_WEEK(String packageName, long firsttimestamp, long lasttimestamp,
......@@ -216,7 +234,7 @@ public class DBHelper {
values.put(Databases.CreateDB_AppUsage_WEEK.LASTTIMEUSED, lasttimeused);
values.put(Databases.CreateDB_AppUsage_WEEK.TOTALTIMEFOREGROUND, totaltimeforeground);
db.insert(Databases.CreateDB_AppUsage_WEEK.TABLE_NAME, null, values);
Log.d("LogTest","addAppUsageWeek");
//Log.d("LogTest","addAppUsageWeek");
}
public void addAppUsage_DAY(String packageName, long firsttimestamp, long lasttimestamp,
......
......@@ -8,6 +8,24 @@ import java.lang.reflect.Field;
public final class Databases {
private Databases() {}
public static final class CreateDB_Document implements BaseColumns {
public static final String TABLE_NAME = "DocumentInfo";
public static final String NAME = "name";
public static final String TITLE = "title";
public static final String DATE_ADDED = "date_added";
public static final String DATE_MODIFIED = "date_modified";
public static final String MIME_TYPE = "mime_type";
public static final String PATH = "path";
public static final String SIZE = "size";
public static final String _CREATE_Document = "create table if not exists "+TABLE_NAME+"("
+NAME+" text not null primary key, "
+TITLE+" text not null , "
+MIME_TYPE+" text not null , "
+DATE_ADDED+" timestamp not null , "
+DATE_MODIFIED+" timestamp not null , "
+PATH+" text not null , "
+SIZE+" text not null);";
}
public static final class CreateDB_App implements BaseColumns {
public static final String TABLE_NAME = "AppInfo";
......
......@@ -25,6 +25,7 @@ import android.net.Uri;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.provider.CalendarContract;
import android.provider.CallLog;
......@@ -34,10 +35,13 @@ import android.provider.Telephony;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.net.InetAddress;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import androidx.core.content.ContextCompat;
......@@ -64,11 +68,13 @@ public class LoadingActivity extends Activity {
setContentView(R.layout.activity_loading);
try {
socket = IO.socket("http://172.30.1.40:3000/");
socket = IO.socket("http://192.168.0.8:3000/");
socket.connect();
Log.i("SOCKET", "Connected");
}catch(Exception e){
e.printStackTrace();
Log.i("SOCKET", "Not Connected");
}
startLoading();
......@@ -84,54 +90,108 @@ public class LoadingActivity extends Activity {
getPhoto();
alert("alert","photo");
Log.i("MYLOG", "DB HY Part:1/13");
Log.i("MYLOG", "DB HY Part:1/14");
getVideo();
alert("alert","video");
Log.i("MYLOG", "DB HY Part:2/13");
Log.i("MYLOG", "DB HY Part:2/14");
getAudio();
alert("alert","audio");
Log.i("MYLOG", "DB HY Part:3/13");
Log.i("MYLOG", "DB HY Part:3/14");
getCalendarInfo();
alert("alert","calendar");
Log.i("MYLOG", "DB HY Part:4/13");
Log.i("MYLOG", "DB HY Part:4/14");
getNetworkInfo();
alert("alert","network");
Log.i("MYLOG", "DB HY Part:5/13");
Log.i("MYLOG", "DB HY Part:5/14");
getCallLog();
alert("alert","calllog");
Log.i("MYLOG", "DB YM Part:6/13");
Log.i("MYLOG", "DB YM Part:6/14");
getContact();
alert("alert","contact");
Log.i("MYLOG", "DB YM Part:7/13");
Log.i("MYLOG", "DB YM Part:7/14");
getSMSMessage();
alert("alert","sms");
Log.i("MYLOG", "DB YM Part:8/13");
Log.i("MYLOG", "DB YM Part:8/14");
getWIFI();
alert("alert","wifi");
Log.i("MYLOG", "DB YM Part:9/13");
Log.i("MYLOG", "DB YM Part:9/14");
getPhoneInfo();
alert("alert","phoneinfo");
Log.i("MYLOG", "DB YY Part:10/13");
Log.i("MYLOG", "DB YY Part:10/14");
getAccountInfo();
alert("alert","accountinfo");
Log.i("MYLOG", "DB YY Part:11/13");
Log.i("MYLOG", "DB YY Part:11/14");
getAppInfo();
alert("alert","appinfo");
Log.i("MYLOG", "DB YY Part:12/13");
Log.i("MYLOG", "DB YY Part:12/14");
getUsageStats();
alert("alert","usagestats");
Log.i("MYLOG", "DB YY Part:13/13");
Log.i("MYLOG", "DB YY Part:13/14");
getDocument();
Log.i("MYLOG", "DB YY Part:14/14");
dbHelper.close();
finish();
alert("end", "end");
}
}, 2000);
}
public void getDocument() {
String[] projection = {
MediaStore.Files.FileColumns._ID,
MediaStore.Files.FileColumns.MIME_TYPE,
MediaStore.Files.FileColumns.DATE_ADDED,
MediaStore.Files.FileColumns.DATE_MODIFIED,
MediaStore.Files.FileColumns.DISPLAY_NAME,
MediaStore.Files.FileColumns.TITLE,
MediaStore.Files.FileColumns.SIZE,
MediaStore.Files.FileColumns.DATA
};
String mimeType = "application/pdf";
String whereClause = MediaStore.Files.FileColumns.MIME_TYPE + " IN ('" + mimeType + "')"
+ " OR " + MediaStore.Files.FileColumns.MIME_TYPE + " LIKE 'application/vnd%'";
String orderBy = MediaStore.Files.FileColumns.SIZE + " DESC";
Cursor cursor = getContentResolver().query(MediaStore.Files.getContentUri("external"),
projection,
whereClause,
null,
orderBy);
int idCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns._ID);
int mimeCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.MIME_TYPE);
int addedCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATE_ADDED);
int modifiedCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATE_MODIFIED);
int nameCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DISPLAY_NAME);
int titleCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.TITLE);
int sizeCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE);
int dataCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA);
if (cursor.moveToFirst()) {
do {
//Uri fileUri = Uri.withAppendedPath(MediaStore.Files.getContentUri("external"), cursor.getString(idCol));
String mime = cursor.getString(mimeCol);
long dateAdded = cursor.getLong(addedCol);
long dateModified = cursor.getLong(modifiedCol);
String name = cursor.getString(nameCol);
String title = cursor.getString(titleCol);
long size = cursor.getLong(sizeCol);
String path = cursor.getString(dataCol);
Log.i("documents", mime + ", " + dateAdded + ", " + dateModified + ", " + name + ", " + title + ", " + size + ", " + path);
dbHelper.addDocumentInfo(cursor.getString(nameCol), cursor.getString(titleCol), cursor.getLong(addedCol)
, cursor.getLong(modifiedCol), cursor.getString(mimeCol), cursor.getString(dataCol),String.valueOf(cursor.getLong(sizeCol)));
} while (cursor.moveToNext());
}
}
public void getPhoto() {
Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
......@@ -159,9 +219,13 @@ public class LoadingActivity extends Activity {
photo.setLatitude(cursor.getString(6));
photo.setLongitude(cursor.getString(7));
File f = new File(cursor.getString(5));
long size = f.length();
dbHelper.insertPColumn(photo.getTitle(), photo.getId(), photo.getDate()
, photo.getDisplayName(), photo.getType(), photo.getPath()
, photo.getLatitude(), photo.getLongitude());
, photo.getLatitude(), photo.getLongitude(),String.valueOf(size));
}
}
......@@ -208,10 +272,13 @@ public class LoadingActivity extends Activity {
video.setMIME_type(cursor.getString(13));
video.setTitle(cursor.getString(14));
File f = new File(cursor.getString(9));
long size = f.length();
dbHelper.insertVColumn(video.getTitle(), video.getDate_added(), video.getDisplay_Name()
, video.getMIME_type(), video.getPath(), video.getLatitude(), video.getLongitude()
, video.getAlbum(), video.getArtist(), video.getBookmark(), video.getCategory()
, video.getDescription(), video.getLanguage(), video.getResolution(), video.getTags());
, video.getDescription(), video.getLanguage(), video.getResolution(), video.getTags(), String.valueOf(size));
}
}
......@@ -547,8 +614,8 @@ public class LoadingActivity extends Activity {
for (UsageStats usagestat : queryUsageStats) {
dbHelper.addAppUsage_WEEK(usagestat.getPackageName(),usagestat.getFirstTimeStamp(), usagestat.getLastTimeStamp(),usagestat.getLastTimeUsed(), usagestat.getTotalTimeInForeground());
}
queryUsageStats = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, 0, System.currentTimeMillis());
queryUsageStats = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, 0,
System.currentTimeMillis());
for (UsageStats usagestat : queryUsageStats) {
dbHelper.addAppUsage_DAY(usagestat.getPackageName(),usagestat.getFirstTimeStamp(), usagestat.getLastTimeStamp(),usagestat.getLastTimeUsed(), usagestat.getTotalTimeInForeground());
}
......
......@@ -12,6 +12,7 @@ public final class PhotoDataBase {
public static final String PATH = "path";
public static final String LATITUDE = "latitude";
public static final String LONGITUDE = "longitude";
public static final String SIZE = "size";
public static final String _TABLENAME0 = "photo";
public static final String _CREATE0 = "create table if not exists "+_TABLENAME0+"("
+TITLE+" text not null primary key, "
......@@ -21,6 +22,7 @@ public final class PhotoDataBase {
+MIME_TYPE + " text not null,"
+PATH + " text not null,"
+LATITUDE + " text,"
+LONGITUDE + " text);";
+LONGITUDE + " text,"
+SIZE + " text);";
}
}
......
......@@ -19,6 +19,7 @@ public final class VideoDataBase {
public static final String DISPLAY_NAME = "display_name";
public static final String MIME_TYPE = "mime_type";
public static final String TITLE = "title";
public static final String SIZE = "size";
public static final String _TABLENAME0 = "video";
public static final String _CREATE0 = "create table if not exists "+_TABLENAME0+"("
+TITLE+" text not null primary key, "
......@@ -35,6 +36,7 @@ public final class VideoDataBase {
+DESCRIPTION + " text, "
+LANGUAGE +" text, "
+RESOLUTION + " text, "
+TAGS + " text);";
+TAGS + " text, "
+SIZE+" text);";
}
}
......
1
com.example.dataextraction
1
29
0
1
308201dd30820146020101300d06092a864886f70d010105050030373116301406035504030c0d416e64726f69642044656275673110300e060355040a0c07416e64726f6964310b3009060355040613025553301e170d3138303930363130323134335a170d3438303832393130323134335a30373116301406035504030c0d416e64726f69642044656275673110300e060355040a0c07416e64726f6964310b300906035504061302555330819f300d06092a864886f70d010101050003818d0030818902818100a6596a004a40dadfa9657fa99b49f80ae526fce07b27a97f61c2e43a53992b293743cf04277293e52c4ae6991f4d83cf43a8f94420da00836361a34cab6c82b99a8b4f54e4c29f425e05319884f1ef7fdedfd94fc315ff677b9c0e0c1bf438f200bd3ff70f610a0b5c735e4988850501e6386a54f306155e9c871c25b59de63d0203010001300d06092a864886f70d0101050500038181009967d07dc0402f932c6c7d6125165068feb0eb5d494ed3c74cba0bd09ad9c2a2f8faf12cf0341849dd622de0d23562f284fecca507e39f1f5983d6383b8cd2b0a1b9d007fcd0adf3fa51542639392e58b6438482ba0b543372cfc4363706bfbf7cc80120e28ad374893d9cd3b7a43a5fee221f7337d489c24b33f901f5e4477f
.menu-header{
line-height: 1;
}
.title-name {
font-family: 'Born Ready Slanted';
font-size: 40px;
}
.title-detail {
font-family: '나눔바른고딕';
font-size: 18px;
}
.title-back {
font-family: '나눔바른고딕';
font-size: 15px;
}
.nav-color{
background-color: #4e73df;
}
.font-nanum{
font-family: '나눔바른고딕';
}
#table {
font-family: "나눔바른고딕";
border-collapse: collapse;
width: 100%;
font-size: 10px;
}
#table td, #table th {
border: 1px solid #ddd;
padding: 8px;
}
#table tr:nth-child(even){background-color: #f2f2f2;}
#table tr:hover {background-color: #ddd;}
#table th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #9db5fc;
color: black;
}
\ No newline at end of file
......@@ -17,7 +17,7 @@
#div_con2{
background-color:beige;
width:29%;
height:600px;
height:825px;
float:left;
text-align : left;
}
......@@ -92,4 +92,18 @@ h4{
#btn_group button:hover{
color:white;
background-color: skyblue;
}
#btn_another button{
border: 1px hidden black;
background-color: skyblue;
color: white;
padding: 50px;
display: table;
margin-left: auto;
margin-right: auto;
margin-top: 10%;
}
#btn_another button:hover{
color:black;
background-color: rgba(0,0,0,0);
}
\ No newline at end of file
......
.menu-header{
line-height: 1;
}
.title-name {
font-family: 'Born Ready Slanted';
font-size: 40px;
}
.title-detail {
font-family: '나눔바른고딕';
font-size: 18px;
}
.title-back {
font-family: '나눔바른고딕';
font-size: 15px;
}
.nav-color{
background-color: #4e73df;
}
.font-nanum{
font-family: '나눔바른고딕';
}
.sort{
font-family: '나눔바른고딕';
font-size: 10px;
}
.filetype{
font-family: '나눔바른고딕';
font-size: 13px;
}
.media:hover {background-color: #ddd;}
.table {
font-family: "나눔바른고딕", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
.table td, #table th {
border: 1px solid #ddd;
padding: 8px;
}
.table tr:nth-child(even){background-color: #f2f2f2;}
.table tr:hover {background-color: #ddd;}
.table th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #5782ff;
color: white;
}
\ No newline at end of file
......@@ -2,6 +2,12 @@ const { app, BrowserWindow, ipcMain, dialog } = require('electron')
const path = require('path')
const url = require('url')
const vision = require('@google-cloud/vision');
var exec = require('child_process').exec, child;
// Imports the Google Cloud Video Intelligence library + Node's fs library
const video = require('@google-cloud/video-intelligence').v1;
const fs = require('fs');
const util = require('util');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
......@@ -119,7 +125,211 @@ ipcMain.on("device-name", (e, arg) => {
var content = {path : path, name : name, labels : labels}
label_result.push(content);
}
var video_label_result = new Array();
var video_detect_result = new Array();
ipcMain.on("video-analysis", async (e, arg) => {
console.log(arg + "from menu_media");
video_label_result = [];
video_detect_result = [];
await Promise.all(arg.map(async (value)=>{
// await copy_file(value);
// setTimeout(function() { }, 10000);
await get_content_detection(value);
// await get_videolabels(value);
}))
await Promise.all(arg.map(async (value)=>{
// await copy_file(value);
// setTimeout(function() { }, 10000);
//await get_content_detection(value);
await get_videolabels(value);
}))
var video_analysis_result = [video_label_result,video_detect_result];
console.log(video_analysis_result);
win.webContents.send("getvideodetail", video_analysis_result);
//win.webContents.send("getvideodetail", [temp_label,temp_detect]);
});
function checkandcopy(arg){
return new Promise(function(resolve, reject){
setTimeout(function(){
for(var i=0; i < arg.length; i++){
cmd_pull = exec('adb pull '+arg[i]);
}
resolve(true);
}, 1000)
})
}
async function copy_file(path){
return new Promise(function(resolve, reject){
setTimeout(function(){
cmd_pull = exec('adb pull '+path,function(error, stdout, stderr){
if(error){
console.log(error);
}
});
resolve(true);
}, 1000)
})
}
function send_labels_to_menu_media(event){
win.webContents.send("getvideodetail", 'response message');
}
async function get_videolabels(path){
var video_name = path.split('/');
video_name = video_name[video_name.length-1];
// Creates a client
const client = new video.VideoIntelligenceServiceClient();
var video_path = __dirname+'\\' + video_name;
var temp = video_path.split('\\');
var beforeslice = '';
for(var i = 0; i < temp.length; i++){
beforeslice += temp[i] + '/';
}
const vpath = beforeslice.slice(0,-1);
console.log(vpath);
// Reads a local video file and converts it to base64
const readFile = util.promisify(fs.readFile);
const file = await readFile(vpath);
const inputContent = file.toString('base64');
console.log("video convert");
// Constructs request
const request = {
inputContent: inputContent,
features: ['LABEL_DETECTION'],
};
// Detects labels in a video
const [operation] = await client.annotateVideo(request);
console.log('Waiting for operation to complete...');
const [operationResult] = await operation.promise();
// Gets annotations for video
const annotations = operationResult.annotationResults[0];
const labels = annotations.segmentLabelAnnotations;
console.log(labels);
var content = {video : video_name,labels : []}
labels.forEach(label => {
console.log(`Label ${label.entity.description} occurs at:`);
content['labels'].push(label.entity.description);
content[label.entity.description] = [];
label.segments.forEach(segment => {
const time = segment.segment;
if (time.startTimeOffset.seconds === undefined) {
time.startTimeOffset.seconds = 0;
}
if (time.startTimeOffset.nanos === undefined) {
time.startTimeOffset.nanos = 0;
}
if (time.endTimeOffset.seconds === undefined) {
time.endTimeOffset.seconds = 0;
}
if (time.endTimeOffset.nanos === undefined) {
time.endTimeOffset.nanos = 0;
}
console.log(
`\tStart: ${time.startTimeOffset.seconds}` +
`.${(time.startTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\tEnd: ${time.endTimeOffset.seconds}.` +
`${(time.endTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(`\tConfidence: ${segment.confidence}`);
var temp = [time.startTimeOffset.seconds + '.' + (time.startTimeOffset.nanos / 1e6).toFixed(0),
time.endTimeOffset.seconds + '.' + (time.endTimeOffset.nanos / 1e6).toFixed(0),
segment.confidence];
content[label.entity.description].push(temp);
});
});
console.log(content);
video_label_result.push(content);
}
async function get_content_detection(path){
var video_name = path.split('/');
video_name = video_name[video_name.length-1];
// Creates a client
const client = new video.VideoIntelligenceServiceClient();
var video_path = __dirname+'\\' + video_name;
var temp = video_path.split('\\');
var beforeslice = '';
for(var i = 0; i < temp.length; i++){
beforeslice += temp[i] + '/';
}
const vpath = beforeslice.slice(0,-1);
console.log(vpath);
// Reads a local video file and converts it to base64
const readFile = util.promisify(fs.readFile);
const file = await readFile(vpath);
const inputContent = file.toString('base64');
console.log("video convert");
const request = {
inputContent: inputContent,
features: ['EXPLICIT_CONTENT_DETECTION'],
};
// Human-readable likelihoods
const likelihoods = [
'UNKNOWN',
'VERY_UNLIKELY',
'UNLIKELY',
'POSSIBLE',
'LIKELY',
'VERY_LIKELY',
];
// Detects unsafe content
const [opertaion] = await client.annotateVideo(request);
console.log('Waiting for operation to complete...');
const [operationResult] = await opertaion.promise();
// Gets unsafe content
const explicitContentResults =
operationResult.annotationResults[0].explicitAnnotation;
console.log('Explicit annotation results:');
var content = {video : video_name, likelihood : []}
explicitContentResults.frames.forEach(result => {
if (result.timeOffset === undefined) {
result.timeOffset = {};
}
if (result.timeOffset.seconds === undefined) {
result.timeOffset.seconds = 0;
}
if (result.timeOffset.nanos === undefined) {
result.timeOffset.nanos = 0;
}
console.log(
`\tTime: ${result.timeOffset.seconds}` +
`.${(result.timeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\t\tPornography likelihood: ${likelihoods[result.pornographyLikelihood]}`
);
var temp = [result.timeOffset.seconds + '.' + (result.timeOffset.nanos / 1e6).toFixed(0),
likelihoods[result.pornographyLikelihood]];
content['likelihood'].push(temp);
});
console.log(content);
video_detect_result.push(content);
}
//detext unsafe image
let detect_result = new Array();
......@@ -202,4 +412,4 @@ ipcMain.on("device-name", (e, arg) => {
})
//이전에 사용한 photos 폴더 삭제
var rimraf = require("rimraf");
rimraf("./photos", function(){console.log("")});
\ No newline at end of file
rimraf("./photos", function(){console.log("")});
......
This diff is collapsed. Click to expand it.
......@@ -4,24 +4,28 @@
"description": "",
"main": "main.js",
"scripts": {
"start": "electron ."
"start": "electron .",
"rebuild": "electron-rebuild -f -w sqlite3"
},
"author": "Hee <glwjd0414@khu.ac.kr>",
"license": "ISC",
"devDependencies": {
"electron": "^8.2.0"
"electron": "^8.2.0",
"electron-rebuild": "^1.11.0"
},
"dependencies": {
"@google-cloud/vision": "^2.0.0",
"appium-adb": "^7.27.1",
"bootstrap-icons": "^1.0.0-alpha4",
"chart.js": "^2.9.3",
"@google-cloud/video-intelligence": "^3.0.0",
"appium-adb": "^7.27.1",
"electron-log": "^4.2.0",
"jQuery": "^1.7.4",
"jquery": "^3.5.0",
"mysql": "^2.18.1",
"node-adb": "^0.1.6",
"python-shell": "^2.0.0",
"rimraf": "^3.0.2",
"socket.io": "^2.3.0"
"socket.io": "^2.3.0",
"sqlite3": "^4.2.0"
}
}
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<link rel="stylesheet" href="../assets/css/alldata.css">
<title>Document</title>
</head>
<body>
<header class="menu-header py-4">
<div class="row pl-3 d-flex justify-content-start flex-nowrap align-items-end">
<div class="col">
<a class="title-name text-dark">All data</a>
</div>
<div div class="col-8">
<a class="title-detail">추출 데이터 확인</a>
</div>
<div div class="col">
<a class="title-back" href="menu.html" id="menu-out">나가기</a>
</div>
</div>
</header>
<div class="nav-scroller nav-color py-1 mb-2">
<nav class="nav d-flex justify-content-around">
<a class="p-2" href="#" style="color: whitesmoke" id="menu-info">INFO</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-calling">CALLING</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-photo">PHOTO</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-contact">CONTACT</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-video">VIDEO</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-sms">SMS</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-audio">AUDIO</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-document">DOCUMENT</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-calendar">CALENDAR</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-network">NETWORK</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-appinfo">APP INFO</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-wifi">WIFI</a>
<a class="p-2" href="#" style="color: whitesmoke" id="menu-usagestats">USAGESTATS</a>
</nav>
</div>
<div ids = "table_list">
<table id="table">
<tbody>
</tbody>
</table>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script src="alldata_menu.js"></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed. Click to expand it.
......@@ -32,16 +32,16 @@ connect_btn.addEventListener("click", () => {
/*
var connection = mysql.createConnection({
host:'localhost',
user:'root',
password:'1234'
user: 'root',
password: '1234'
});
connection.connect();
*/
var mysql = {
user : 'root',
password : '1234'
user: 'root',
password: '1234'
};
function apkInstall(){
......@@ -77,6 +77,82 @@ function convertToMysql(){
})
}
// function extractDB () {
// cmd_backup = exec('adb -s '+device+' backup com.example.dataextraction -f backup.dataextraction.ad', function(error, stdout, stderr){
// cc.innerHTML="backup app";
// setTimeout(function(){
// cmd_unpack = exec('java -jar abe.jar unpack backup.dataextraction.ad dataextraction.tar',function(error, stdout, stderr){
// cc.innerHTML="unpack backup";
// cmd_unzip = exec('tar xvf dataextraction.tar', function(error, stdout, stderr){
// cc.innerHTML="unzip tar";
// cmd_moveIdb = fs.rename('apps/com.example.dataextraction/db/InnerDatabase.db', 'InnerDatabase.db', function(){
// cc.innerHTML="move InnerDB File";
// cmd_moveNdb = fs.rename('apps/com.example.dataextraction/db/networkDatabase.db', 'networkDatabase.db',function(){
// cc.innerHTML="move NetworkDB File";
// cmd_sqlIdb = exec('sqlite3 InnerDatabase.db .dump | python SQLiteToMysql.py > InnerDatabase.sql',function(error, stdout, stderr){
// cc.innerHTML="make InnerDB SQL";
// cmd_sqlNdb = exec('sqlite3 networkDatabase.db .dump | python SQLiteToMysql_network.py > networkDatabase.sql', function(error, stdout, stderr){
// cc.innerHTML="make NetworkDB SQL";
// cmd_makeIdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' -e "DROP DATABASE IF EXISTS DATAEXTRACTION;CREATE DATABASE DATAEXTRACTION CHARACTER SET utf8 COLLATE utf8_unicode_ci;USE DATAEXTRACTION;"',function(error, stdout, stderr){
// cc.innerHTML="create InnerDB";
// cmd_insertIdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION < InnerDatabase.sql',function(error, stdout, stderr){
// cc.innerHTML="insert Data ; InnerDB";
// cmd_makeNdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' -e "DROP DATABASE IF EXISTS DATAEXTRACTION_network;CREATE DATABASE DATAEXTRACTION_network;USE DATAEXTRACTION_network;"',function(error, stdout, stderr){
// cc.innerHTML="create NetworkDB";
// cmd_insertNdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION_network < networkDatabase.sql',function(error, stdout, stderr){
// cc.innerHTML="insert Data ; NetworkDB";
// cc.innerHTML="Data Extraction Complete !";
// cc.innerHTML="Click 'NEXT' Button";
// })
// })
// })
// })
// })
// })
// })
// })
// })
// })
// },7000);
// });
// //cmd_backup();
// }
// //db insert done
// io.on('connection', function(socket){
// var instanceId = socket.id;
// socket.on('alert', function(data){
// cc.innerHTML = data.comment+" db created";
// })
// socket.on('end', function(data){
// cc.innerHTML="all databases created !";
// extractDB();
// })
// })
function convertToMysql(){
cmd_sqlIdb = exec('sqlite3 InnerDatabase.db .dump | python SQLiteToMysql.py > InnerDatabase.sql',function(error, stdout, stderr){
cc.innerHTML="make InnerDB SQL";
cmd_sqlNdb = exec('sqlite3 networkDatabase.db .dump | python SQLiteToMysql_network.py > networkDatabase.sql', function(error, stdout, stderr){
cc.innerHTML="make NetworkDB SQL";
cmd_makeIdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' -e "DROP DATABASE IF EXISTS DATAEXTRACTION;CREATE DATABASE DATAEXTRACTION CHARACTER SET utf8 COLLATE utf8_unicode_ci;USE DATAEXTRACTION;"',function(error, stdout, stderr){
cc.innerHTML="create InnerDB";
cmd_insertIdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION < InnerDatabase.sql',function(error, stdout, stderr){
cc.innerHTML="insert Data ; InnerDB";
cmd_makeNdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' -e "DROP DATABASE IF EXISTS DATAEXTRACTION_network;CREATE DATABASE DATAEXTRACTION_network;USE DATAEXTRACTION_network;"',function(error, stdout, stderr){
cc.innerHTML="create NetworkDB";
cmd_insertNdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION_network < networkDatabase.sql',function(error, stdout, stderr){
cc.innerHTML="insert Data ; NetworkDB";
cc.innerHTML="Data Extraction Complete !";
cc.innerHTML="Click 'NEXT' Button";
})
})
})
})
})
})
}
function extractDB () {
cmd_backup = exec('adb -s '+device+' backup com.example.dataextraction -f backup.dataextraction.ad', function(error, stdout, stderr){
cc.innerHTML="backup app";
......@@ -119,5 +195,7 @@ ipcRenderer.on("device", (e, arg) => {
//device.innerHTML = arg.toString();
cc.innerHTML="DATA EXTRACTION START !";
apkInstall();
// apkInstall();
extractDB();
});
......
......@@ -18,7 +18,7 @@
<button id="btn" class="menu_alldata_nwide" onclick="menu_all();">All Data
<div id="menu_alldata_wide" style="display:none">
<br>
<h2 onclick="location.href='menu0.html'">전체 데이터 보기</h2>
<h2 onclick="location.href='alldata_menu.html'">전체 데이터 보기</h2>
<svg class="bi bi-arrow-right-circle" width="0.3em" height="0.3em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="color:#4e73df" onclick="location.href='menu0.html'">
<path fill-rule="evenodd" d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path fill-rule="evenodd" d="M7.646 11.354a.5.5 0 0 1 0-.708L10.293 8 7.646 5.354a.5.5 0 1 1 .708-.708l3 3a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0z"/>
......@@ -72,7 +72,7 @@
<div id ="menu" class="menu_up">
<div id="btn_group">
<button id="btn" class="menu_analysis_menu3_nwide" onclick="menu_analysis_menu3();">Apps
<div id="menu_analysis_menu3_wide" style="display:none" onclick="location.href='menu3.html'">
<div id="menu_analysis_menu3_wide" style="display:none" onclick="location.href='menu_apps.html'">
<h4>어플리케이션 사용 분석</h4>
<div id="wide_location">
<h2>어플 사용 분석</h2>
......@@ -89,7 +89,7 @@
<div id ="menu">
<div id="btn_group">
<button id="btn" class="menu_analysis_menu4_nwide" onclick="menu_analysis_menu4();">Media
<div id="menu_analysis_menu4_wide" style="display:none" onclick="location.href='menu4.html'">
<div id="menu_analysis_menu4_wide" style="display:none" onclick="location.href='menu_media.html'">
<h4>미디어 파일 저장공간 분석<br>비디오 분석</h4>
<div id="wide_location">
<h2>미디어 분석</h2>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<link rel="stylesheet" href="../assets/css/menu_apps.css">
<title>Document</title>
</head>
<body>
<div class="container">
<header class="menu-header py-4">
<div class="row d-flex justify-content-start flex-nowrap align-items-end">
<div class="col">
<a class="title-name text-dark">Apps</a>
</div>
<div div class="col-9">
<a class="title-detail">앱 사용 정보 분석</a>
</div>
<div div class="col">
<a class="title-back" href="menu.html" id="menu-info">뒤로가기</a>
</div>
</div>
</header>
<div class="nav-scroller nav-color py-1 mb-2">
<nav class="nav d-flex justify-content-around">
<a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('App-List');">App List</a>
<a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Deleted-App');">Deleted App</a>
<a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Recent-Usage');">Recent Usage</a>
</nav>
</div>
<div class="container">
<div id="App-List" class="menu">
<div class="row">
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2 mb-0 font-nanum">App List</h6>
<div class="row sort justify-content-end">
<a id="wifiusage" class="sort p-2 text-muted" href="#" onclick="getAppInfoList('wifiusage');">wifi 사용량순</a>
<a id="cellularusage" class="sort p-2 text-muted" href="#" onclick="getAppInfoList('cellularusage');">cellular 사용량순</a>
<a id="totaltime" class="sort p-2 text-muted" href="#" onclick="getAppInfoList('totaltime');" style="font-weight: bold;">실행 시간순</a>
</div>
<div id="applist">
</div>
</div>
</div>
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<a id="appdetail_title" class="border-bottom border-gray pb-2 mb-0 font-nanum">App Detail</a>
<div id="appdetails" class="detail_app font-nanum pt-2 pb-5">
<h8 class="pt-3 pb-3 mb-0 font-italic">세부사항을 확인하려면 follow를 클릭하세요</h8>
</div>
<div id="pieChartdiv" class="pb-5">
<canvas id="pieChart" style="max-width: 500px;"></canvas>
</div>
<div id="barchart_title" style="display: none;">
<a class="pb-2 mb-0 font-nanum border-bottom border-gray">사용 시간대</a>
</div>
<div id="barChartdiv" class="pb-5">
<canvas id="barChart"></canvas>
</div>
<div id = "apptimelist" class="font-nanum">
</div>
</div>
</div>
</div>
</div>
<div id="Deleted-App" class="menu" style="display:none">
<div class="row">
<div class="col">
<div id="deletedapps" class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2 mb-0">Deleted Apps</h6>
<div class="overflow-auto">
<div id="deletedapplist" class="font-nanum">
</div>
</div>
</div>
</div>
</div>
</div>
<div id="Recent-Usage" class="menu" style="display:none">
<h6 class="border-bottom border-gray pb-2 mb-0">최근 10일 사용 분석</h6>
<div class="row">
<div class="col">
<div id="day10analysis" class="my-3 p-3 bg-white rounded shadow-sm">
<div id="pieCharttop10">
<a class="border-bottom border-gray pb-2 mb-0 font-nanum">사용 시간 비율</a>
<canvas id="pieChart10" width="350" height="350"></canvas>
</div>
</div>
</div>
<div class="col">
<div id="top10list" class="my-3 p-3 bg-white rounded shadow-sm">
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<a class="border-bottom border-gray pb-2 mb-0 font-nanum">일별 사용량</a>
<canvas id="recent_bar" width="400" height="400"></canvas>
</div>
</div>
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<a class="border-bottom border-gray pb-2 mb-0 font-nanum">사용 어플</a>
<div id="selectday"class="row sort justify-content-end">
</div>
<table id="day_use_list" class="font-nanum" style="font-size: 10;">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="menu_apps.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed. Click to expand it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<link rel="stylesheet" href="../assets/css/menu_apps.css">
<title>Document</title>
</head>
<body>
<div class="container">
<header class="menu-header py-4">
<div class="row d-flex justify-content-start flex-nowrap align-items-end">
<div class="col">
<a class="title-name text-dark">Media</a>
</div>
<div div class="col-9">
<a class="title-detail">미디어 파일 분석</a>
</div>
<div div class="col">
<a class="title-back" href="menu.html" id="menu-info">나가기</a>
</div>
</div>
</header>
<div class="nav-scroller nav-color py-1 mb-2">
<nav class="nav d-flex justify-content-around">
<a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Media-Strorage-Structure');">Media Strorage Structure</a>
<a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Video-Analysis');">Video Analysis</a>
</nav>
</div>
<div class="container">
<div id="Media-Strorage-Structure" class="menu">
<div class="row">
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2 mb-0">Media file 저장공간</h6>
<div id="barChartdiv">
<canvas id="pieChart"></canvas>
</div>
<div id="pie_datalist" class="w-75 pt-4">
</div>
</div>
</div>
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2 mb-0">파일 구조 분석</h6>
<div class="row justify-content-end">
<a id="photo" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('photo');" style="font-weight: bold;">Image</a>
<a id="video" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('video');">Video</a>
<a id="audio" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('audio');">Audio</a>
<a id="documentinfo" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('documentinfo');">Document</a>
</div>
<h8 id="struct_title" class="pt-3 pb-3 pl-1 mb-0 font-italic" style="font-size: 17px;">Image</h8>
<div id="mediafile_struct">
<div>
</div>
</div>
</div>
</div>
</div>
<div id="filelist_for_folder" class="row" style="display: none;">
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 id='infilelist' class="border-bottom border-gray pb-2 mb-0 "></h6>
<table id="filetable" class="table">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="Video-Analysis" class="menu" style="display: none;">
<div class="row">
<div class="col">
<div class="my-3 p-3 bg-white rounded shadow-sm">
<h6 class="border-bottom border-gray pb-2 mb-0">Video 선택</h6>
<div class="check_confirm d-flex justify-content-end p-1">
<button id="temp_post" type="button" class="btn btn-sm btn-primary font-nanum">analysis start</button>
</div>
<table id="videotable" class="table">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div id="Analysis-Detail" class="menu" style="display: none;">
<div id ="va_list" class="bg-white rounded shadow-sm">
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script src="menu_media.js"></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed. Click to expand it.
// Imports the Google Cloud Video Intelligence library + Node's fs library
const video = require('@google-cloud/video-intelligence').v1;
const fs = require('fs');
const util = require('util');
async function getinfo(){
console.log('before client');
// Creates a client
const client = new video.VideoIntelligenceServiceClient();
console.log('after client');
/**
* TODO(developer): Uncomment the following line before running the sample.
*/
const path = 'C:/Users/yunyoung/Desktop/temp/2016104137/source/forensic_tool/20190525_113617.mp4';
// Reads a local video file and converts it to base64
const readFile = util.promisify(fs.readFile);
const file = await readFile(path);
const inputContent = file.toString('base64');
// Constructs request
const request = {
inputContent: inputContent,
features: ['LABEL_DETECTION'],
};
// Detects labels in a video
const [operation] = await client.annotateVideo(request);
console.log('Waiting for operation to complete...');
const [operationResult] = await operation.promise();
// Gets annotations for video
const annotations = operationResult.annotationResults[0];
const labels = annotations.segmentLabelAnnotations;
labels.forEach(label => {
console.log(`Label ${label.entity.description} occurs at:`);
label.segments.forEach(segment => {
const time = segment.segment;
if (time.startTimeOffset.seconds === undefined) {
time.startTimeOffset.seconds = 0;
}
if (time.startTimeOffset.nanos === undefined) {
time.startTimeOffset.nanos = 0;
}
if (time.endTimeOffset.seconds === undefined) {
time.endTimeOffset.seconds = 0;
}
if (time.endTimeOffset.nanos === undefined) {
time.endTimeOffset.nanos = 0;
}
console.log(
`\tStart: ${time.startTimeOffset.seconds}` +
`.${(time.startTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\tEnd: ${time.endTimeOffset.seconds}.` +
`${(time.endTimeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(`\tConfidence: ${segment.confidence}`);
});
});
}
//getinfo();
//get_videosaftey();
async function get_videosaftey(){
// Imports the Google Cloud Video Intelligence library
const video = require('@google-cloud/video-intelligence').v1;
console.log('before client');
// Creates a client
const client = new video.VideoIntelligenceServiceClient();
console.log('after client');
/**
* TODO(developer): Uncomment the following line before running the sample.
*/
// const gcsUri = 'GCS URI of video to analyze, e.g. gs://my-bucket/my-video.mp4';
const path = 'C:/Users/yunyoung/Videos/20190525_113617.mp4';
// Reads a local video file and converts it to base64
const readFile = util.promisify(fs.readFile);
const file = await readFile(path);
const inputContent = file.toString('base64');
const request = {
inputContent: inputContent,
features: ['EXPLICIT_CONTENT_DETECTION'],
};
// Human-readable likelihoods
const likelihoods = [
'UNKNOWN',
'VERY_UNLIKELY',
'UNLIKELY',
'POSSIBLE',
'LIKELY',
'VERY_LIKELY',
];
// Detects unsafe content
const [opertaion] = await client.annotateVideo(request);
console.log('Waiting for operation to complete...');
const [operationResult] = await opertaion.promise();
// Gets unsafe content
const explicitContentResults =
operationResult.annotationResults[0].explicitAnnotation;
console.log('Explicit annotation results:');
explicitContentResults.frames.forEach(result => {
if (result.timeOffset === undefined) {
result.timeOffset = {};
}
if (result.timeOffset.seconds === undefined) {
result.timeOffset.seconds = 0;
}
if (result.timeOffset.nanos === undefined) {
result.timeOffset.nanos = 0;
}
console.log(
`\tTime: ${result.timeOffset.seconds}` +
`.${(result.timeOffset.nanos / 1e6).toFixed(0)}s`
);
console.log(
`\t\tPornography likelihood: ${likelihoods[result.pornographyLikelihood]}`
);
});
}
// var ss = `C:\\Users\\yunyoung\\Desktop\\temp\\2016104137\\source\\forensic_tool\\20190215_152731.mp4`
// var h = ss.split('\\');
// var c = '';
// for(var i = 0; i < h.length; i++){
// c += h[i] + '/';
// }
// console.log(c);
// const l = c.slice(0,-1);
// console.log(l);
// console.log(ss);
// var hell = ss.replace('/\\/g','/');
// console.log(hell);
const labels = [['landmark',[['0.0','17.17'],['0.0','17.17'],['0.0','17.17']]],['tourist destination',[['0.0','17.17'],['0.0','17.17'],['0.0','17.17']]],['tourism',[['0.0','17.17'],['0.0','17.17'],['0.0','17.17']]],['historic site',[['0.0','17.17'],['0.0','17.17'],['0.0','17.17']]],['building',[['0.0','17.17'],['0.0','17.17'],['0.0','17.17']]]];
console.log(labels);
var content = {video : '2020',labels : []}
labels.forEach(label => {
content['labels'].push(label[0]);
content[label[0]] = [];
label[1].forEach(segment => {
var temp = [segment[0],segment[1]];
content[label[0]].push(temp);
});
});
console.log(content);
var array = content['labels'];
array.forEach(label =>{
for(var i = 0; i < content[label].length; i++){
console.log(content[label][i]);
}
});
var likelihood_index = {'UNKNOWN': 0,'VERY_UNLIKELY': 1,'UNLIKELY': 2,'POSSIBLE': 3,'LIKELY': 4,'VERY_LIKELY': 5};
var det_dataset = [0,0,0,0,0,0]
det_dataset[likelihood_index[dt_dict['likelihood'][i][1]]] +=1;
var ctx = document.getElementById('det_piechart_'+lb_dict['video']);
var config = {
type: 'pie',
data: {
labels: ["UNKNOWN", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE","LIKELY",'VERY_LIKELY'],
datasets: [{
data: det_dataset,
backgroundColor: ["#F7464A", "#46BFBD", "#FDB45C", "#949FB1"],
hoverBackgroundColor: ["#FF5A5E", "#5AD3D1", "#FFC870", "#A8B3C5"]
}]
},
options: {
responsive: true
}
}
\ No newline at end of file