Command Line Network Import - where to find the channel ID's

The last section of the Kolibri documentation describes command line utilities, one for network import:

kolibri manage importchannel – network Channel_ID

I was wondering how to get a list of Channel ID’s and names?

To get a list of locally active channels one can use :

sqlite3 ‘file:$KOLIBRI_HOME/.kolibri/db.sqlite3?mode=ro’ ‘SELECT name,id FROM content_channelmetadata’

What I would like is a list of {name,id} for all available channels. Is there a url for the Central Server that would provide this information?

Hi nobicycle,

I’ll PM you directly for accessing this information on Studio.

Best,
Laura

1 Like

Hi again Laura,
The URL you gave me no longer works. Not sure why you used a PM last time, so I won’t print the URL you gave me. However it does not work now.

Regards

Hi nobicycle,

Which link wasn’t working for you? I’m following up over PM as we haven’t publicly announced Kolibri Studio yet. Let me know if I can assist further.

Best,
Laura

This answer is quite old, but I did not find another one.

On Internet in a Box there is functionality to bulk load content in Ka-lite by language and any node in the content tree by reading the content meta data, traversing the tree, and downloading individual videos.

In Kolibri there is kolibri manage importchannel network .

I do not see how to get the channel ID.

Is it what is in the url, such as http://192.168.3.162/kolibri/en/device/#/content/channels/c1f2b7e6ac9f56a2bb44fa7a48b66dce?node_id=463e348d658355489b2bf7134518d3ba?

For public channels does it remain constant?

Is there a public API to get all content?

In the above example from ES Khan Academy I have drilled down to a single topic. Is there a syntax for importchannel that allows me to import less than an entire channel?

Hi @Tim,

There is a public API on Studio to retrieve all the of the public channels. It is available here:

https://studio.learningequality.org/api/public/v1/channels

These channel ids are stable for public channels, except in extreme circumstances. In the last 6 years there has only been a single instance where we have had to change the id of a public channel when doing an update, so you should be able to rely on this.

importchannel only imports the channel metadata, not the content.

You will also need to use the importcontent command to import resources. (the use of both of these commands is described here: Working with Kolibri from the command line — Kolibri User Guide)

What is not documented above is the ability to use --node_ids <node_id1>,<node_id2>... to only include specific folders/resources (if you specify a folder it will also import all descendant folders and resources), this can also be combined with --exclude_node_ids <node_id3>,<node_id4>... to exclude specific folders or resources.

Hope this helps! For more details, the best reference is the management command itself: kolibri/importcontent.py at release-v0.15.x · learningequality/kolibri · GitHub

Kind Regards,
Richard

That helps a great deal. How stable are the node_ids for public channels, especially Khan Academy? And how do I look them up (without manually accessing each url like above)?

For example I can set the following json for the iiab kalite loader and it will look up the assets in the database as well as compute the storage requirements.

“kalite”: {
“lang_code”: “es”,
“topics”: [“khan/math/trigonometry/trigonometry-right-triangles/”,
“khan/math/trigonometry/trig-with-general-triangles/”,
“khan/math/trigonometry/unit-circle-trig-func/”
]

The ids for nodes in public channels are also stable, as they are based off a predictable hash of the source that would only change if the source channel changed its unique identifiers.

In terms of getting them, they would have to be accessed either via the UI, the API, or by inspecting the channel database through a tool like SQLiteBrowser, for example.

by API do you mean https://studio.learningequality.org/api/public/v1/channels? I don’t see any node_ids.

I tried to follow kolibri/api_endpoints.rst at develop · learningequality/kolibri · GitHub
with
https://studio.learningequality.org/api/public/v1/channels/contentnode?search=Seguridad%20en%20Internet

But I am clearly just guessing.

Also
kolibri manage importchannel network c1f2b7e6ac9f56a2bb44fa7a48b66dce
seemed to work
but kolibri manage importcontent network c1f2b7e6ac9f56a2bb44fa7a48b66dce --node-ids 463e348d658355489b2bf7134518d3ba
yields
kolibri manage importcontent: error: unrecognized arguments: --node-ids 463e348d658355489b2bf7134518d3ba

Apologies, I made a typo, it should be --node_ids and --exclude_node_ids. I’ll correct the original post.

The APIs I was referring to were the internal ones used by Kolibri to navigate the topic tree in the import UI.

However, it may be simpler to just get the ids from the URLs as you are navigating the UI, this should be fairly straight forward if you want to import three specific topics.

kolibri manage importcontent: error: unrecognized arguments: --node_ids 463e348d658355489b2bf7134518d3ba

Are they preceding the network <channel_id> argument? See here for the code comment documenting this: kolibri/importcontent.py at release-v0.15.x · learningequality/kolibri · GitHub

kolibri manage importcontent --node_ids 463e348d658355489b2bf7134518d3ba network c1f2b7e6ac9f56a2bb44fa7a48b66dce works. had node_ids at the end.

but I don’t see the content. only the one I imported with studio.

tried restarting Kolibri but ES content still not there

the output was

INFO 2023-03-21 19:18:30,308 Setting availability to True of 81 LocalFile objects based on passed in checksums
INFO 2023-03-21 19:18:30,344 Setting availability of non-topic ContentNode objects based on LocalFile availability in 6 batches of 10000
INFO 2023-03-21 19:18:30,460 Annotating ContentNode objects with children for 6 levels
INFO 2023-03-21 19:18:30,593 Annotating ContentNode objects with children for level 6
INFO 2023-03-21 19:18:30,596 Annotating ContentNode objects with children for level 5
INFO 2023-03-21 19:18:30,617 Annotating ContentNode objects with children for level 4
INFO 2023-03-21 19:18:30,626 Annotating ContentNode objects with children for level 3
INFO 2023-03-21 19:18:30,629 Annotating ContentNode objects with children for level 2
INFO 2023-03-21 19:18:30,630 Annotating ContentNode objects with children for level 1

OK. I suspect the problem is with KOLIBRI_HOME not being set properly.