03-17-2010, 05:36 AM | #1 |
Connoisseur
Posts: 80
Karma: 204
Join Date: Jun 2007
Device: Sony Librie, Irex DR1000S
|
DR1000S: How to create file shortcuts using a full path?
I am having some problems with the shortcuts. As fas as I know there are two kind of shortcuts (are there more?), one for directories and the other files.
I know how to create directory shortcuts. For example, a file "Co10.directory" with the contents Code:
[Desktop Entry] Version=1.0 Type=Directory Path=/media/mmcblk0p1/System/Files/Papers/Co10c Name=Co10c On the other hand, I have some troubles with the syntax for file shortcuts; if I create a file "Co10.desktop" with the contents Code:
[Desktop Entry] Version=1.0 Type=Link URL=file:///media/mmcblk0p1/System/Files/Papers/Co10c/Co10c.pdf Name=Co10c I have checked the "file shortcuts" created by the firmware (which indeed work well), and I see that they use a local path in the URL file. Does anyone know how to do it with a "full path" in the URL field? |
03-17-2010, 07:44 AM | #2 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
For the Recent Files patch I also use shortcuts, I use some functions from the firmware to create them. They are all relative from the location of the short-cut file.
I have not checked the code to see why annotation with relative paths work and absolute not. |
Advert | |
|
03-17-2010, 01:09 PM | #3 |
Connoisseur
Posts: 80
Karma: 204
Join Date: Jun 2007
Device: Sony Librie, Irex DR1000S
|
Do you remember the name of this utility? [I would like to take a look at the code.]
|
03-17-2010, 01:30 PM | #4 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
See the sources: /ctb/src/shortcut.c function create_shortcut_file()
Look for : "determine relative path shortcut -> target" |
03-18-2010, 07:18 AM | #5 |
Connoisseur
Posts: 80
Karma: 204
Join Date: Jun 2007
Device: Sony Librie, Irex DR1000S
|
I have just checked that if I use a relative path in a ".desktop" file, then the trouble is still there (i.e., scribbles are not stored). Hence, the trouble is not with the full path.
Thus, I guess that when file shortcuts are created in the device there is something else done besides creating the ".desktop" file [This is the reason why just creating the file shortcut does not work] I would like to create the file shortcuts in my computer, and later synchronize them with my SD card (the one to be used in the device). Hence, I need to know what else must be done besides creating the ".desktop" file. Anyone knows what else must be done? |
Advert | |
|
03-18-2010, 11:03 AM | #6 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
You seem to put your files in the System folder (in your example), I know that this folder is handled differently then others by the firmware. What if you put them in another folder?
|
03-18-2010, 11:56 AM | #7 | |
Connoisseur
Posts: 80
Karma: 204
Join Date: Jun 2007
Device: Sony Librie, Irex DR1000S
|
Quote:
My idea is to store all my pdf files in one folder (let us say "System/Files"), and then use a "System/Tags" folder (also having subfolders) hierarchy based on shortcuts to the files located in the Files folder. In this way I can have - a subfolder "System/Tags/Authors/P/Poe" where I have shortcuts for the books written by E. Allan Poe, - a subfolder "System/Journals/NoticesAMS/2010" where I have shortcuts for the 2010 papers in the "Notices of the American Mathematical Society" journal, - etc But I do not manage to succeed because the file shortcuts do not work well (at least I do not completely understand them). |
|
03-18-2010, 12:26 PM | #8 |
Fanatic
Posts: 556
Karma: 1102020
Join Date: Sep 2009
Device: Kindle Keyboard (rip), Kindle Voyage, Fire Tablet 10 '17, iPad '19
|
I think he means to put your documents someplace other than under /system/.
Do you need a /system/ folder on your flash card? Instead of: /media/mmcblk0p1/System/Files/Papers/Co10c/ ...would this work?: /media/mmcblk0p1/Files/Papers/Co10c/ |
03-18-2010, 12:45 PM | #9 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
Yes, that is what I was trying to say, thanks for clarifying badbob001
|
03-18-2010, 02:52 PM | #10 |
Connoisseur
Posts: 80
Karma: 204
Join Date: Jun 2007
Device: Sony Librie, Irex DR1000S
|
No, this is not working: I have created a new folder "Files" (at the root level) including both pdf files and shortcuts, but I still have the same trouble.
On the other hand, if I move the shortcuts created in the "/Recent" folder (created by the the Patch for Recent files) to a different folder and I modify the relative path to the new location, then this is working (even inside the System folder). |
03-18-2010, 04:01 PM | #11 |
Guru
Posts: 999
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
|
Annotations are stored in the metadata.db file which is located in the folder of the original file. File-information and annotations are stored in different tables and are linked together using a file-id (which is a number).
So for annotations to be stored, the original file needs to be in the metadata.db file, to link the annotations to the file-id. If you copy a file 'fresh' form your PC in a folder, never browse the folder and open the file via a short-cut copied from the PC, no entry will have been created in the metadata.db for the file. So there is no way to link the annotations to the file. (The shortcut you copied from the Recent-folder, links to a file that must be in a metadata.db file, otherwise, no shortcut would not have been created in the Recent-folder.) So the next experiment: - first go to the folder of the actual file that you copied (you don't have to open the file, browsing the folder is enough) - Then open the file via the shortcut and make some annotations - Close and reopen If this works we need to find a way to add new files to the metadata.db, so annotations can be linked to the file. |
03-18-2010, 05:14 PM | #12 | |
Connoisseur
Posts: 80
Karma: 204
Join Date: Jun 2007
Device: Sony Librie, Irex DR1000S
|
Quote:
Hence, as you say, next I have to look at sqlite3 to find a way to add a pdf file to the metadata.db file (the one located in the same folder). Indeed, it would be much better to find a way to do it on the fly on the DR device; i.e., if you use a file shortcut for a pdf file without metadata.db then create the metadata.db file before opening the pdf file. |
|
03-20-2010, 12:12 AM | #13 |
Member
Posts: 13
Karma: 24
Join Date: Jan 2010
Device: irex dr1000s
|
You may find metadata utilities in the headers of libermetadb ermetadb.h, metadata_table.h and usage examples in ctb/src/filemodel.c
The code might be something like this, which is copied from filemodel.c and modified. Code:
// create metadata database if not exists static int create_metadatabase (const gchar *directory, const gchar *filename, const gchar *fullpath, const gchar *title, const gchar *author) { int ret = ER_OK; // return code int rc; GString *dir = g_string_new(directory); GString *file = g_string_new(filename); struct stat statbuf; erMetadb *g_metadb = NULL; metadata_table *values = NULL; // set title and an author values = metadata_table_new(); metadata_table_add_column(values,"title"); metadata_table_add_column(values,"author"); metadata_table_set_text(values,0,title); metadata_table_set_text(values,1,author); g_metadb = ermetadb_new(); if (g_metadb == NULL) { ret = ER_FAIL; } // open database in specified directory if (ret == ER_OK) { rc = ermetadb_open_database_readonly(g_metadb, dir); switch(rc) { case ER_NOT_FOUND: // database not present: create a new database and open it rc = ermetadb_create_database(dir); if(rc == ER_OK) { rc = ermetadb_open_database(g_metadb, dir); } if(rc == ER_OK) { rc = stat(fullpath, &statbuf); if(rc != 0) rc = ER_FAIL; else rc = ER_OK; } if(rc == ER_OK && S_ISREG(statbuf.st_mode) ) { (void) ermetadb_add_document( g_metadb, file , statbuf.st_size , statbuf.st_mtime ); ermetadb_set_file_metadata( g_metadb, file, values); rc =ermetadb_close_database(g_metadb); } ret = rc; break; case ER_OK: ret =ermetadb_close_database(g_metadb); break; } } // clean up ermetadb_free(g_metadb); metadata_table_free(values); g_string_free(dir, TRUE); g_string_free(file, TRUE); return ret; } |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ended ended sale | bokjeid | Flea Market | 4 | 10-14-2010 10:21 PM |
DR1000 How can I (re)create DR1000S friendly pdfs?? | sarikan | iRex | 5 | 09-09-2010 11:05 AM |
File Path | iceman00 | Calibre | 6 | 04-24-2010 04:35 PM |
Save to Disk now saving file with full path? | Mnementh | Calibre | 3 | 09-14-2009 01:24 AM |
Remove file path from PDF file | DuckDodgers | 1 | 08-13-2006 09:23 AM |