Dtube community support - update - new features and code improvement
Introduction
Dtube is a video plateform based on the steem blockchain that store videos on IPFS. Because most of users doesn't use ipfs. Dtube is a central point that will store content on IPFS node.
Dtube community support is a bot that will "listen" for new dtube content for a specific steem tag and store the video on a local IPFS node. Plus it stores metadata about dtube content like title (steem post) / video size / permlink / author. The main goad is to persist dtube content of your favorite community on IPFS.
DCS will retrieve 480p videos. if not available, it will retrieve the source file.
New-features
here is the list of new features :
- List all content (by date, by size, by author)
- List all content with a markdown format
- Add specific content based on the dtube url
- remove specific content based on the pinset
- failover script
- log file for the collector
README contains more informations about the usage.
About the failover script
In the first version, DCS was configured by default on 'api.steemit.com'. I have added a failover script to use another api endpoint (in the config.json)
Failover script function (utils/utils.js)
exports.failover = function() {
if(config.rpc_nodes && config.rpc_nodes.length > 1) {
var cur_node_index = config.rpc_nodes.indexOf(steem.api.options.url) + 1;
if(cur_node_index == config.rpc_nodes.length)
cur_node_index = 0;
var rpc_node = config.rpc_nodes[cur_node_index];
steem.api.setOptions({ transport: 'http', uri: rpc_node, url: rpc_node });
}
}
Plus, api endpoint is randomly selected at startup.
steem.api.setOptions({ transport: 'http', uri: config.rpc_nodes.random(), url: config.rpc_nodes.random() });
Array.prototype.random = function () {
return this[Math.floor((Math.random()*this.length))];
}
code structure
index.js is used for the collector.
app.js is a collection of command that will be used manually by the user to query, add and delete content :
- action/list.js : used to return the content stored
- action/add.js : used to add manually specific content
- action/del.js : used to delete manually specific content
The following script has been declared in the package.json :
- start : start the colletor
- list : list all content
- listAuthor : list all content for the specified author (passed in argument)
- show : Display metadata for the specified pinset (passed in arguent)
- report : Display content in markdown format
- add : Manually add content for the specified dtube url (passed in argument)
- rm : Manuelly remove content for the specified pinset (passed in argument)
Github
- Repo : https://github.com/evildido/dtube-community-support
- PR : https://github.com/evildido/dtube-community-support/pull/5
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @evildido I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x