[tw] Re: Dynamic display and editing of metadata using TiddlyWiki
okido, That's good to hear. I'll be anxiously following your progress. David On Aug 4, 7:09 pm, okido bkn...@gmail.com wrote: Hi Kanyimbe, I am working on a plugin that can generate tiddlers with the filenames from files in a directory. A list is made of tiddlers that exist's but the file is missing. It is partly based on the code from Eric Schulman's pluginhttp://www.tiddlytools.com/#ShowLocalDirectory. It is not a working plugin yet but you might try the code below by simply pasting it in a tiddler, you need the inlinejavascript plugin from Tiddlytools and be aware of google line breaks. Opening and closing the tiddler starts the process, be CAREFUL there are no safeguards build in, make sure you have a backup in case something goes wrong. The docs are expected to be in a sub-directory with the name docs. Reading the metadata from files is something that I have been thinking of and this should be possible from TW but it takes some major coding. Goodluck, Okido script { // store.deleteTiddler('test.pdf'); // store.deleteTiddler('test_1.pdf'); var out = []; var tagslist = 'newdocs docs'; // tags that are added to tiddler var path = 'docs'; // directory name var user_name = 'Yourname'; var tot = 0; window.getCurrentFolder=function() { var h=document.location.href; return getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf(/)+1))); } window.getParentFolder=function(cwd) { var lastchar=cwd.substr(cwd.length-1,1); if (lastchar==/ || lastchar==\\) cwd=cwd.substr(0,cwd.length-1); var pos=cwd.lastIndexOf(/); if (pos==-1) pos=cwd.lastIndexOf(\ \); return pos!=-1?cwd.substr(0,pos+1):null; } window.getFileList=function(cwd) { // returns array of file info (path,name,size,isFolder,url,modified) var files=[]; if (config.browser.isIE) { cwd=cwd.replace(/\//g,\\); var fso = new ActiveXObject(Scripting.FileSystemObject); if(!fso.FolderExists(cwd)) return []; var dir=fso.GetFolder(cwd); for(var f=new Enumerator(dir.SubFolders); !f.atEnd(); f.moveNext()) files.push({ path:f.item().path, name:f.item().name, size:f.item().size, url:file:///+f.item().path.replace(/\\/g,/), isFolder:fso.FolderExists(f.item().path), modified:new Date(f.item().DateLastModified).formatString(. 0MM.0DD 0hh:0mm:0ss)}); for(var f=new Enumerator(dir.Files); !f.atEnd(); f.moveNext()) files.push({ path:f.item().path, name:f.item().name, size:f.item().size, url:file:///+f.item().path.replace(/\\/g,/), isFolder:fso.FolderExists(f.item().path), modified:new Date(f.item().DateLastModified).formatString(. 0MM.0DD 0hh:0mm:0ss)}); } else { // FF if(!window.Components) return; try { netscape.security.PrivilegeManager.enablePrivilege(UniversalXPConnect); } catch(e) { alert(e.description?e.description:e.toString()); return null; } var file=Components.classes[@mozilla.org/file/local; 1].createInstance(Components.interfaces.nsILocalFile); try { file.initWithPath(cwd); } catch(e) { return []; } if (!file.exists() || !file.isDirectory()) { return []; } var folder=file.directoryEntries; while (folder.hasMoreElements()) { var f=folder.getNext().QueryInterface(Components.interfaces.nsILocalFile); if (f instanceof Components.interfaces.nsILocalFile) files.push({path:f.path, name:f.leafName, size:f.fileSize, isFolder:f.isDirectory(), url:file:///+f.path.replace(/\\/ g,/), modified:new Date(f.lastModifiedTime).formatString(.0MM.0DD 0hh:0mm:0ss)}); } } return files; } listresults = function() { out.push('!Linker Report'); out.push('Path used: ' + cwd ); out.push('Number of files in path: ' + files.length); out.push('Tag added: ' + tagslist ); out.push('Username: ' + user_name ); out.push('!!Added tiddlers'); } date_conv = function(date) { // convert file date to TW date format date = date.replace(' ','.'); date = date.split('.'); return new
[tw] Re: Dynamic display and editing of metadata using TiddlyWiki
Hi Kanyimbe, I am working on a plugin that can generate tiddlers with the filenames from files in a directory. A list is made of tiddlers that exist's but the file is missing. It is partly based on the code from Eric Schulman's plugin http://www.tiddlytools.com/#ShowLocalDirectory. It is not a working plugin yet but you might try the code below by simply pasting it in a tiddler, you need the inlinejavascript plugin from Tiddlytools and be aware of google line breaks. Opening and closing the tiddler starts the process, be CAREFUL there are no safeguards build in, make sure you have a backup in case something goes wrong. The docs are expected to be in a sub-directory with the name docs. Reading the metadata from files is something that I have been thinking of and this should be possible from TW but it takes some major coding. Goodluck, Okido script { // store.deleteTiddler('test.pdf'); // store.deleteTiddler('test_1.pdf'); var out = []; var tagslist = 'newdocs docs'; // tags that are added to tiddler var path = 'docs'; // directory name var user_name = 'Yourname'; var tot = 0; window.getCurrentFolder=function() { var h=document.location.href; return getLocalPath(decodeURIComponent(h.substr(0,h.lastIndexOf(/)+1))); } window.getParentFolder=function(cwd) { var lastchar=cwd.substr(cwd.length-1,1); if (lastchar==/ || lastchar==\\) cwd=cwd.substr(0,cwd.length-1); var pos=cwd.lastIndexOf(/); if (pos==-1) pos=cwd.lastIndexOf(\ \); return pos!=-1?cwd.substr(0,pos+1):null; } window.getFileList=function(cwd) { // returns array of file info (path,name,size,isFolder,url,modified) var files=[]; if (config.browser.isIE) { cwd=cwd.replace(/\//g,\\); var fso = new ActiveXObject(Scripting.FileSystemObject); if(!fso.FolderExists(cwd)) return []; var dir=fso.GetFolder(cwd); for(var f=new Enumerator(dir.SubFolders); !f.atEnd(); f.moveNext()) files.push({ path:f.item().path, name:f.item().name, size:f.item().size, url:file:///+f.item().path.replace(/\\/g,/), isFolder:fso.FolderExists(f.item().path), modified:new Date(f.item().DateLastModified).formatString(. 0MM.0DD 0hh:0mm:0ss)}); for(var f=new Enumerator(dir.Files); !f.atEnd(); f.moveNext()) files.push({ path:f.item().path, name:f.item().name, size:f.item().size, url:file:///+f.item().path.replace(/\\/g,/), isFolder:fso.FolderExists(f.item().path), modified:new Date(f.item().DateLastModified).formatString(. 0MM.0DD 0hh:0mm:0ss)}); } else { // FF if(!window.Components) return; try { netscape.security.PrivilegeManager.enablePrivilege(UniversalXPConnect); } catch(e) { alert(e.description?e.description:e.toString()); return null; } var file=Components.classes[@mozilla.org/file/local; 1].createInstance(Components.interfaces.nsILocalFile); try { file.initWithPath(cwd); } catch(e) { return []; } if (!file.exists() || !file.isDirectory()) { return []; } var folder=file.directoryEntries; while (folder.hasMoreElements()) { var f=folder.getNext().QueryInterface(Components.interfaces.nsILocalFile); if (f instanceof Components.interfaces.nsILocalFile) files.push({path:f.path, name:f.leafName, size:f.fileSize, isFolder:f.isDirectory(), url:file:///+f.path.replace(/\\/ g,/), modified:new Date(f.lastModifiedTime).formatString(.0MM.0DD 0hh:0mm:0ss)}); } } return files; } listresults = function() { out.push('!Linker Report'); out.push('Path used: ' + cwd ); out.push('Number of files in path: ' + files.length); out.push('Tag added: ' + tagslist ); out.push('Username: ' + user_name ); out.push('!!Added tiddlers'); } date_conv = function(date) {// convert file date to TW date format date = date.replace(' ','.'); date = date.split('.'); return new Date(date[0],date[1]-1,date[2]); // date of creation } write_tiddler = function(title,date) { out.push(tot++ + ' ' + '[[' + title + ']]' ); var newTitle = line[1]; // tiddler title var newBody = '[[' + title + '|docs/' + title +
[tw] Re: Dynamic display and editing of metadata using TiddlyWiki
Hi, There was a thread some time ago [1]. May be it is similar to your usecase. I think, you should directly contact AndyF who raised the discussions. May be he can help. Link [2] searches all threads from AndyF. I think he did, what he wanted. hope this helps -m [1] http://groups.google.com/group/tiddlywiki/browse_thread/thread/a43800c1bbc4a75/61ad4309774a2eb [2] http://groups.google.com/groups/search?hl=enenc_author=TJcFtRYAAABZQGlEvmK7CQQrqBCAEy2NPpumWr4uTGJoAu2GDNWgcgscoring=d On Jul 26, 3:19 pm, Kanyimbe kanyi...@gmail.com wrote: I'm struggling to create a system that allows you to create enriched directories of publications that work online and offline. Much of the filtering and searching that I can do online with PHP, etc. isn't an option for a folder full of publications on someone's thumb drive. So I thought using TiddlyWiki might provide an option. The system should be able to do the following: 1. Read and display the contents of a directory in a TiddlyWiki. 2. Extract metadata from each document and display it with the document name and link. 3. Allow grouping of publications by tags. 4. Allow searching. Originally i thought you should be able to have a TiddlyWiki that loaded each document's metadata into a separate tiddler every time you opened it. But it would also be nice to be able to add metadata to a document and then save it back to the metadata of the file. Example: In Mozambique we have publications for 12 different langauges. They are mostly PDFs. They have keywords like: literacy, linguistics, Scripture, and development. Since new publications appear and old ones are changed, it would be nice to have a tiddlywiki that just sits in each of the 12 language directories and updates itself every time you open it. We want to share these pubications online but also on a CD-ROM or by copying a folder to someone's thumb drive. Any ideas on how or whether this might work would be VERY appreciated. Background on this idea can be found here:http://kanyimbe.posterous.com/ubiqivos-ubiquitous-archives-for-vernac... -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlyw...@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
[tw] Re: Dynamic display and editing of metadata using TiddlyWiki
Thanks, Alex. I'll check out TiddlySpace. The ShowLocalDirectory plugin at least shows the contents of the directory. It displays size and modified, if it were able to pull Author/Artist and Keywords/Comments from mp3s and PDFs we'd be on our way. On 27 July, 09:02, Alex Hough r.a.ho...@gmail.com wrote: Have you looked at TiddlySpace? You could have a different space for each language, and include them together in other spaces. I'm no expert, but I think that extracting and editing PDF metadata with TW will be difficult. (I think tiddlytools has a plugin for importing plain text into tiddlers, so if you got your PDFs into plain text it could be an option to import them into TWs then import those into TiddlySpace) Also I have found mendeley[1] good for reading PDFs. It also renames them for you, and copies them into a file. You can sort / search them and annotate them too. Alexhttp://www.mendeley.com/ On 26 July 2010 14:19, Kanyimbe kanyi...@gmail.com wrote: I'm struggling to create a system that allows you to create enriched directories of publications that work online and offline. Much of the filtering and searching that I can do online with PHP, etc. isn't an option for a folder full of publications on someone's thumb drive. So I thought using TiddlyWiki might provide an option. The system should be able to do the following: 1. Read and display the contents of a directory in a TiddlyWiki. 2. Extract metadata from each document and display it with the document name and link. 3. Allow grouping of publications by tags. 4. Allow searching. Originally i thought you should be able to have a TiddlyWiki that loaded each document's metadata into a separate tiddler every time you opened it. But it would also be nice to be able to add metadata to a document and then save it back to the metadata of the file. Example: In Mozambique we have publications for 12 different langauges. They are mostly PDFs. They have keywords like: literacy, linguistics, Scripture, and development. Since new publications appear and old ones are changed, it would be nice to have a tiddlywiki that just sits in each of the 12 language directories and updates itself every time you open it. We want to share these pubications online but also on a CD-ROM or by copying a folder to someone's thumb drive. Any ideas on how or whether this might work would be VERY appreciated. Background on this idea can be found here: http://kanyimbe.posterous.com/ubiqivos-ubiquitous-archives-for-vernac... -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlyw...@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.comtiddlywiki%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en. -- You received this message because you are subscribed to the Google Groups TiddlyWiki group. To post to this group, send email to tiddlyw...@googlegroups.com. To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.