이윤영

Add two menu

...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
4 <component name="GradleSettings"> 4 <component name="GradleSettings">
5 <option name="linkedExternalProjectsSettings"> 5 <option name="linkedExternalProjectsSettings">
6 <GradleProjectSettings> 6 <GradleProjectSettings>
7 + <compositeConfiguration>
8 + <compositeBuild compositeDefinitionSource="SCRIPT" />
9 + </compositeConfiguration>
7 <option name="delegatedBuild" value="false" /> 10 <option name="delegatedBuild" value="false" />
8 - <option name="testRunner" value="PLATFORM" />
9 <option name="distributionType" value="DEFAULT_WRAPPED" /> 11 <option name="distributionType" value="DEFAULT_WRAPPED" />
10 <option name="externalProjectPath" value="$PROJECT_DIR$" /> 12 <option name="externalProjectPath" value="$PROJECT_DIR$" />
11 <option name="modules"> 13 <option name="modules">
...@@ -15,6 +17,7 @@ ...@@ -15,6 +17,7 @@
15 </set> 17 </set>
16 </option> 18 </option>
17 <option name="resolveModulePerSourceSet" value="false" /> 19 <option name="resolveModulePerSourceSet" value="false" />
20 + <option name="testRunner" value="PLATFORM" />
18 </GradleProjectSettings> 21 </GradleProjectSettings>
19 </option> 22 </option>
20 </component> 23 </component>
......
...@@ -36,6 +36,7 @@ public class DBHelper { ...@@ -36,6 +36,7 @@ public class DBHelper {
36 db.execSQL(Databases.CreateDB_AppUsage_WEEK._CREATE_AppUsage_WEEK); 36 db.execSQL(Databases.CreateDB_AppUsage_WEEK._CREATE_AppUsage_WEEK);
37 db.execSQL(Databases.CreateDB_AppUsage_DAY._CREATE_AppUsage_DAY); 37 db.execSQL(Databases.CreateDB_AppUsage_DAY._CREATE_AppUsage_DAY);
38 db.execSQL(Databases.CreateDB_PhoneInfo._CREATE_PhoneInfo); 38 db.execSQL(Databases.CreateDB_PhoneInfo._CREATE_PhoneInfo);
39 + db.execSQL(Databases.CreateDB_Document._CREATE_Document);
39 40
40 db.execSQL(CallLogDataBase.CreateDB._CREATE0); 41 db.execSQL(CallLogDataBase.CreateDB._CREATE0);
41 db.execSQL(ContactDataBase.CreateDB._CREATE0); 42 db.execSQL(ContactDataBase.CreateDB._CREATE0);
...@@ -57,6 +58,7 @@ public class DBHelper { ...@@ -57,6 +58,7 @@ public class DBHelper {
57 db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_AppUsage_WEEK.TABLE_NAME); 58 db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_AppUsage_WEEK.TABLE_NAME);
58 db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_AppUsage_DAY.TABLE_NAME); 59 db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_AppUsage_DAY.TABLE_NAME);
59 db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_PhoneInfo.TABLE_NAME); 60 db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_PhoneInfo.TABLE_NAME);
61 + db.execSQL("DROP TABLE IF EXISTS " + Databases.CreateDB_Document.TABLE_NAME);
60 62
61 db.execSQL("DROP TABLE IF EXISTS " + CallLogDataBase.CreateDB._TABLENAME0); 63 db.execSQL("DROP TABLE IF EXISTS " + CallLogDataBase.CreateDB._TABLENAME0);
62 db.execSQL("DROP TABLE IF EXISTS " + ContactDataBase.CreateDB._TABLENAME0); 64 db.execSQL("DROP TABLE IF EXISTS " + ContactDataBase.CreateDB._TABLENAME0);
...@@ -81,7 +83,7 @@ public class DBHelper { ...@@ -81,7 +83,7 @@ public class DBHelper {
81 } 83 }
82 84
83 public long insertPColumn(String title, int id, String date_added, String display_name 85 public long insertPColumn(String title, int id, String date_added, String display_name
84 - , String mime_type, String path, String latitude, String longitude){ 86 + , String mime_type, String path, String latitude, String longitude, String size){
85 ContentValues values = new ContentValues(); 87 ContentValues values = new ContentValues();
86 values.put(PhotoDataBase.CreateDB.TITLE, title); 88 values.put(PhotoDataBase.CreateDB.TITLE, title);
87 values.put(PhotoDataBase.CreateDB.ID, id); 89 values.put(PhotoDataBase.CreateDB.ID, id);
...@@ -91,12 +93,13 @@ public class DBHelper { ...@@ -91,12 +93,13 @@ public class DBHelper {
91 values.put(PhotoDataBase.CreateDB.PATH, path); 93 values.put(PhotoDataBase.CreateDB.PATH, path);
92 values.put(PhotoDataBase.CreateDB.LATITUDE, latitude); 94 values.put(PhotoDataBase.CreateDB.LATITUDE, latitude);
93 values.put(PhotoDataBase.CreateDB.LONGITUDE, longitude); 95 values.put(PhotoDataBase.CreateDB.LONGITUDE, longitude);
96 + values.put(PhotoDataBase.CreateDB.SIZE, size);
94 return mDB.insert(PhotoDataBase.CreateDB._TABLENAME0, null, values); 97 return mDB.insert(PhotoDataBase.CreateDB._TABLENAME0, null, values);
95 } 98 }
96 99
97 public long insertVColumn(String title, String date_added, String display_name, String mime_type 100 public long insertVColumn(String title, String date_added, String display_name, String mime_type
98 , String path, String latitude, String longitude, String album, String artist, String bookmark 101 , String path, String latitude, String longitude, String album, String artist, String bookmark
99 - ,String category, String description, String language, String resolution, String tags){ 102 + ,String category, String description, String language, String resolution, String tags, String size){
100 ContentValues values = new ContentValues(); 103 ContentValues values = new ContentValues();
101 values.put(VideoDataBase.CreateDB.TITLE, title); 104 values.put(VideoDataBase.CreateDB.TITLE, title);
102 values.put(VideoDataBase.CreateDB.DATE_ADDED, date_added); 105 values.put(VideoDataBase.CreateDB.DATE_ADDED, date_added);
...@@ -113,6 +116,7 @@ public class DBHelper { ...@@ -113,6 +116,7 @@ public class DBHelper {
113 values.put(VideoDataBase.CreateDB.LANGUAGE, language); 116 values.put(VideoDataBase.CreateDB.LANGUAGE, language);
114 values.put(VideoDataBase.CreateDB.RESOLUTION, resolution); 117 values.put(VideoDataBase.CreateDB.RESOLUTION, resolution);
115 values.put(VideoDataBase.CreateDB.TAGS, tags); 118 values.put(VideoDataBase.CreateDB.TAGS, tags);
119 + values.put(VideoDataBase.CreateDB.SIZE, size);
116 return mDB.insert(VideoDataBase.CreateDB._TABLENAME0, null, values); 120 return mDB.insert(VideoDataBase.CreateDB._TABLENAME0, null, values);
117 } 121 }
118 122
...@@ -167,9 +171,9 @@ public class DBHelper { ...@@ -167,9 +171,9 @@ public class DBHelper {
167 values.put(Databases.CreateDB_App.CELLULARUSAGE, cellularbytes); 171 values.put(Databases.CreateDB_App.CELLULARUSAGE, cellularbytes);
168 db.insert(Databases.CreateDB_App.TABLE_NAME, null, values); 172 db.insert(Databases.CreateDB_App.TABLE_NAME, null, values);
169 173
170 - Log.d("LogTest","addAppUsage"); 174 + //Log.d("LogTest","addAppUsage");
171 175
172 - Log.d("LogTest", String.valueOf(cellularbytes)); 176 + //Log.d("LogTest", String.valueOf(cellularbytes));
173 } 177 }
174 public void addAccountInfo(String accountname, String accounttype) { 178 public void addAccountInfo(String accountname, String accounttype) {
175 SQLiteDatabase db = mDBHelper.getWritableDatabase(); 179 SQLiteDatabase db = mDBHelper.getWritableDatabase();
...@@ -177,7 +181,21 @@ public class DBHelper { ...@@ -177,7 +181,21 @@ public class DBHelper {
177 values.put(Databases.CreateDB_AccountInfo.ACCOUNTNAME, accountname); 181 values.put(Databases.CreateDB_AccountInfo.ACCOUNTNAME, accountname);
178 values.put(Databases.CreateDB_AccountInfo.ACCOUNTTYPE, accounttype); 182 values.put(Databases.CreateDB_AccountInfo.ACCOUNTTYPE, accounttype);
179 db.insert(Databases.CreateDB_AccountInfo.TABLE_NAME, null, values); 183 db.insert(Databases.CreateDB_AccountInfo.TABLE_NAME, null, values);
180 - Log.d("LogTest","addAccountInfo"); 184 + //Log.d("LogTest","addAccountInfo");
185 + }
186 +
187 + public void addDocumentInfo(String name, String title, long date_added, long date_modified, String mime_type, String path, String size) {
188 + SQLiteDatabase db = mDBHelper.getWritableDatabase();
189 + ContentValues values = new ContentValues();
190 + values.put(Databases.CreateDB_Document.NAME, name);
191 + values.put(Databases.CreateDB_Document.TITLE, title);
192 + values.put(Databases.CreateDB_Document.DATE_ADDED, date_added);
193 + values.put(Databases.CreateDB_Document.DATE_MODIFIED, date_modified);
194 + values.put(Databases.CreateDB_Document.MIME_TYPE, mime_type);
195 + values.put(Databases.CreateDB_Document.PATH, path);
196 + values.put(Databases.CreateDB_Document.SIZE, size);
197 + db.insert(Databases.CreateDB_Document.TABLE_NAME, null, values);
198 + //Log.d("LogTest","addAccountInfo");
181 } 199 }
182 200
183 public void addAppUsage_YEAR(String packageName, long firsttimestamp, long lasttimestamp, 201 public void addAppUsage_YEAR(String packageName, long firsttimestamp, long lasttimestamp,
...@@ -190,7 +208,7 @@ public class DBHelper { ...@@ -190,7 +208,7 @@ public class DBHelper {
190 values.put(Databases.CreateDB_AppUsage_YEAR.LASTTIMEUSED, lasttimeused); 208 values.put(Databases.CreateDB_AppUsage_YEAR.LASTTIMEUSED, lasttimeused);
191 values.put(Databases.CreateDB_AppUsage_YEAR.TOTALTIMEFOREGROUND, totaltimeforeground); 209 values.put(Databases.CreateDB_AppUsage_YEAR.TOTALTIMEFOREGROUND, totaltimeforeground);
192 db.insert(Databases.CreateDB_AppUsage_YEAR.TABLE_NAME, null, values); 210 db.insert(Databases.CreateDB_AppUsage_YEAR.TABLE_NAME, null, values);
193 - Log.d("LogTest","addAppUsageYear"); 211 + //Log.d("LogTest","addAppUsageYear");
194 } 212 }
195 213
196 public void addAppUsage_MONTH(String packageName, long firsttimestamp, long lasttimestamp, 214 public void addAppUsage_MONTH(String packageName, long firsttimestamp, long lasttimestamp,
...@@ -203,7 +221,7 @@ public class DBHelper { ...@@ -203,7 +221,7 @@ public class DBHelper {
203 values.put(Databases.CreateDB_AppUsage_MONTH.LASTTIMEUSED, lasttimeused); 221 values.put(Databases.CreateDB_AppUsage_MONTH.LASTTIMEUSED, lasttimeused);
204 values.put(Databases.CreateDB_AppUsage_MONTH.TOTALTIMEFOREGROUND, totaltimeforeground); 222 values.put(Databases.CreateDB_AppUsage_MONTH.TOTALTIMEFOREGROUND, totaltimeforeground);
205 db.insert(Databases.CreateDB_AppUsage_MONTH.TABLE_NAME, null, values); 223 db.insert(Databases.CreateDB_AppUsage_MONTH.TABLE_NAME, null, values);
206 - Log.d("LogTest","addAppUsageMonth"); 224 + //Log.d("LogTest","addAppUsageMonth");
207 } 225 }
208 226
209 public void addAppUsage_WEEK(String packageName, long firsttimestamp, long lasttimestamp, 227 public void addAppUsage_WEEK(String packageName, long firsttimestamp, long lasttimestamp,
...@@ -216,7 +234,7 @@ public class DBHelper { ...@@ -216,7 +234,7 @@ public class DBHelper {
216 values.put(Databases.CreateDB_AppUsage_WEEK.LASTTIMEUSED, lasttimeused); 234 values.put(Databases.CreateDB_AppUsage_WEEK.LASTTIMEUSED, lasttimeused);
217 values.put(Databases.CreateDB_AppUsage_WEEK.TOTALTIMEFOREGROUND, totaltimeforeground); 235 values.put(Databases.CreateDB_AppUsage_WEEK.TOTALTIMEFOREGROUND, totaltimeforeground);
218 db.insert(Databases.CreateDB_AppUsage_WEEK.TABLE_NAME, null, values); 236 db.insert(Databases.CreateDB_AppUsage_WEEK.TABLE_NAME, null, values);
219 - Log.d("LogTest","addAppUsageWeek"); 237 + //Log.d("LogTest","addAppUsageWeek");
220 } 238 }
221 239
222 public void addAppUsage_DAY(String packageName, long firsttimestamp, long lasttimestamp, 240 public void addAppUsage_DAY(String packageName, long firsttimestamp, long lasttimestamp,
......
...@@ -8,6 +8,24 @@ import java.lang.reflect.Field; ...@@ -8,6 +8,24 @@ import java.lang.reflect.Field;
8 public final class Databases { 8 public final class Databases {
9 9
10 private Databases() {} 10 private Databases() {}
11 + public static final class CreateDB_Document implements BaseColumns {
12 + public static final String TABLE_NAME = "DocumentInfo";
13 + public static final String NAME = "name";
14 + public static final String TITLE = "title";
15 + public static final String DATE_ADDED = "date_added";
16 + public static final String DATE_MODIFIED = "date_modified";
17 + public static final String MIME_TYPE = "mime_type";
18 + public static final String PATH = "path";
19 + public static final String SIZE = "size";
20 + public static final String _CREATE_Document = "create table if not exists "+TABLE_NAME+"("
21 + +NAME+" text not null primary key, "
22 + +TITLE+" text not null , "
23 + +MIME_TYPE+" text not null , "
24 + +DATE_ADDED+" timestamp not null , "
25 + +DATE_MODIFIED+" timestamp not null , "
26 + +PATH+" text not null , "
27 + +SIZE+" text not null);";
28 + }
11 29
12 public static final class CreateDB_App implements BaseColumns { 30 public static final class CreateDB_App implements BaseColumns {
13 public static final String TABLE_NAME = "AppInfo"; 31 public static final String TABLE_NAME = "AppInfo";
......
...@@ -25,6 +25,7 @@ import android.net.Uri; ...@@ -25,6 +25,7 @@ import android.net.Uri;
25 import android.net.wifi.WifiConfiguration; 25 import android.net.wifi.WifiConfiguration;
26 import android.net.wifi.WifiManager; 26 import android.net.wifi.WifiManager;
27 import android.os.Bundle; 27 import android.os.Bundle;
28 +import android.os.Environment;
28 import android.os.Handler; 29 import android.os.Handler;
29 import android.provider.CalendarContract; 30 import android.provider.CalendarContract;
30 import android.provider.CallLog; 31 import android.provider.CallLog;
...@@ -34,10 +35,13 @@ import android.provider.Telephony; ...@@ -34,10 +35,13 @@ import android.provider.Telephony;
34 import android.telephony.TelephonyManager; 35 import android.telephony.TelephonyManager;
35 import android.util.Log; 36 import android.util.Log;
36 import android.widget.Toast; 37 import android.widget.Toast;
38 +
39 +import java.io.File;
37 import java.net.InetAddress; 40 import java.net.InetAddress;
38 import java.text.DateFormat; 41 import java.text.DateFormat;
39 import java.text.SimpleDateFormat; 42 import java.text.SimpleDateFormat;
40 import java.util.ArrayList; 43 import java.util.ArrayList;
44 +import java.util.Calendar;
41 import java.util.Date; 45 import java.util.Date;
42 import java.util.List; 46 import java.util.List;
43 import androidx.core.content.ContextCompat; 47 import androidx.core.content.ContextCompat;
...@@ -64,11 +68,13 @@ public class LoadingActivity extends Activity { ...@@ -64,11 +68,13 @@ public class LoadingActivity extends Activity {
64 setContentView(R.layout.activity_loading); 68 setContentView(R.layout.activity_loading);
65 69
66 try { 70 try {
67 - socket = IO.socket("http://172.30.1.40:3000/"); 71 + socket = IO.socket("http://192.168.0.8:3000/");
68 socket.connect(); 72 socket.connect();
73 + Log.i("SOCKET", "Connected");
69 74
70 }catch(Exception e){ 75 }catch(Exception e){
71 e.printStackTrace(); 76 e.printStackTrace();
77 + Log.i("SOCKET", "Not Connected");
72 } 78 }
73 79
74 startLoading(); 80 startLoading();
...@@ -84,54 +90,108 @@ public class LoadingActivity extends Activity { ...@@ -84,54 +90,108 @@ public class LoadingActivity extends Activity {
84 90
85 getPhoto(); 91 getPhoto();
86 alert("alert","photo"); 92 alert("alert","photo");
87 - Log.i("MYLOG", "DB HY Part:1/13"); 93 + Log.i("MYLOG", "DB HY Part:1/14");
88 getVideo(); 94 getVideo();
89 alert("alert","video"); 95 alert("alert","video");
90 - Log.i("MYLOG", "DB HY Part:2/13"); 96 + Log.i("MYLOG", "DB HY Part:2/14");
91 getAudio(); 97 getAudio();
92 alert("alert","audio"); 98 alert("alert","audio");
93 - Log.i("MYLOG", "DB HY Part:3/13"); 99 + Log.i("MYLOG", "DB HY Part:3/14");
94 getCalendarInfo(); 100 getCalendarInfo();
95 alert("alert","calendar"); 101 alert("alert","calendar");
96 - Log.i("MYLOG", "DB HY Part:4/13"); 102 + Log.i("MYLOG", "DB HY Part:4/14");
97 getNetworkInfo(); 103 getNetworkInfo();
98 alert("alert","network"); 104 alert("alert","network");
99 - Log.i("MYLOG", "DB HY Part:5/13"); 105 + Log.i("MYLOG", "DB HY Part:5/14");
100 106
101 getCallLog(); 107 getCallLog();
102 alert("alert","calllog"); 108 alert("alert","calllog");
103 - Log.i("MYLOG", "DB YM Part:6/13"); 109 + Log.i("MYLOG", "DB YM Part:6/14");
104 getContact(); 110 getContact();
105 alert("alert","contact"); 111 alert("alert","contact");
106 - Log.i("MYLOG", "DB YM Part:7/13"); 112 + Log.i("MYLOG", "DB YM Part:7/14");
107 getSMSMessage(); 113 getSMSMessage();
108 alert("alert","sms"); 114 alert("alert","sms");
109 - Log.i("MYLOG", "DB YM Part:8/13"); 115 + Log.i("MYLOG", "DB YM Part:8/14");
110 getWIFI(); 116 getWIFI();
111 alert("alert","wifi"); 117 alert("alert","wifi");
112 - Log.i("MYLOG", "DB YM Part:9/13"); 118 + Log.i("MYLOG", "DB YM Part:9/14");
113 119
114 getPhoneInfo(); 120 getPhoneInfo();
115 alert("alert","phoneinfo"); 121 alert("alert","phoneinfo");
116 - Log.i("MYLOG", "DB YY Part:10/13"); 122 + Log.i("MYLOG", "DB YY Part:10/14");
117 getAccountInfo(); 123 getAccountInfo();
118 alert("alert","accountinfo"); 124 alert("alert","accountinfo");
119 - Log.i("MYLOG", "DB YY Part:11/13"); 125 + Log.i("MYLOG", "DB YY Part:11/14");
120 getAppInfo(); 126 getAppInfo();
121 alert("alert","appinfo"); 127 alert("alert","appinfo");
122 - Log.i("MYLOG", "DB YY Part:12/13"); 128 + Log.i("MYLOG", "DB YY Part:12/14");
123 getUsageStats(); 129 getUsageStats();
124 alert("alert","usagestats"); 130 alert("alert","usagestats");
125 - Log.i("MYLOG", "DB YY Part:13/13"); 131 + Log.i("MYLOG", "DB YY Part:13/14");
126 - 132 + getDocument();
133 + Log.i("MYLOG", "DB YY Part:14/14");
127 dbHelper.close(); 134 dbHelper.close();
135 +
128 finish(); 136 finish();
129 137
130 alert("end", "end"); 138 alert("end", "end");
139 +
131 } 140 }
132 }, 2000); 141 }, 2000);
133 } 142 }
134 143
144 + public void getDocument() {
145 +
146 + String[] projection = {
147 + MediaStore.Files.FileColumns._ID,
148 + MediaStore.Files.FileColumns.MIME_TYPE,
149 + MediaStore.Files.FileColumns.DATE_ADDED,
150 + MediaStore.Files.FileColumns.DATE_MODIFIED,
151 + MediaStore.Files.FileColumns.DISPLAY_NAME,
152 + MediaStore.Files.FileColumns.TITLE,
153 + MediaStore.Files.FileColumns.SIZE,
154 + MediaStore.Files.FileColumns.DATA
155 + };
156 +
157 + String mimeType = "application/pdf";
158 +
159 + String whereClause = MediaStore.Files.FileColumns.MIME_TYPE + " IN ('" + mimeType + "')"
160 + + " OR " + MediaStore.Files.FileColumns.MIME_TYPE + " LIKE 'application/vnd%'";
161 + String orderBy = MediaStore.Files.FileColumns.SIZE + " DESC";
162 + Cursor cursor = getContentResolver().query(MediaStore.Files.getContentUri("external"),
163 + projection,
164 + whereClause,
165 + null,
166 + orderBy);
167 +
168 + int idCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns._ID);
169 + int mimeCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.MIME_TYPE);
170 + int addedCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATE_ADDED);
171 + int modifiedCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATE_MODIFIED);
172 + int nameCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DISPLAY_NAME);
173 + int titleCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.TITLE);
174 + int sizeCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE);
175 + int dataCol = cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA);
176 +
177 + if (cursor.moveToFirst()) {
178 + do {
179 + //Uri fileUri = Uri.withAppendedPath(MediaStore.Files.getContentUri("external"), cursor.getString(idCol));
180 + String mime = cursor.getString(mimeCol);
181 + long dateAdded = cursor.getLong(addedCol);
182 + long dateModified = cursor.getLong(modifiedCol);
183 + String name = cursor.getString(nameCol);
184 + String title = cursor.getString(titleCol);
185 + long size = cursor.getLong(sizeCol);
186 + String path = cursor.getString(dataCol);
187 +
188 + Log.i("documents", mime + ", " + dateAdded + ", " + dateModified + ", " + name + ", " + title + ", " + size + ", " + path);
189 + dbHelper.addDocumentInfo(cursor.getString(nameCol), cursor.getString(titleCol), cursor.getLong(addedCol)
190 + , cursor.getLong(modifiedCol), cursor.getString(mimeCol), cursor.getString(dataCol),String.valueOf(cursor.getLong(sizeCol)));
191 + } while (cursor.moveToNext());
192 + }
193 + }
194 +
135 public void getPhoto() { 195 public void getPhoto() {
136 Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; 196 Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
137 197
...@@ -159,9 +219,13 @@ public class LoadingActivity extends Activity { ...@@ -159,9 +219,13 @@ public class LoadingActivity extends Activity {
159 photo.setLatitude(cursor.getString(6)); 219 photo.setLatitude(cursor.getString(6));
160 photo.setLongitude(cursor.getString(7)); 220 photo.setLongitude(cursor.getString(7));
161 221
222 +
223 + File f = new File(cursor.getString(5));
224 + long size = f.length();
225 +
162 dbHelper.insertPColumn(photo.getTitle(), photo.getId(), photo.getDate() 226 dbHelper.insertPColumn(photo.getTitle(), photo.getId(), photo.getDate()
163 , photo.getDisplayName(), photo.getType(), photo.getPath() 227 , photo.getDisplayName(), photo.getType(), photo.getPath()
164 - , photo.getLatitude(), photo.getLongitude()); 228 + , photo.getLatitude(), photo.getLongitude(),String.valueOf(size));
165 } 229 }
166 230
167 } 231 }
...@@ -208,10 +272,13 @@ public class LoadingActivity extends Activity { ...@@ -208,10 +272,13 @@ public class LoadingActivity extends Activity {
208 video.setMIME_type(cursor.getString(13)); 272 video.setMIME_type(cursor.getString(13));
209 video.setTitle(cursor.getString(14)); 273 video.setTitle(cursor.getString(14));
210 274
275 + File f = new File(cursor.getString(9));
276 + long size = f.length();
277 +
211 dbHelper.insertVColumn(video.getTitle(), video.getDate_added(), video.getDisplay_Name() 278 dbHelper.insertVColumn(video.getTitle(), video.getDate_added(), video.getDisplay_Name()
212 , video.getMIME_type(), video.getPath(), video.getLatitude(), video.getLongitude() 279 , video.getMIME_type(), video.getPath(), video.getLatitude(), video.getLongitude()
213 , video.getAlbum(), video.getArtist(), video.getBookmark(), video.getCategory() 280 , video.getAlbum(), video.getArtist(), video.getBookmark(), video.getCategory()
214 - , video.getDescription(), video.getLanguage(), video.getResolution(), video.getTags()); 281 + , video.getDescription(), video.getLanguage(), video.getResolution(), video.getTags(), String.valueOf(size));
215 } 282 }
216 } 283 }
217 284
...@@ -547,8 +614,8 @@ public class LoadingActivity extends Activity { ...@@ -547,8 +614,8 @@ public class LoadingActivity extends Activity {
547 for (UsageStats usagestat : queryUsageStats) { 614 for (UsageStats usagestat : queryUsageStats) {
548 dbHelper.addAppUsage_WEEK(usagestat.getPackageName(),usagestat.getFirstTimeStamp(), usagestat.getLastTimeStamp(),usagestat.getLastTimeUsed(), usagestat.getTotalTimeInForeground()); 615 dbHelper.addAppUsage_WEEK(usagestat.getPackageName(),usagestat.getFirstTimeStamp(), usagestat.getLastTimeStamp(),usagestat.getLastTimeUsed(), usagestat.getTotalTimeInForeground());
549 } 616 }
550 - 617 + queryUsageStats = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, 0,
551 - queryUsageStats = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY, 0, System.currentTimeMillis()); 618 + System.currentTimeMillis());
552 for (UsageStats usagestat : queryUsageStats) { 619 for (UsageStats usagestat : queryUsageStats) {
553 dbHelper.addAppUsage_DAY(usagestat.getPackageName(),usagestat.getFirstTimeStamp(), usagestat.getLastTimeStamp(),usagestat.getLastTimeUsed(), usagestat.getTotalTimeInForeground()); 620 dbHelper.addAppUsage_DAY(usagestat.getPackageName(),usagestat.getFirstTimeStamp(), usagestat.getLastTimeStamp(),usagestat.getLastTimeUsed(), usagestat.getTotalTimeInForeground());
554 } 621 }
......
...@@ -12,6 +12,7 @@ public final class PhotoDataBase { ...@@ -12,6 +12,7 @@ public final class PhotoDataBase {
12 public static final String PATH = "path"; 12 public static final String PATH = "path";
13 public static final String LATITUDE = "latitude"; 13 public static final String LATITUDE = "latitude";
14 public static final String LONGITUDE = "longitude"; 14 public static final String LONGITUDE = "longitude";
15 + public static final String SIZE = "size";
15 public static final String _TABLENAME0 = "photo"; 16 public static final String _TABLENAME0 = "photo";
16 public static final String _CREATE0 = "create table if not exists "+_TABLENAME0+"(" 17 public static final String _CREATE0 = "create table if not exists "+_TABLENAME0+"("
17 +TITLE+" text not null primary key, " 18 +TITLE+" text not null primary key, "
...@@ -21,6 +22,7 @@ public final class PhotoDataBase { ...@@ -21,6 +22,7 @@ public final class PhotoDataBase {
21 +MIME_TYPE + " text not null," 22 +MIME_TYPE + " text not null,"
22 +PATH + " text not null," 23 +PATH + " text not null,"
23 +LATITUDE + " text," 24 +LATITUDE + " text,"
24 - +LONGITUDE + " text);"; 25 + +LONGITUDE + " text,"
26 + +SIZE + " text);";
25 } 27 }
26 } 28 }
......
...@@ -19,6 +19,7 @@ public final class VideoDataBase { ...@@ -19,6 +19,7 @@ public final class VideoDataBase {
19 public static final String DISPLAY_NAME = "display_name"; 19 public static final String DISPLAY_NAME = "display_name";
20 public static final String MIME_TYPE = "mime_type"; 20 public static final String MIME_TYPE = "mime_type";
21 public static final String TITLE = "title"; 21 public static final String TITLE = "title";
22 + public static final String SIZE = "size";
22 public static final String _TABLENAME0 = "video"; 23 public static final String _TABLENAME0 = "video";
23 public static final String _CREATE0 = "create table if not exists "+_TABLENAME0+"(" 24 public static final String _CREATE0 = "create table if not exists "+_TABLENAME0+"("
24 +TITLE+" text not null primary key, " 25 +TITLE+" text not null primary key, "
...@@ -35,6 +36,7 @@ public final class VideoDataBase { ...@@ -35,6 +36,7 @@ public final class VideoDataBase {
35 +DESCRIPTION + " text, " 36 +DESCRIPTION + " text, "
36 +LANGUAGE +" text, " 37 +LANGUAGE +" text, "
37 +RESOLUTION + " text, " 38 +RESOLUTION + " text, "
38 - +TAGS + " text);"; 39 + +TAGS + " text, "
40 + +SIZE+" text);";
39 } 41 }
40 } 42 }
......
1 +1
2 +com.example.dataextraction
3 +1
4 +29
5 +
6 +0
7 +1
8 +308201dd30820146020101300d06092a864886f70d010105050030373116301406035504030c0d416e64726f69642044656275673110300e060355040a0c07416e64726f6964310b3009060355040613025553301e170d3138303930363130323134335a170d3438303832393130323134335a30373116301406035504030c0d416e64726f69642044656275673110300e060355040a0c07416e64726f6964310b300906035504061302555330819f300d06092a864886f70d010101050003818d0030818902818100a6596a004a40dadfa9657fa99b49f80ae526fce07b27a97f61c2e43a53992b293743cf04277293e52c4ae6991f4d83cf43a8f94420da00836361a34cab6c82b99a8b4f54e4c29f425e05319884f1ef7fdedfd94fc315ff677b9c0e0c1bf438f200bd3ff70f610a0b5c735e4988850501e6386a54f306155e9c871c25b59de63d0203010001300d06092a864886f70d0101050500038181009967d07dc0402f932c6c7d6125165068feb0eb5d494ed3c74cba0bd09ad9c2a2f8faf12cf0341849dd622de0d23562f284fecca507e39f1f5983d6383b8cd2b0a1b9d007fcd0adf3fa51542639392e58b6438482ba0b543372cfc4363706bfbf7cc80120e28ad374893d9cd3b7a43a5fee221f7337d489c24b33f901f5e4477f
1 +.menu-header{
2 + line-height: 1;
3 +}
4 +.title-name {
5 + font-family: 'Born Ready Slanted';
6 + font-size: 40px;
7 +}
8 +.title-detail {
9 + font-family: '나눔바른고딕';
10 + font-size: 18px;
11 +}
12 +.title-back {
13 + font-family: '나눔바른고딕';
14 + font-size: 15px;
15 +}
16 +.nav-color{
17 + background-color: #4e73df;
18 +}
19 +.font-nanum{
20 + font-family: '나눔바른고딕';
21 +}
22 +#table {
23 + font-family: "나눔바른고딕";
24 + border-collapse: collapse;
25 + width: 100%;
26 + font-size: 10px;
27 +}
28 +
29 +#table td, #table th {
30 + border: 1px solid #ddd;
31 + padding: 8px;
32 +}
33 +
34 +#table tr:nth-child(even){background-color: #f2f2f2;}
35 +
36 +#table tr:hover {background-color: #ddd;}
37 +
38 +#table th {
39 + padding-top: 12px;
40 + padding-bottom: 12px;
41 + text-align: left;
42 + background-color: #9db5fc;
43 + color: black;
44 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 #div_con2{ 17 #div_con2{
18 background-color:beige; 18 background-color:beige;
19 width:29%; 19 width:29%;
20 - height:600px; 20 + height:825px;
21 float:left; 21 float:left;
22 text-align : left; 22 text-align : left;
23 } 23 }
...@@ -93,3 +93,17 @@ h4{ ...@@ -93,3 +93,17 @@ h4{
93 color:white; 93 color:white;
94 background-color: skyblue; 94 background-color: skyblue;
95 } 95 }
96 +#btn_another button{
97 + border: 1px hidden black;
98 + background-color: skyblue;
99 + color: white;
100 + padding: 50px;
101 + display: table;
102 + margin-left: auto;
103 + margin-right: auto;
104 + margin-top: 10%;
105 +}
106 +#btn_another button:hover{
107 + color:black;
108 + background-color: rgba(0,0,0,0);
109 +}
...\ No newline at end of file ...\ No newline at end of file
......
1 +.menu-header{
2 + line-height: 1;
3 +}
4 +.title-name {
5 + font-family: 'Born Ready Slanted';
6 + font-size: 40px;
7 +}
8 +.title-detail {
9 + font-family: '나눔바른고딕';
10 + font-size: 18px;
11 +}
12 +.title-back {
13 + font-family: '나눔바른고딕';
14 + font-size: 15px;
15 +}
16 +.nav-color{
17 + background-color: #4e73df;
18 +}
19 +.font-nanum{
20 + font-family: '나눔바른고딕';
21 +}
22 +.sort{
23 + font-family: '나눔바른고딕';
24 + font-size: 10px;
25 +}
26 +
27 +.filetype{
28 + font-family: '나눔바른고딕';
29 + font-size: 13px;
30 +}
31 +.media:hover {background-color: #ddd;}
32 +
33 +.table {
34 + font-family: "나눔바른고딕", Arial, Helvetica, sans-serif;
35 + border-collapse: collapse;
36 + width: 100%;
37 + }
38 +
39 + .table td, #table th {
40 + border: 1px solid #ddd;
41 + padding: 8px;
42 + }
43 +
44 + .table tr:nth-child(even){background-color: #f2f2f2;}
45 +
46 + .table tr:hover {background-color: #ddd;}
47 +
48 + .table th {
49 + padding-top: 12px;
50 + padding-bottom: 12px;
51 + text-align: left;
52 + background-color: #5782ff;
53 + color: white;
54 + }
...\ No newline at end of file ...\ No newline at end of file
...@@ -2,6 +2,12 @@ const { app, BrowserWindow, ipcMain, dialog } = require('electron') ...@@ -2,6 +2,12 @@ const { app, BrowserWindow, ipcMain, dialog } = require('electron')
2 const path = require('path') 2 const path = require('path')
3 const url = require('url') 3 const url = require('url')
4 const vision = require('@google-cloud/vision'); 4 const vision = require('@google-cloud/vision');
5 +var exec = require('child_process').exec, child;
6 +
7 +// Imports the Google Cloud Video Intelligence library + Node's fs library
8 +const video = require('@google-cloud/video-intelligence').v1;
9 +const fs = require('fs');
10 +const util = require('util');
5 11
6 // Keep a global reference of the window object, if you don't, the window will 12 // Keep a global reference of the window object, if you don't, the window will
7 // be closed automatically when the JavaScript object is garbage collected. 13 // be closed automatically when the JavaScript object is garbage collected.
...@@ -119,8 +125,212 @@ ipcMain.on("device-name", (e, arg) => { ...@@ -119,8 +125,212 @@ ipcMain.on("device-name", (e, arg) => {
119 var content = {path : path, name : name, labels : labels} 125 var content = {path : path, name : name, labels : labels}
120 label_result.push(content); 126 label_result.push(content);
121 } 127 }
128 +var video_label_result = new Array();
129 +var video_detect_result = new Array();
130 +
131 +ipcMain.on("video-analysis", async (e, arg) => {
132 + console.log(arg + "from menu_media");
133 + video_label_result = [];
134 + video_detect_result = [];
135 +
136 + await Promise.all(arg.map(async (value)=>{
137 + // await copy_file(value);
138 + // setTimeout(function() { }, 10000);
139 + await get_content_detection(value);
140 + // await get_videolabels(value);
141 + }))
142 + await Promise.all(arg.map(async (value)=>{
143 + // await copy_file(value);
144 + // setTimeout(function() { }, 10000);
145 + //await get_content_detection(value);
146 + await get_videolabels(value);
147 + }))
148 + var video_analysis_result = [video_label_result,video_detect_result];
149 + console.log(video_analysis_result);
150 + win.webContents.send("getvideodetail", video_analysis_result);
151 +
152 + //win.webContents.send("getvideodetail", [temp_label,temp_detect]);
153 +
154 +
155 +});
156 +
157 +function checkandcopy(arg){
158 + return new Promise(function(resolve, reject){
159 + setTimeout(function(){
160 + for(var i=0; i < arg.length; i++){
161 + cmd_pull = exec('adb pull '+arg[i]);
162 + }
163 + resolve(true);
164 + }, 1000)
165 + })
166 +}
167 +
168 +async function copy_file(path){
169 + return new Promise(function(resolve, reject){
170 + setTimeout(function(){
171 + cmd_pull = exec('adb pull '+path,function(error, stdout, stderr){
172 + if(error){
173 + console.log(error);
174 + }
175 + });
176 + resolve(true);
177 + }, 1000)
178 + })
179 +}
180 +
122 181
123 182
183 +function send_labels_to_menu_media(event){
184 + win.webContents.send("getvideodetail", 'response message');
185 +}
186 +
187 +async function get_videolabels(path){
188 + var video_name = path.split('/');
189 + video_name = video_name[video_name.length-1];
190 +
191 + // Creates a client
192 + const client = new video.VideoIntelligenceServiceClient();
193 +
194 + var video_path = __dirname+'\\' + video_name;
195 + var temp = video_path.split('\\');
196 + var beforeslice = '';
197 + for(var i = 0; i < temp.length; i++){
198 + beforeslice += temp[i] + '/';
199 + }
200 +
201 + const vpath = beforeslice.slice(0,-1);
202 + console.log(vpath);
203 + // Reads a local video file and converts it to base64
204 + const readFile = util.promisify(fs.readFile);
205 + const file = await readFile(vpath);
206 + const inputContent = file.toString('base64');
207 + console.log("video convert");
208 +
209 + // Constructs request
210 + const request = {
211 + inputContent: inputContent,
212 + features: ['LABEL_DETECTION'],
213 + };
214 +
215 + // Detects labels in a video
216 + const [operation] = await client.annotateVideo(request);
217 + console.log('Waiting for operation to complete...');
218 + const [operationResult] = await operation.promise();
219 + // Gets annotations for video
220 + const annotations = operationResult.annotationResults[0];
221 +
222 +
223 + const labels = annotations.segmentLabelAnnotations;
224 + console.log(labels);
225 + var content = {video : video_name,labels : []}
226 + labels.forEach(label => {
227 + console.log(`Label ${label.entity.description} occurs at:`);
228 + content['labels'].push(label.entity.description);
229 + content[label.entity.description] = [];
230 + label.segments.forEach(segment => {
231 + const time = segment.segment;
232 + if (time.startTimeOffset.seconds === undefined) {
233 + time.startTimeOffset.seconds = 0;
234 + }
235 + if (time.startTimeOffset.nanos === undefined) {
236 + time.startTimeOffset.nanos = 0;
237 + }
238 + if (time.endTimeOffset.seconds === undefined) {
239 + time.endTimeOffset.seconds = 0;
240 + }
241 + if (time.endTimeOffset.nanos === undefined) {
242 + time.endTimeOffset.nanos = 0;
243 + }
244 + console.log(
245 + `\tStart: ${time.startTimeOffset.seconds}` +
246 + `.${(time.startTimeOffset.nanos / 1e6).toFixed(0)}s`
247 + );
248 + console.log(
249 + `\tEnd: ${time.endTimeOffset.seconds}.` +
250 + `${(time.endTimeOffset.nanos / 1e6).toFixed(0)}s`
251 + );
252 + console.log(`\tConfidence: ${segment.confidence}`);
253 + var temp = [time.startTimeOffset.seconds + '.' + (time.startTimeOffset.nanos / 1e6).toFixed(0),
254 + time.endTimeOffset.seconds + '.' + (time.endTimeOffset.nanos / 1e6).toFixed(0),
255 + segment.confidence];
256 + content[label.entity.description].push(temp);
257 + });
258 + });
259 + console.log(content);
260 + video_label_result.push(content);
261 +}
262 +
263 +async function get_content_detection(path){
264 + var video_name = path.split('/');
265 + video_name = video_name[video_name.length-1];
266 +
267 + // Creates a client
268 + const client = new video.VideoIntelligenceServiceClient();
269 +
270 + var video_path = __dirname+'\\' + video_name;
271 + var temp = video_path.split('\\');
272 + var beforeslice = '';
273 + for(var i = 0; i < temp.length; i++){
274 + beforeslice += temp[i] + '/';
275 + }
276 +
277 + const vpath = beforeslice.slice(0,-1);
278 + console.log(vpath);
279 + // Reads a local video file and converts it to base64
280 + const readFile = util.promisify(fs.readFile);
281 + const file = await readFile(vpath);
282 + const inputContent = file.toString('base64');
283 + console.log("video convert");
284 +
285 + const request = {
286 + inputContent: inputContent,
287 + features: ['EXPLICIT_CONTENT_DETECTION'],
288 + };
289 +
290 + // Human-readable likelihoods
291 + const likelihoods = [
292 + 'UNKNOWN',
293 + 'VERY_UNLIKELY',
294 + 'UNLIKELY',
295 + 'POSSIBLE',
296 + 'LIKELY',
297 + 'VERY_LIKELY',
298 + ];
299 +
300 + // Detects unsafe content
301 + const [opertaion] = await client.annotateVideo(request);
302 + console.log('Waiting for operation to complete...');
303 + const [operationResult] = await opertaion.promise();
304 + // Gets unsafe content
305 + const explicitContentResults =
306 + operationResult.annotationResults[0].explicitAnnotation;
307 + console.log('Explicit annotation results:');
308 + var content = {video : video_name, likelihood : []}
309 + explicitContentResults.frames.forEach(result => {
310 + if (result.timeOffset === undefined) {
311 + result.timeOffset = {};
312 + }
313 + if (result.timeOffset.seconds === undefined) {
314 + result.timeOffset.seconds = 0;
315 + }
316 + if (result.timeOffset.nanos === undefined) {
317 + result.timeOffset.nanos = 0;
318 + }
319 + console.log(
320 + `\tTime: ${result.timeOffset.seconds}` +
321 + `.${(result.timeOffset.nanos / 1e6).toFixed(0)}s`
322 + );
323 + console.log(
324 + `\t\tPornography likelihood: ${likelihoods[result.pornographyLikelihood]}`
325 + );
326 + var temp = [result.timeOffset.seconds + '.' + (result.timeOffset.nanos / 1e6).toFixed(0),
327 + likelihoods[result.pornographyLikelihood]];
328 + content['likelihood'].push(temp);
329 + });
330 + console.log(content);
331 + video_detect_result.push(content);
332 +}
333 +
124 //detext unsafe image 334 //detext unsafe image
125 let detect_result = new Array(); 335 let detect_result = new Array();
126 336
......
This diff is collapsed. Click to expand it.
...@@ -4,24 +4,28 @@ ...@@ -4,24 +4,28 @@
4 "description": "", 4 "description": "",
5 "main": "main.js", 5 "main": "main.js",
6 "scripts": { 6 "scripts": {
7 - "start": "electron ." 7 + "start": "electron .",
8 + "rebuild": "electron-rebuild -f -w sqlite3"
8 }, 9 },
9 "author": "Hee <glwjd0414@khu.ac.kr>", 10 "author": "Hee <glwjd0414@khu.ac.kr>",
10 "license": "ISC", 11 "license": "ISC",
11 "devDependencies": { 12 "devDependencies": {
12 - "electron": "^8.2.0" 13 + "electron": "^8.2.0",
14 + "electron-rebuild": "^1.11.0"
13 }, 15 },
14 "dependencies": { 16 "dependencies": {
15 "@google-cloud/vision": "^2.0.0", 17 "@google-cloud/vision": "^2.0.0",
16 - "appium-adb": "^7.27.1",
17 "bootstrap-icons": "^1.0.0-alpha4", 18 "bootstrap-icons": "^1.0.0-alpha4",
18 "chart.js": "^2.9.3", 19 "chart.js": "^2.9.3",
20 + "@google-cloud/video-intelligence": "^3.0.0",
21 + "appium-adb": "^7.27.1",
22 + "electron-log": "^4.2.0",
19 "jQuery": "^1.7.4", 23 "jQuery": "^1.7.4",
20 - "jquery": "^3.5.0",
21 "mysql": "^2.18.1", 24 "mysql": "^2.18.1",
22 "node-adb": "^0.1.6", 25 "node-adb": "^0.1.6",
23 "python-shell": "^2.0.0", 26 "python-shell": "^2.0.0",
24 "rimraf": "^3.0.2", 27 "rimraf": "^3.0.2",
25 - "socket.io": "^2.3.0" 28 + "socket.io": "^2.3.0",
29 + "sqlite3": "^4.2.0"
26 } 30 }
27 } 31 }
......
1 +<!DOCTYPE html>
2 +<html lang="en">
3 +<head>
4 + <meta charset="UTF-8">
5 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
7 + <script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
8 + <link rel="stylesheet" href="../assets/css/alldata.css">
9 + <title>Document</title>
10 +</head>
11 +<body>
12 + <header class="menu-header py-4">
13 + <div class="row pl-3 d-flex justify-content-start flex-nowrap align-items-end">
14 + <div class="col">
15 + <a class="title-name text-dark">All data</a>
16 + </div>
17 + <div div class="col-8">
18 + <a class="title-detail">추출 데이터 확인</a>
19 + </div>
20 + <div div class="col">
21 + <a class="title-back" href="menu.html" id="menu-out">나가기</a>
22 + </div>
23 + </div>
24 + </header>
25 + <div class="nav-scroller nav-color py-1 mb-2">
26 + <nav class="nav d-flex justify-content-around">
27 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-info">INFO</a>
28 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-calling">CALLING</a>
29 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-photo">PHOTO</a>
30 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-contact">CONTACT</a>
31 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-video">VIDEO</a>
32 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-sms">SMS</a>
33 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-audio">AUDIO</a>
34 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-document">DOCUMENT</a>
35 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-calendar">CALENDAR</a>
36 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-network">NETWORK</a>
37 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-appinfo">APP INFO</a>
38 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-wifi">WIFI</a>
39 + <a class="p-2" href="#" style="color: whitesmoke" id="menu-usagestats">USAGESTATS</a>
40 + </nav>
41 + </div>
42 + <div ids = "table_list">
43 + <table id="table">
44 + <tbody>
45 +
46 + </tbody>
47 + </table>
48 + </div>
49 + <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
50 + <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
51 + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
52 + <script src="alldata_menu.js"></script>
53 +</body>
54 +</html>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
...@@ -32,16 +32,16 @@ connect_btn.addEventListener("click", () => { ...@@ -32,16 +32,16 @@ connect_btn.addEventListener("click", () => {
32 /* 32 /*
33 var connection = mysql.createConnection({ 33 var connection = mysql.createConnection({
34 host:'localhost', 34 host:'localhost',
35 - user:'root', 35 + user: 'root',
36 - password:'1234' 36 + password: '1234'
37 }); 37 });
38 38
39 connection.connect(); 39 connection.connect();
40 */ 40 */
41 41
42 var mysql = { 42 var mysql = {
43 - user : 'root', 43 + user: 'root',
44 - password : '1234' 44 + password: '1234'
45 }; 45 };
46 46
47 function apkInstall(){ 47 function apkInstall(){
...@@ -77,6 +77,82 @@ function convertToMysql(){ ...@@ -77,6 +77,82 @@ function convertToMysql(){
77 }) 77 })
78 } 78 }
79 79
80 +// function extractDB () {
81 +// cmd_backup = exec('adb -s '+device+' backup com.example.dataextraction -f backup.dataextraction.ad', function(error, stdout, stderr){
82 +// cc.innerHTML="backup app";
83 +// setTimeout(function(){
84 +// cmd_unpack = exec('java -jar abe.jar unpack backup.dataextraction.ad dataextraction.tar',function(error, stdout, stderr){
85 +// cc.innerHTML="unpack backup";
86 +// cmd_unzip = exec('tar xvf dataextraction.tar', function(error, stdout, stderr){
87 +// cc.innerHTML="unzip tar";
88 +// cmd_moveIdb = fs.rename('apps/com.example.dataextraction/db/InnerDatabase.db', 'InnerDatabase.db', function(){
89 +// cc.innerHTML="move InnerDB File";
90 +// cmd_moveNdb = fs.rename('apps/com.example.dataextraction/db/networkDatabase.db', 'networkDatabase.db',function(){
91 +// cc.innerHTML="move NetworkDB File";
92 +// cmd_sqlIdb = exec('sqlite3 InnerDatabase.db .dump | python SQLiteToMysql.py > InnerDatabase.sql',function(error, stdout, stderr){
93 +// cc.innerHTML="make InnerDB SQL";
94 +// cmd_sqlNdb = exec('sqlite3 networkDatabase.db .dump | python SQLiteToMysql_network.py > networkDatabase.sql', function(error, stdout, stderr){
95 +// cc.innerHTML="make NetworkDB SQL";
96 +// 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){
97 +// cc.innerHTML="create InnerDB";
98 +// cmd_insertIdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION < InnerDatabase.sql',function(error, stdout, stderr){
99 +// cc.innerHTML="insert Data ; InnerDB";
100 +// 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){
101 +// cc.innerHTML="create NetworkDB";
102 +// cmd_insertNdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION_network < networkDatabase.sql',function(error, stdout, stderr){
103 +// cc.innerHTML="insert Data ; NetworkDB";
104 +// cc.innerHTML="Data Extraction Complete !";
105 +// cc.innerHTML="Click 'NEXT' Button";
106 +// })
107 +// })
108 +// })
109 +// })
110 +// })
111 +// })
112 +// })
113 +// })
114 +// })
115 +// })
116 +// },7000);
117 +// });
118 +// //cmd_backup();
119 +// }
120 +
121 +// //db insert done
122 +// io.on('connection', function(socket){
123 +// var instanceId = socket.id;
124 +
125 +// socket.on('alert', function(data){
126 +// cc.innerHTML = data.comment+" db created";
127 +// })
128 +// socket.on('end', function(data){
129 +// cc.innerHTML="all databases created !";
130 +// extractDB();
131 +// })
132 +// })
133 +
134 +function convertToMysql(){
135 + cmd_sqlIdb = exec('sqlite3 InnerDatabase.db .dump | python SQLiteToMysql.py > InnerDatabase.sql',function(error, stdout, stderr){
136 + cc.innerHTML="make InnerDB SQL";
137 + cmd_sqlNdb = exec('sqlite3 networkDatabase.db .dump | python SQLiteToMysql_network.py > networkDatabase.sql', function(error, stdout, stderr){
138 + cc.innerHTML="make NetworkDB SQL";
139 + 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){
140 + cc.innerHTML="create InnerDB";
141 + cmd_insertIdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION < InnerDatabase.sql',function(error, stdout, stderr){
142 + cc.innerHTML="insert Data ; InnerDB";
143 + 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){
144 + cc.innerHTML="create NetworkDB";
145 + cmd_insertNdb = exec('mysql -u'+mysql.user+' -p'+mysql.password+' DATAEXTRACTION_network < networkDatabase.sql',function(error, stdout, stderr){
146 + cc.innerHTML="insert Data ; NetworkDB";
147 + cc.innerHTML="Data Extraction Complete !";
148 + cc.innerHTML="Click 'NEXT' Button";
149 + })
150 + })
151 + })
152 + })
153 + })
154 + })
155 +}
80 function extractDB () { 156 function extractDB () {
81 cmd_backup = exec('adb -s '+device+' backup com.example.dataextraction -f backup.dataextraction.ad', function(error, stdout, stderr){ 157 cmd_backup = exec('adb -s '+device+' backup com.example.dataextraction -f backup.dataextraction.ad', function(error, stdout, stderr){
82 cc.innerHTML="backup app"; 158 cc.innerHTML="backup app";
...@@ -119,5 +195,7 @@ ipcRenderer.on("device", (e, arg) => { ...@@ -119,5 +195,7 @@ ipcRenderer.on("device", (e, arg) => {
119 //device.innerHTML = arg.toString(); 195 //device.innerHTML = arg.toString();
120 196
121 cc.innerHTML="DATA EXTRACTION START !"; 197 cc.innerHTML="DATA EXTRACTION START !";
122 - apkInstall(); 198 + // apkInstall();
199 + extractDB();
200 +
123 }); 201 });
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 <button id="btn" class="menu_alldata_nwide" onclick="menu_all();">All Data 18 <button id="btn" class="menu_alldata_nwide" onclick="menu_all();">All Data
19 <div id="menu_alldata_wide" style="display:none"> 19 <div id="menu_alldata_wide" style="display:none">
20 <br> 20 <br>
21 - <h2 onclick="location.href='menu0.html'">전체 데이터 보기</h2> 21 + <h2 onclick="location.href='alldata_menu.html'">전체 데이터 보기</h2>
22 <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'"> 22 <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'">
23 <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"/> 23 <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"/>
24 <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"/> 24 <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 @@ ...@@ -72,7 +72,7 @@
72 <div id ="menu" class="menu_up"> 72 <div id ="menu" class="menu_up">
73 <div id="btn_group"> 73 <div id="btn_group">
74 <button id="btn" class="menu_analysis_menu3_nwide" onclick="menu_analysis_menu3();">Apps 74 <button id="btn" class="menu_analysis_menu3_nwide" onclick="menu_analysis_menu3();">Apps
75 - <div id="menu_analysis_menu3_wide" style="display:none" onclick="location.href='menu3.html'"> 75 + <div id="menu_analysis_menu3_wide" style="display:none" onclick="location.href='menu_apps.html'">
76 <h4>어플리케이션 사용 분석</h4> 76 <h4>어플리케이션 사용 분석</h4>
77 <div id="wide_location"> 77 <div id="wide_location">
78 <h2>어플 사용 분석</h2> 78 <h2>어플 사용 분석</h2>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
89 <div id ="menu"> 89 <div id ="menu">
90 <div id="btn_group"> 90 <div id="btn_group">
91 <button id="btn" class="menu_analysis_menu4_nwide" onclick="menu_analysis_menu4();">Media 91 <button id="btn" class="menu_analysis_menu4_nwide" onclick="menu_analysis_menu4();">Media
92 - <div id="menu_analysis_menu4_wide" style="display:none" onclick="location.href='menu4.html'"> 92 + <div id="menu_analysis_menu4_wide" style="display:none" onclick="location.href='menu_media.html'">
93 <h4>미디어 파일 저장공간 분석<br>비디오 분석</h4> 93 <h4>미디어 파일 저장공간 분석<br>비디오 분석</h4>
94 <div id="wide_location"> 94 <div id="wide_location">
95 <h2>미디어 분석</h2> 95 <h2>미디어 분석</h2>
......
1 +<!DOCTYPE html>
2 +<html lang="en">
3 +<head>
4 + <meta charset="UTF-8">
5 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
7 + <script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
8 + <link rel="stylesheet" href="../assets/css/menu_apps.css">
9 + <title>Document</title>
10 +</head>
11 +<body>
12 +<div class="container">
13 + <header class="menu-header py-4">
14 + <div class="row d-flex justify-content-start flex-nowrap align-items-end">
15 + <div class="col">
16 + <a class="title-name text-dark">Apps</a>
17 + </div>
18 + <div div class="col-9">
19 + <a class="title-detail">앱 사용 정보 분석</a>
20 + </div>
21 + <div div class="col">
22 + <a class="title-back" href="menu.html" id="menu-info">뒤로가기</a>
23 + </div>
24 + </div>
25 + </header>
26 + <div class="nav-scroller nav-color py-1 mb-2">
27 + <nav class="nav d-flex justify-content-around">
28 + <a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('App-List');">App List</a>
29 + <a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Deleted-App');">Deleted App</a>
30 + <a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Recent-Usage');">Recent Usage</a>
31 + </nav>
32 + </div>
33 + <div class="container">
34 + <div id="App-List" class="menu">
35 + <div class="row">
36 + <div class="col">
37 + <div class="my-3 p-3 bg-white rounded shadow-sm">
38 + <h6 class="border-bottom border-gray pb-2 mb-0 font-nanum">App List</h6>
39 + <div class="row sort justify-content-end">
40 + <a id="wifiusage" class="sort p-2 text-muted" href="#" onclick="getAppInfoList('wifiusage');">wifi 사용량순</a>
41 + <a id="cellularusage" class="sort p-2 text-muted" href="#" onclick="getAppInfoList('cellularusage');">cellular 사용량순</a>
42 + <a id="totaltime" class="sort p-2 text-muted" href="#" onclick="getAppInfoList('totaltime');" style="font-weight: bold;">실행 시간순</a>
43 + </div>
44 + <div id="applist">
45 +
46 + </div>
47 + </div>
48 + </div>
49 + <div class="col">
50 + <div class="my-3 p-3 bg-white rounded shadow-sm">
51 + <a id="appdetail_title" class="border-bottom border-gray pb-2 mb-0 font-nanum">App Detail</a>
52 + <div id="appdetails" class="detail_app font-nanum pt-2 pb-5">
53 + <h8 class="pt-3 pb-3 mb-0 font-italic">세부사항을 확인하려면 follow를 클릭하세요</h8>
54 + </div>
55 + <div id="pieChartdiv" class="pb-5">
56 + <canvas id="pieChart" style="max-width: 500px;"></canvas>
57 + </div>
58 + <div id="barchart_title" style="display: none;">
59 + <a class="pb-2 mb-0 font-nanum border-bottom border-gray">사용 시간대</a>
60 + </div>
61 + <div id="barChartdiv" class="pb-5">
62 + <canvas id="barChart"></canvas>
63 + </div>
64 + <div id = "apptimelist" class="font-nanum">
65 + </div>
66 + </div>
67 + </div>
68 + </div>
69 + </div>
70 +
71 +
72 + <div id="Deleted-App" class="menu" style="display:none">
73 + <div class="row">
74 + <div class="col">
75 + <div id="deletedapps" class="my-3 p-3 bg-white rounded shadow-sm">
76 + <h6 class="border-bottom border-gray pb-2 mb-0">Deleted Apps</h6>
77 + <div class="overflow-auto">
78 + <div id="deletedapplist" class="font-nanum">
79 +
80 + </div>
81 + </div>
82 + </div>
83 + </div>
84 + </div>
85 + </div>
86 +
87 +
88 + <div id="Recent-Usage" class="menu" style="display:none">
89 + <h6 class="border-bottom border-gray pb-2 mb-0">최근 10일 사용 분석</h6>
90 + <div class="row">
91 + <div class="col">
92 + <div id="day10analysis" class="my-3 p-3 bg-white rounded shadow-sm">
93 + <div id="pieCharttop10">
94 + <a class="border-bottom border-gray pb-2 mb-0 font-nanum">사용 시간 비율</a>
95 + <canvas id="pieChart10" width="350" height="350"></canvas>
96 + </div>
97 + </div>
98 + </div>
99 + <div class="col">
100 + <div id="top10list" class="my-3 p-3 bg-white rounded shadow-sm">
101 +
102 + </div>
103 + </div>
104 + </div>
105 + <div class="row">
106 + <div class="col">
107 + <div class="my-3 p-3 bg-white rounded shadow-sm">
108 + <a class="border-bottom border-gray pb-2 mb-0 font-nanum">일별 사용량</a>
109 + <canvas id="recent_bar" width="400" height="400"></canvas>
110 + </div>
111 + </div>
112 + <div class="col">
113 + <div class="my-3 p-3 bg-white rounded shadow-sm">
114 + <a class="border-bottom border-gray pb-2 mb-0 font-nanum">사용 어플</a>
115 + <div id="selectday"class="row sort justify-content-end">
116 +
117 + </div>
118 + <table id="day_use_list" class="font-nanum" style="font-size: 10;">
119 + <tbody>
120 +
121 + </tbody>
122 + </table>
123 + </div>
124 + </div>
125 + </div>
126 + </div>
127 + </div>
128 + </div>
129 +</div>
130 + <script src="menu_apps.js"></script>
131 + <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
132 + <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
133 + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
134 +</body>
135 +</html>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +<!DOCTYPE html>
2 +<html lang="en">
3 +<head>
4 + <meta charset="UTF-8">
5 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
7 + <script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
8 + <link rel="stylesheet" href="../assets/css/menu_apps.css">
9 + <title>Document</title>
10 +</head>
11 +<body>
12 +<div class="container">
13 + <header class="menu-header py-4">
14 + <div class="row d-flex justify-content-start flex-nowrap align-items-end">
15 + <div class="col">
16 + <a class="title-name text-dark">Media</a>
17 + </div>
18 + <div div class="col-9">
19 + <a class="title-detail">미디어 파일 분석</a>
20 + </div>
21 + <div div class="col">
22 + <a class="title-back" href="menu.html" id="menu-info">나가기</a>
23 + </div>
24 + </div>
25 + </header>
26 + <div class="nav-scroller nav-color py-1 mb-2">
27 + <nav class="nav d-flex justify-content-around">
28 + <a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Media-Strorage-Structure');">Media Strorage Structure</a>
29 + <a class="p-2" href="#" style="color: whitesmoke" onclick="openTap('Video-Analysis');">Video Analysis</a>
30 + </nav>
31 + </div>
32 + <div class="container">
33 + <div id="Media-Strorage-Structure" class="menu">
34 + <div class="row">
35 + <div class="col">
36 + <div class="my-3 p-3 bg-white rounded shadow-sm">
37 + <h6 class="border-bottom border-gray pb-2 mb-0">Media file 저장공간</h6>
38 + <div id="barChartdiv">
39 + <canvas id="pieChart"></canvas>
40 + </div>
41 + <div id="pie_datalist" class="w-75 pt-4">
42 + </div>
43 + </div>
44 + </div>
45 + <div class="col">
46 + <div class="my-3 p-3 bg-white rounded shadow-sm">
47 + <h6 class="border-bottom border-gray pb-2 mb-0">파일 구조 분석</h6>
48 + <div class="row justify-content-end">
49 + <a id="photo" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('photo');" style="font-weight: bold;">Image</a>
50 + <a id="video" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('video');">Video</a>
51 + <a id="audio" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('audio');">Audio</a>
52 + <a id="documentinfo" class="filetype p-2 text-muted" href="#" onclick="getStorageStructure('documentinfo');">Document</a>
53 + </div>
54 + <h8 id="struct_title" class="pt-3 pb-3 pl-1 mb-0 font-italic" style="font-size: 17px;">Image</h8>
55 + <div id="mediafile_struct">
56 + <div>
57 +
58 + </div>
59 + </div>
60 + </div>
61 + </div>
62 + </div>
63 + <div id="filelist_for_folder" class="row" style="display: none;">
64 + <div class="col">
65 + <div class="my-3 p-3 bg-white rounded shadow-sm">
66 + <h6 id='infilelist' class="border-bottom border-gray pb-2 mb-0 "></h6>
67 + <table id="filetable" class="table">
68 + <tbody>
69 +
70 + </tbody>
71 + </table>
72 + </div>
73 + </div>
74 + </div>
75 + </div>
76 +
77 + <div id="Video-Analysis" class="menu" style="display: none;">
78 + <div class="row">
79 + <div class="col">
80 + <div class="my-3 p-3 bg-white rounded shadow-sm">
81 + <h6 class="border-bottom border-gray pb-2 mb-0">Video 선택</h6>
82 + <div class="check_confirm d-flex justify-content-end p-1">
83 + <button id="temp_post" type="button" class="btn btn-sm btn-primary font-nanum">analysis start</button>
84 + </div>
85 + <table id="videotable" class="table">
86 + <tbody>
87 +
88 + </tbody>
89 + </table>
90 + </div>
91 + </div>
92 + </div>
93 + </div>
94 + <div id="Analysis-Detail" class="menu" style="display: none;">
95 + <div id ="va_list" class="bg-white rounded shadow-sm">
96 +
97 + </div>
98 + </div>
99 + </div>
100 +</div>
101 +
102 + <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
103 + <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
104 + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
105 + <script src="menu_media.js"></script>
106 + </body>
107 +</html>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +// Imports the Google Cloud Video Intelligence library + Node's fs library
2 +const video = require('@google-cloud/video-intelligence').v1;
3 +const fs = require('fs');
4 +const util = require('util');
5 +async function getinfo(){
6 + console.log('before client');
7 + // Creates a client
8 + const client = new video.VideoIntelligenceServiceClient();
9 + console.log('after client');
10 +
11 + /**
12 + * TODO(developer): Uncomment the following line before running the sample.
13 + */
14 + const path = 'C:/Users/yunyoung/Desktop/temp/2016104137/source/forensic_tool/20190525_113617.mp4';
15 +
16 + // Reads a local video file and converts it to base64
17 + const readFile = util.promisify(fs.readFile);
18 + const file = await readFile(path);
19 + const inputContent = file.toString('base64');
20 +
21 + // Constructs request
22 + const request = {
23 + inputContent: inputContent,
24 + features: ['LABEL_DETECTION'],
25 + };
26 +
27 + // Detects labels in a video
28 + const [operation] = await client.annotateVideo(request);
29 + console.log('Waiting for operation to complete...');
30 + const [operationResult] = await operation.promise();
31 + // Gets annotations for video
32 + const annotations = operationResult.annotationResults[0];
33 +
34 + const labels = annotations.segmentLabelAnnotations;
35 + labels.forEach(label => {
36 + console.log(`Label ${label.entity.description} occurs at:`);
37 + label.segments.forEach(segment => {
38 + const time = segment.segment;
39 + if (time.startTimeOffset.seconds === undefined) {
40 + time.startTimeOffset.seconds = 0;
41 + }
42 + if (time.startTimeOffset.nanos === undefined) {
43 + time.startTimeOffset.nanos = 0;
44 + }
45 + if (time.endTimeOffset.seconds === undefined) {
46 + time.endTimeOffset.seconds = 0;
47 + }
48 + if (time.endTimeOffset.nanos === undefined) {
49 + time.endTimeOffset.nanos = 0;
50 + }
51 + console.log(
52 + `\tStart: ${time.startTimeOffset.seconds}` +
53 + `.${(time.startTimeOffset.nanos / 1e6).toFixed(0)}s`
54 + );
55 + console.log(
56 + `\tEnd: ${time.endTimeOffset.seconds}.` +
57 + `${(time.endTimeOffset.nanos / 1e6).toFixed(0)}s`
58 + );
59 + console.log(`\tConfidence: ${segment.confidence}`);
60 + });
61 + });
62 +}
63 +//getinfo();
64 +//get_videosaftey();
65 +async function get_videosaftey(){
66 + // Imports the Google Cloud Video Intelligence library
67 + const video = require('@google-cloud/video-intelligence').v1;
68 + console.log('before client');
69 + // Creates a client
70 + const client = new video.VideoIntelligenceServiceClient();
71 + console.log('after client');
72 +
73 + /**
74 + * TODO(developer): Uncomment the following line before running the sample.
75 + */
76 + // const gcsUri = 'GCS URI of video to analyze, e.g. gs://my-bucket/my-video.mp4';
77 + const path = 'C:/Users/yunyoung/Videos/20190525_113617.mp4';
78 +
79 + // Reads a local video file and converts it to base64
80 + const readFile = util.promisify(fs.readFile);
81 + const file = await readFile(path);
82 + const inputContent = file.toString('base64');
83 +
84 + const request = {
85 + inputContent: inputContent,
86 + features: ['EXPLICIT_CONTENT_DETECTION'],
87 + };
88 +
89 + // Human-readable likelihoods
90 + const likelihoods = [
91 + 'UNKNOWN',
92 + 'VERY_UNLIKELY',
93 + 'UNLIKELY',
94 + 'POSSIBLE',
95 + 'LIKELY',
96 + 'VERY_LIKELY',
97 + ];
98 +
99 + // Detects unsafe content
100 + const [opertaion] = await client.annotateVideo(request);
101 + console.log('Waiting for operation to complete...');
102 + const [operationResult] = await opertaion.promise();
103 + // Gets unsafe content
104 + const explicitContentResults =
105 + operationResult.annotationResults[0].explicitAnnotation;
106 + console.log('Explicit annotation results:');
107 + explicitContentResults.frames.forEach(result => {
108 + if (result.timeOffset === undefined) {
109 + result.timeOffset = {};
110 + }
111 + if (result.timeOffset.seconds === undefined) {
112 + result.timeOffset.seconds = 0;
113 + }
114 + if (result.timeOffset.nanos === undefined) {
115 + result.timeOffset.nanos = 0;
116 + }
117 + console.log(
118 + `\tTime: ${result.timeOffset.seconds}` +
119 + `.${(result.timeOffset.nanos / 1e6).toFixed(0)}s`
120 + );
121 + console.log(
122 + `\t\tPornography likelihood: ${likelihoods[result.pornographyLikelihood]}`
123 + );
124 + });
125 +}
126 +
127 +// var ss = `C:\\Users\\yunyoung\\Desktop\\temp\\2016104137\\source\\forensic_tool\\20190215_152731.mp4`
128 +// var h = ss.split('\\');
129 +// var c = '';
130 +// for(var i = 0; i < h.length; i++){
131 +// c += h[i] + '/';
132 +// }
133 +// console.log(c);
134 +// const l = c.slice(0,-1);
135 +// console.log(l);
136 +// console.log(ss);
137 +// var hell = ss.replace('/\\/g','/');
138 +// console.log(hell);
139 +
140 +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']]]];
141 +console.log(labels);
142 +var content = {video : '2020',labels : []}
143 +labels.forEach(label => {
144 + content['labels'].push(label[0]);
145 + content[label[0]] = [];
146 + label[1].forEach(segment => {
147 + var temp = [segment[0],segment[1]];
148 + content[label[0]].push(temp);
149 + });
150 +});
151 +
152 +console.log(content);
153 +var array = content['labels'];
154 +
155 +array.forEach(label =>{
156 + for(var i = 0; i < content[label].length; i++){
157 + console.log(content[label][i]);
158 + }
159 +});
160 +
161 +var likelihood_index = {'UNKNOWN': 0,'VERY_UNLIKELY': 1,'UNLIKELY': 2,'POSSIBLE': 3,'LIKELY': 4,'VERY_LIKELY': 5};
162 + var det_dataset = [0,0,0,0,0,0]
163 +
164 + det_dataset[likelihood_index[dt_dict['likelihood'][i][1]]] +=1;
165 +
166 +var ctx = document.getElementById('det_piechart_'+lb_dict['video']);
167 + var config = {
168 + type: 'pie',
169 + data: {
170 + labels: ["UNKNOWN", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE","LIKELY",'VERY_LIKELY'],
171 + datasets: [{
172 + data: det_dataset,
173 + backgroundColor: ["#F7464A", "#46BFBD", "#FDB45C", "#949FB1"],
174 + hoverBackgroundColor: ["#FF5A5E", "#5AD3D1", "#FFC870", "#A8B3C5"]
175 + }]
176 + },
177 + options: {
178 + responsive: true
179 + }
180 + }
...\ No newline at end of file ...\ No newline at end of file