{"id":17,"date":"2014-09-25T09:45:28","date_gmt":"2014-09-25T09:45:28","guid":{"rendered":"http:\/\/iict-space.heig-vd.ch\/mri\/?p=17"},"modified":"2014-09-25T09:47:49","modified_gmt":"2014-09-25T09:47:49","slug":"upload-any-kind-of-file-to-your-music-cloud-service","status":"publish","type":"post","link":"http:\/\/iict-space.heig-vd.ch\/mri\/2014\/09\/25\/upload-any-kind-of-file-to-your-music-cloud-service\/","title":{"rendered":"Upload any Kind of File to Your Music Cloud Service"},"content":{"rendered":"<p style=\"color: #373737\">Music in the cloud, a new kind of cloud service, has become very popular over the last couple of years.<\/p>\n<p style=\"color: #373737\">It makes sense. It helps free valuable portable space on smartphones, it facilitates the sharing of music with family and friends and most importantly,\u00a0It\u2019s much cheaper than regular cloud storage. In some cases, as with\u00a0<a style=\"color: #1982d1\" href=\"http:\/\/play.google.com\/music\/\">Google Music<\/a>, it\u2019s free.<\/p>\n<p style=\"color: #373737\">Theoretically, when you pay for this kind of service, you\u2019re buying extremely cheap cloud storage space. In the case of Google, you\u2019re even getting it for free. Let\u2019s see:<\/p>\n<p>Of course, this makes sense for service providers because in most cases, people use these services to store music in the form of MP3 files. If a file is already contained in the service provider\u2019s catalog, there\u2019s no need to even upload it from the client\u2019s computer. And one single copy of this MP3 can serve millions of happy customers. In the end, only a small fraction of all that theoretical space is actually occupied.<\/p>\n<p>What I would like to show your here is how we can teach a new trick to our music-in-the-cloud-services in order to make them accept, not only MP3 files, but any kind of file.<\/p>\n<p>I know what you\u2019re probably thinking: \u201cLet\u2019s take any file and change the extension to MP3\u2033<\/p>\n<p>Genius, right?\u2026 wrong\u2026 In fact, these services are a little smarter than that. They all expect you to upload music. So we need to do some work on our files before we can upload them to the cloud. Here\u2019s how it really works:<\/p>\n<p><a href=\"http:\/\/iict-space.heig-vd.ch\/mri\/wp-content\/uploads\/sites\/3\/2014\/09\/sizes.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-19\" src=\"http:\/\/iict-space.heig-vd.ch\/mri\/wp-content\/uploads\/sites\/3\/2014\/09\/sizes-300x76.png\" alt=\"sizes\" width=\"532\" height=\"150\" \/><\/a><\/p>\n<p>An MP3 file has a very specific\u00a0<a style=\"color: #1982d1\" title=\"MP3 file structure\" href=\"http:\/\/en.wikipedia.org\/wiki\/MP3#File_structure\" target=\"_blank\">structure<\/a>. It is composed of several frames, each of them preceded by a header. The header contains information about the MP3 version, the bit-rate, the frequency and some other meaningful information. Metadata is optionally added to the file by means of ID tags.<\/p>\n<p>I wrote a Python script that wraps any file into an MP3 disguise. It does this by cutting the data in chunks of very specific size, adding the necessary headers, putting the frames together and finally, adding an ID tag to store information about the original binary file. If the file is to large, the script cuts it into pieces and then wraps each piece as an MP3 file. Each chunk is marked using the track information contained in the ID tag.<\/p>\n<p>By default, the script marks the files with the Artist name \u201cFake MP3 Encoder\u201d and the Album name \u201cMy Data in the Music Cloud\u201d. Both values can be changed directly from the command line. Album artwork is also added to the file to help identify more easily the Album containing your wrapped files in iTunes, Google Music or Amazon Cloud Player.<\/p>\n<p>So this is my wrapper:<\/p>\n<p><a href=\"http:\/\/iict-space.heig-vd.ch\/mri\/wp-content\/uploads\/sites\/3\/2014\/09\/code2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-18\" src=\"http:\/\/iict-space.heig-vd.ch\/mri\/wp-content\/uploads\/sites\/3\/2014\/09\/code2-278x300.png\" alt=\"code2\" width=\"448\" height=\"482\" srcset=\"http:\/\/iict-space.heig-vd.ch\/mri\/wp-content\/uploads\/sites\/11\/2014\/09\/code2-278x300.png 278w, http:\/\/iict-space.heig-vd.ch\/mri\/wp-content\/uploads\/sites\/11\/2014\/09\/code2.png 893w\" sizes=\"(max-width: 448px) 100vw, 448px\" \/><\/a>&#8230;<\/p>\n<p>&#8230;..<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Music in the cloud, a new kind of cloud service, has become very popular over the last couple of years. It makes sense. It helps free valuable portable space on smartphones, it facilitates the sharing of music with family and <a class=\"more-link\" href=\"http:\/\/iict-space.heig-vd.ch\/mri\/2014\/09\/25\/upload-any-kind-of-file-to-your-music-cloud-service\/\">Continue reading <span class=\"screen-reader-text\">  Upload any Kind of File to Your Music Cloud Service<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[8,6,9,7,5],"_links":{"self":[{"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/posts\/17"}],"collection":[{"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/comments?post=17"}],"version-history":[{"count":1,"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":20,"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/posts\/17\/revisions\/20"}],"wp:attachment":[{"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/iict-space.heig-vd.ch\/mri\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}