Download and use local copies of assets in logseq after importing a file from Roam.
Project description
logseq-migration
Download and use local copies of assets in logseq after importing a file from roam.
Roam stores the assets (images, pdfs, mp4 files etc.) in the cloud.
While logseq
makes it easy for you to import a roam json
export, your assets will remain in the cloud.
That worries me, because
- I want to store all the data that I own in my local file system.
- I want to be able to view my pages even if I am not connected to the Internet.
- The assets could disappear if roam research ceased trading or changed its policy about closed accounts.
So I adapted the code from here
to suit logseq
instead of Obsidian
, wrote some minimal tests and refactored the code.
It's currently beta software
It's had limited testing, but it worked for me on a graph with about 1800 nodes.
Once installed, you can run the code each time you want to process a recently imported roam graph.
Since the program messes with the markdown in your pages (in order to make asset links local),
back up your graph before you run this code!
The application is easy to install and run. You'll find instructions below.
Installation
For now, you'll need to
- Install required software,
- Download this code as a zip file,
- Unzip the file, and
- Run the migration command by hand whenver you need to process a newly imported graph.
Install required software
Python 3
The code is written in Python, and you will need an installed copy of Python3.8 or later.
If you don't already have a suitable copy of Python installed, you'll find installation instructions here.
pip3
pip
is Python's package manager. You'll need pip3
, the version that supports Python3.
This is normally installed with Python3. If it isn't for some reason you can follow these instructions.
The requests
package
requests
is a 3rd part library which simplifies downloading data from the web.
it is used by the logseq-migration
application.
To install it, type pip3 install requests
in a command/terminal window.
Download the zip file
(If you're a GitHub user, you can clone the repository instead.
In that case the directory mentioned below will be logseq-migration
).
In a browser, go to this page.
In the window, click on the green Code
button.
A dialog box will open.
Click on Download zip
.
Your browser should download the zip file.
Unzip the file in a directory of your choice.
It will create and fill a sub-directory called logseq-migrarion-master
Now, each time you want to localize the assets in a graph that you've just imported from roam, follow the steps below to run the application
Run the application
cd logseq-migration-master/src
python3 migrater.py <vault-directory>
where vault-directory
is the directory in which your logseq
graph lives.
You should see a list of the firebase urls and the asset file names as they are saved.
The code is idempotent. In other words, if you run it two or more times, nothing should change after the first run.
Let me know how you get on, and please raise an issue if there are problems or you want to suggest new features.
There's a roadmap and a project journal. If you're interested in contributing, get in touch. Help is always welcome!
I'm @rareblog on Twitter.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for logseq_migration-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f31c1a5f05c0e5fe2c650d67256e7d3133c4ca8c0e18b8085cf13731349651c9 |
|
MD5 | 3200efb6c28bf1631a17cca26d86996f |
|
BLAKE2b-256 | eef464eeec76d6efa2257b1a9dadb328dadb3a5cac7d8aaeb63cc3afbc92acc0 |