How to use external (local) files, attachments on Windows?

124 views
Skip to first unread message

bimlas

unread,
Jan 28, 2019, 2:17:11 PM1/28/19
to TiddlyWiki
I like to use local (audio) files in Node Tiddly on Windows, but I cannot let it work.

I made a directory (./mp3) in the wiki's main directory (where tiddlywiki.info exists), copied the audio files to it.

- I tried to create a tiddler, set `_canonical_uri` (`./mp3/mysound.mp3`), the player appeared but could not play the file.
- I followed the instructions of https://tiddlywiki.com/#tiddlywiki.files%20Files -> "Importing a folder of PDFs", but when I was looking for tiddlers (which is created by Tiddly automatically, if I understand right), I couldn't find them.

Can someone help me to get local files (family photos, music, etc.) to work? Can I automate the process of adding new files to the wiki (taking new photos)?

bimlas

unread,
Jan 29, 2019, 3:12:30 AM1/29/19
to TiddlyWiki
Half-working:

On the one hand, I misunderstood the documentation and "directories" was written to tiddlywiki.info instead of tiddlywiki.files. On the other hand, I placed the tiddlywiki.files file in the main directory (where tiddlywiki.info is), not in a subdirectory inside "tiddlers". Anyway, the tiddlers of the audio files are created.

mywiki/tiddlers/audio/tiddlywiki.files (based on https://tiddlywiki.com/#tiddlywiki.files%20Files)

{
  "directories": [
    {
      "path": "./mp3/",
      "filesRegExp": "^.*\\.mp3$",
      "isTiddlerFile": false,
      "fields": {
        "title": {"source": "basename-uri-decoded"},
        "created": {"source": "created"},
        "modified": {"source": "modified"},
        "type": "audio/mp3",
        "tags": ["audio"],
        "text": "",
        "_canonical_uri": {"source": "filename", "prefix": "audio/mp3/"}
      }
    }
  ]
}

The mp3 files are in "mywiki/tiddlers/audio/mp3/" subdirectory. 

BTW playing the sounds not works. For example the "_canonical_uri" of a file is "audio/mp3/Caruso-AveMaria.mp3" which can't be found (clicking on the link in edit mode drops 404). I've tried to change to "./audio/mp3/Caruso-AveMaria.mp3" ("./" prefix) and others like these as well, but still not works.

The description of the "_canonical_uri" says it's "The full URI of an external image tiddler" (Control Panel -> Info -> Advanced -> Tiddler Fields), but "filename" does not sets the full URI to "_canonical_uri" and there is no way to get the full path of file (search for "basename-uri-decoded" on https://tiddlywiki.com/#%24%3A%2Fboot%2Fboot.js to see the possible values of "source" in "_canonical_uri").

Question: how to set up tiddlywiki.files to access to local files?

bimlas

unread,
Jan 29, 2019, 4:48:29 AM1/29/19
to TiddlyWiki
I'm a bit confused about the documentation...

* The description of "_canonical_uri" says it's the "The full URI of an external image tiddler"
* The tiddlywiki.files example on https://tiddlywiki.com/#tiddlywiki.files%20Files using relative paths
* It's possible to use relative paths, but you have to set <base> manually first: https://groups.google.com/forum/#!msg/Tiddlywiki/5wsPT7gGd58/eqkvDpgaBQAJ (and you have to modify always when you viewing the wiki on different machines)

Is there anybody who made _canonical_uri with tiddlywiki.files work?

bimlas

unread,
Jan 29, 2019, 7:36:11 AM1/29/19
to TiddlyWiki
Ok, I'm almost done:

The directory structure:

|   tiddlywiki.info
|
+---files
|   \---audio
|           Caruso-AveMaria.mp3
|
\---tiddlers
   
|   $__StoryList.tid
   
|
   
\---audio
            tiddlywiki
.files

Everything in the `files` directory is available on http://127.0.0.1/files/ thus relative URLs working. The contents of tiddlywiki.files is:

{
   
"directories": [
       
{
           
"path": "../../files/audio",

           
"filesRegExp": "^.*\\.mp3$",
           
"isTiddlerFile": false,
           
"fields": {
               
"title": {"source": "basename-uri-decoded"},
               
"created": {"source": "created"},
               
"modified": {"source": "modified"},
               
"type": "audio/mp3",

               
"tags": ["Music"],
               
"text": "",
               
"_canonical_uri": {"source": "filename", "prefix": "./files/audio/"}
           
}
       
}
   
]
}

One more issue (what I really don't understand): I cannot seek in the audio file (clicking on the "position" bar does nothing).

bimlas

unread,
Jan 29, 2019, 8:10:03 AM1/29/19
to TiddlyWiki
Seeking is a Chrome issue, see https://stackoverflow.com/a/9549404

TonyM

unread,
Jan 30, 2019, 12:08:56 AM1/30/19
to TiddlyWiki
Bimlas,

Thanks for sharing your "Journey".

Tony

S. S.

unread,
Jan 30, 2019, 12:18:20 AM1/30/19
to TiddlyWiki
Bimlas,

I believe you would have solved this faster if you were not listening to Enrico Caruso singing Ave Maria.
It put me to sleep!

Cheers!

bimlas

unread,
Jan 30, 2019, 1:39:45 AM1/30/19
to TiddlyWiki
S. S.

:D Maybe you're right. Hear me roar not to sleep. :)

bimlas

unread,
Jan 30, 2019, 1:50:04 AM1/30/19
to TiddlyWiki
My journey is over, but my question has not been answered: could anyone try to find out if the example works without "files" directory? Are local files available in wiki using tiddlywiki.files and relative _canonical_uri paths (as shown in the example at https://tiddlywiki.com/#tiddlywiki.files%20Files -> Importing a folder of PDFs)?

TonyM

unread,
Jan 30, 2019, 2:28:41 AM1/30/19
to TiddlyWiki
Bimlas,

Perhaps the places outside the files directory are no longer accessible.

Perhaps look in github for the original change?

I am quite sure people were using /images etc...

Regards
Tony
Reply all
Reply to author
Forward
0 new messages