Musiphone - Decentralized Music Player







After creating a music storage, it was logical to make a player to listen to songs yourself and share playlists with others. A separate network is responsible for storing playlists . The songs are, by default, taken from the global music repository network . Optionally, you can elevate your networks using the required libraries.







I would like to divide my story into two parts:







1. Player from the inside ( musiphone , museria-player )







Inside, the player is a repository of information about playlists that can be saved there. A playlist is a list of song titles that has its own unique hash from the content, by which this playlist can be obtained in the future.







const Node = require('musiphone').Node;

(async () => { 
  try {
    const node = new Node({
      port: 4000,
      hostname: 'localhost',
      musicStorageAddress: 'storage.museria.com:80'
    });
    await node.init();
  }

  catch(err) {
    console.error(err.stack);
    process.exit(1);
  }
})();
      
      





const Client = require('musiphone').Client;

(async () => {
  try {
    const client = new Client({
      address: 'localhost:4000'
    });
    await client.init();
    const title = 'Playlist title';
    const songs = [
      'Onycs - Eden',
      'Onycs - Shine',
      'Onycs - Timeless' 
    ];
    // Add the playlist
    const response = await client.addPlaylist(title, songs);
    // Get the playlist
    const playlist = await client.getPlaylist(response.hash);
  }
  catch(err) {
    console.error(err.stack);
    process.exit(1);
  }
})();
      
      





Information circulates in the network depending on the free disk space on the nodes and the amount of data. If there are more playlists than there is enough space on the network, then the most rarely used of them will be deleted to free up space. On the one hand, this is good, because not very many servers may be needed for the network to work, but on the other hand, the fewer there are, the less the guarantee of the relevance of links to playlists.







It must be kept in mind that the system does not guarantee the permanent storage of data, therefore, for greater reliability, you can also save everything to files. This will be discussed in more detail in the second part.







metastocle. . .







2. (, android )







( , ). , cordova, .







, .







.













"NEW PLAYLIST". , . , , . , , "MUSIC STORAGE" , , .







, . "Onycs — Eden"













, , . .













. , , ... , - , localStorage. 







. "SAVE TO WEB".













.













, , /. , , , , . , .







, , . , , . . "NEW PLAYLIST". :













, , .













. "SAVE TO FILE". m3u .













, "LOAD PlAYLIST".













. , . :









, m3u .  m3u , . .













, localStorage. (json), "SAVE CONFIG", "LOAD CONFIG". , , . , , .







, 50-1000, 2 , 2 . , .







: 300 , 1 , 1 . — .







A group in telegram in English , or immediately write to me in a personal "ortex"








All Articles