The more submitted via script.
[webos-internals:imagineer1981s-modifications.git] / camera / camera-improved-filename-format.patch
1 k--- .orig/usr/palm/applications/com.palm.app.camera/javascripts/camera-control.js\r
2 +++ /usr/palm/applications/com.palm.app.camera/javascripts/camera-control.js\r
3 @@ -70,8 +70,14 @@\r
4                         \r
5                         // Create a filename using the image count and path info stored in preferences.\r
6                         var imgNum = this.prefs[CameraControl.PREFS.COUNT];\r
7 -                       var imgNumStr = "000"+imgNum;\r
8 -                       imgNumStr = imgNumStr.substring(imgNumStr.length-4);  \r
9 +                       var date = new Date();\r
10 +                       var YYYY = date.getFullYear();\r
11 +                       var MM = (1+date.getMonth()); if (MM<10) { MM = "0"+MM; }\r
12 +                       var DD = (0+date.getDate()); if (DD<10) { DD = "0"+DD; }\r
13 +                       var hh = date.getHours(); if (hh < 10) { hh = "0"+hh; }\r
14 +                       var mm = date.getMinutes(); if (mm < 10) { mm = "0"+mm; }\r
15 +                       var ss = date.getSeconds(); if (ss < 10) { ss = "0"+ss; }\r
16 +                       var fileBase = YYYY + "-" +  MM + "-" + DD + "-" + hh + mm + ss;\r
17         \r
18                         // Set file destination image\r
19                         cam.dst = this.prefs[CameraControl.PREFS.PATH]\r
20 @@ -79,25 +85,11 @@\r
21                                                                 + this.prefs[CameraControl.PREFS.MAKE].toUpperCase().substring(0,4)\r
22                                                                 + "/"\r
23                                                                 + this.prefs[CameraControl.PREFS.FILE]\r
24 -                                                               + imgNumStr\r
25 +                                                               + fileBase\r
26                                                                 +".jpg";\r
27  \r
28                         // Increment image count, but wrap at 10000, then save back to preferences\r
29                         ++imgNum;\r
30 -                       if (imgNum > 9999){\r
31 -                               imgNum = 1;\r
32 -       \r
33 -                               // Increment the album number (directory) so we don't overwrite the previous CIMG0001.jpg \r
34 -                               var album = (+this.prefs[CameraControl.PREFS.ALBUM]);\r
35 -                               if (album == 900) {\r
36 -                                       album = 100;\r
37 -                               }\r
38 -                               else {\r
39 -                                       ++album;\r
40 -                               }\r
41 -                               CameraPrefs.updatePref(this.prefs, CameraControl.PREFS.ALBUM, album);\r
42 -                       }\r
43 -       \r
44                         CameraPrefs.updatePref(this.prefs, CameraControl.PREFS.COUNT, imgNum);\r
45                 }\r
46  \r
47 @@ -215,19 +207,6 @@\r
48                 \r
49                 // Increment image count - after all, the image we got from the adapter was the LAST CAPTURED\r
50                 ++image;\r
51 -               if (image > 9999) {\r
52 -                       image = 1;\r
53 -                       \r
54 -                       // Increment the album number (directory) so we don't overwrite the previous CIMG0001.jpg \r
55 -                       if (album == 900) {\r
56 -                               album = 100;\r
57 -                       }\r
58 -                       else {\r
59 -                               ++album;\r
60 -                       }\r
61 -                       CameraPrefs.updatePref(this.prefs, CameraControl.PREFS.ALBUM, album);\r
62 -               }\r
63 -               \r
64                 CameraPrefs.updatePref(this.prefs, CameraControl.PREFS.COUNT, image);\r
65                 \r
66                 llog("ALBUM: " + album);\r
67 --- .orig/usr/palm/applications/com.palm.app.camera/camera-prefs-defaults.json\r
68 +++ /usr/palm/applications/com.palm.app.camera/camera-prefs-defaults.json\r
69 @@ -7,7 +7,7 @@\r
70         'CAMERA-MAKE': 'Palm',\r
71         'CAMERA-MODEL': 'Pre ',\r
72         'COUNT': '1',\r
73 -       'FILE-PREFIX': 'CIMG',\r
74 +       'FILE-PREFIX': 'PRE_',\r
75         'GEOTAGGING': 'enabled',\r
76         'GPS-ACCURACY-METER': 'disabled',\r
77         'GPS-FIX-MAX-AGE': '120',\r
78 \r