Dash:
[t2.git] / package / vdr / vdr-digicam / gphoto-list.patch
blobe6bac5b155a72b46540f163729b211d2e1cf4e1c
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../vdr-digicam/gphoto-list.patch
5 # Copyright (C) 2008 - 2009 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 --- digicam-1.0.2/cameralist.c.orig 2006-09-28 12:41:53.000000000 +0200
18 +++ digicam-1.0.2/cameralist.c 2007-02-11 21:09:49.000000000 +0100
19 @@ -47,7 +47,7 @@
20 // check pre processor option to disable real scan and produce sample entries
21 #ifndef SAMPLE_DIRS
22 // libgphoto2 struct for folder/file list
23 - CameraList result;
24 + CameraList *result;
26 if (!digitalCamera.isAvailable())
27 return true;
28 @@ -56,19 +56,22 @@
29 digitalCamera.setDirectory( src->BaseDir(), subdir );
31 // what scan type ?
32 + gp_list_new(&result);
33 switch (type) {
34 case stDir: // Scan for directories
35 - digitalCamera.getFolderList( &result );
36 + digitalCamera.getFolderList( result );
37 break;
38 case stFile: // Scan for files
39 - digitalCamera.getFileList( &result );
40 + digitalCamera.getFileList( result );
41 break;
45 // Display item for each result entry
46 - for (int i=0; i<result.count; i++) {
47 - DoItem(src, subdir, result.entry[i].name );
48 + for (int i=0; i < gp_list_count(result); i++) {
49 + const char *name;
50 + gp_list_get_name(result, i, &name);
51 + DoItem(src, subdir, name );
54 #else
55 --- digicam-1.0.2/digitalcamera.c.orig 2006-09-28 12:41:53.000000000 +0200
56 +++ digicam-1.0.2/digitalcamera.c 2007-02-11 20:58:54.000000000 +0100
57 @@ -127,7 +127,7 @@
58 printf("%s\n", cameraDirectory);
59 #endif
60 if (list != NULL) // init result count to avoid conflicts
61 - list->count = 0; // when error occurs
62 + gp_list_unref(list);
64 if (camera != NULL && list != NULL) {
65 lastError = gp_camera_folder_list_folders( camera, cameraDirectory, list, NULL);
66 @@ -140,7 +140,7 @@
67 // Fill the passed structure with filelist of current directory
68 int DigitalCamera::getFileList(CameraList *list) {
69 if (list != NULL) // init result count to avoid conflicts
70 - list->count = 0; // when error occurs
71 + gp_list_unref(list);
73 if (camera != NULL && list != NULL) {
74 lastError = gp_camera_folder_list_files( camera, cameraDirectory, list, NULL);
75 --- digicam-1.0.2/directory-loader.c.orig 2007-02-11 21:10:03.000000000 +0100
76 +++ digicam-1.0.2/directory-loader.c 2007-02-11 21:13:20.000000000 +0100
77 @@ -31,10 +31,10 @@
80 void cDirectoryLoader::Download(void) {
81 - CameraList files;
82 - files.count = 0;
83 + CameraList *files;
84 CameraFile *file = NULL;
85 char buf[FACTSHEET_BUFLEN];
86 + const char *name;
88 #ifdef DEBUG
89 printf("cDirectoryLoader::Download\n" );
90 @@ -47,24 +47,24 @@
91 #endif
92 dCam->setDirectory( "/", PathOnCamera );
93 // Get filelist
94 - if (dCam->getFileList( &files ) == DIGICAM_NO_ERROR) {
95 + gp_list_new(&files);
96 + if (dCam->getFileList(files) == DIGICAM_NO_ERROR) {
97 // Avoid any output in case of no files found (VDR crashes)
98 - fileCount = files.count;
100 - if (files.count > 0) {
101 + fileCount = gp_list_count(files);
102 + if (fileCount > 0) {
103 // walk through file list and download files
104 - for (currentFile=0; currentFile<files.count; currentFile++) {
105 + for (currentFile=0; currentFile < gp_list_count(files); currentFile++) {
106 if ( !Running() ) // Cancel thread?
107 break;
109 gp_file_new(&file);
111 OSDStatus("Loading file");
113 - dsyslog("Digicam: Loading file '%s'", files.entry[currentFile].name );
114 + gp_list_get_name (files, currentFile, &name);
115 + dsyslog("Digicam: Loading file '%s'", name );
117 // get file from camera
118 - if ( dCam->getFile( files.entry[currentFile].name, file ) != DIGICAM_NO_ERROR) {
119 + if ( dCam->getFile( name, file ) != DIGICAM_NO_ERROR) {
120 break;
123 @@ -77,7 +77,7 @@
124 OSDStatus("Storing file");
126 // Saving file to disc
127 - snprintf( buf, 100, "%s/%s", cFactsheetBase::getCopyDestination(), files.entry[currentFile].name );
128 + snprintf( buf, 100, "%s/%s", cFactsheetBase::getCopyDestination(), name );
130 dsyslog("Saving image to disc");
132 --- digicam-1.0.2/facts-directory.c.orig 2006-09-28 12:41:53.000000000 +0200
133 +++ digicam-1.0.2/facts-directory.c 2007-02-11 21:09:34.000000000 +0100
134 @@ -47,7 +47,7 @@
135 cFactsheetDirectory::cFactsheetDirectory(cDirItem *file):
136 cFactsheetBase( tr("Directory download"), file) {
138 - CameraList files;
139 + CameraList *files;
140 CameraFileInfo fileInfo;
141 unsigned long totalFileSize = 0;
143 @@ -63,19 +63,24 @@
144 digitalCamera.setDirectory( "/", fileItem->Path() );
146 // Get filelist
147 - if (digitalCamera.getFileList( &files ) != DIGICAM_NO_ERROR) {
148 + gp_list_new(&files);
149 + if (digitalCamera.getFileList( files ) != DIGICAM_NO_ERROR) {
150 cDigicamLogger::reportCameraError( digitalCamera.getErrNo() );
151 return;
154 - fileCount = files.count;
155 + fileCount = gp_list_count(files);
157 // walk through file list and get directory parameter (size, file count )
158 - for (int i=0; i<files.count; i++) {
159 + for (int i=0; i<gp_list_count(files); i++) {
160 + const char *name, *value;
161 + gp_list_get_name(files, i, &name);
162 + gp_list_get_value(files, i, &value);
164 #ifdef DEBUG
165 - printf("Computing file %s\n", files.entry[i].name );
166 + printf("Computing file %s\n", name );
167 #endif
168 - if (digitalCamera.getFileInformation( &fileInfo, files.entry[i].name ) !=
169 + if (digitalCamera.getFileInformation( &fileInfo, name ) !=
170 DIGICAM_NO_ERROR) {
171 cDigicamLogger::reportCameraError( digitalCamera.getErrNo() );
172 return;
173 @@ -85,7 +90,7 @@
176 addAttribute( tr("Directory"), fileItem->Name );
177 - addAttribute( tr("File count"), files.count );
178 + addAttribute( tr("File count"), gp_list_count(files));
179 addAttribute( tr("Size of all files"), ((double) totalFileSize) / 1024 / 1024, "mb" );
180 addAttribute( tr("Store destination"), getCopyDestination() );