{"action":"created","issue":{"url":"https://api.github.com/repos/aadsm/jsmediatags/issues/39","repository_url":"https://api.github.com/repos/aadsm/jsmediatags","labels_url":"https://api.github.com/repos/aadsm/jsmediatags/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/aadsm/jsmediatags/issues/39/comments","events_url":"https://api.github.com/repos/aadsm/jsmediatags/issues/39/events","html_url":"https://github.com/aadsm/jsmediatags/issues/39","id":188371759,"number":39,"title":"No Suitable FileReader Found   Apache Cordova/Angularjs","user":{"login":"siddmegadeth","id":5025324,"avatar_url":"https://avatars2.githubusercontent.com/u/5025324?v=3","gravatar_id":"","url":"https://api.github.com/users/siddmegadeth","html_url":"https://github.com/siddmegadeth","followers_url":"https://api.github.com/users/siddmegadeth/followers","following_url":"https://api.github.com/users/siddmegadeth/following{/other_user}","gists_url":"https://api.github.com/users/siddmegadeth/gists{/gist_id}","starred_url":"https://api.github.com/users/siddmegadeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/siddmegadeth/subscriptions","organizations_url":"https://api.github.com/users/siddmegadeth/orgs","repos_url":"https://api.github.com/users/siddmegadeth/repos","events_url":"https://api.github.com/users/siddmegadeth/events{/privacy}","received_events_url":"https://api.github.com/users/siddmegadeth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-09T22:42:05Z","updated_at":"2017-05-30T18:07:39Z","closed_at":null,"body":"Hi,\r\n\r\nI have written a file scanner for cordova android. It works as expexted and fetch me the files from both sdcard and internal memory.\r\n\r\nBut the problem is i am not able to extract the mp3 TAG info. This has become a real pain\r\n\r\nPlease find my code\r\n```\r\n\r\nscan : function(url,fileType)\r\n\t\t{\r\n                   log = console.log.bind(console);\r\n                   var defer = $q.defer();\r\n\r\n\t\t\tif(window.cordova)\r\n\t\t\t{\r\n\r\n\t\t\t\t\tvar fileTypeCollection = [];\r\n\r\n\t\t\t\t\turl.forEach(function(element, index) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t//requestLocalFileSystemURL\r\n\t\t\t\t\tlog(element);\r\n\t\t\t\t\twindow.resolveLocalFileSystemURL(element,onRequestFileSystem, fail);\r\n\r\n\t\t\t\t\t//log(\"Ends resolve\");\r\n\t\t\t\t\t});\r\n\r\n\r\n\t\t\t\t\tfunction onRequestFileSystem(fileSystem) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t//log(fileSystem.toURL());\r\n\t\t\t\t\t//log(fileSystem.toInternalURL());\r\n\t\t\t\t\tvar directoryReader = fileSystem.createReader();\r\n\t\t\t\t\tdirectoryReader.readEntries(onReadEntries,fail);\r\n\r\n\r\n\t\t\t\t\t} /*onRequestFile Ends*/\r\n\r\n\t\t\t\t\tfunction onReadEntries(entries) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\r\n\r\n\r\n\t\t\t\t\tentries.forEach( function(element, index) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (element.isDirectory === true) \r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t// Recursive -- call back into this subdirectory\r\n\t\t\t\t\t\t\tonRequestFileSystem(element);\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\telse if(element.isFile == true) \r\n\t\t\t\t\t\t{\r\n\r\n\t\t\t\t\t\tfileType.forEach(function(type)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tif(element.name.indexOf(type) != -1)\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tlog(element.name);\r\n\t\t\t\t\t\t\t\tlog(element.fullPath);\r\n\t\t\t\t\t\t\t\t \r\n                                jsmediatags.read(element.name, \r\n                                {\r\n                                    onSuccess: function(tag) \r\n                                    {\r\n                                      var title = tag.tags.title;\r\n                                      var author = tag.tags.author;\r\n                                      log(tag);\r\n                                      // Pour obtenir la durée du son, cf après          \r\n                                    },\r\n                                    onError: function(error) \r\n                                    {\r\n                                      log(error);\r\n                                    }\r\n                                });\r\n\r\n\t\t\t\t\t\t\t\tlog(element.toURL());\r\n\t\t\t\t\t\t\t\t//callback(fileTypeCollection);\r\n\t\t\t\t\t\t\t\tfileTypeCollection.push(element);\r\n\t\t\t\t\t\t\t\tdefer.resolve(fileTypeCollection);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t });\t\r\n\t\t\t\t\t} /*is File ENds*/\r\n\r\n\t\t\t\t\t});  /*Entries For Each Ends*/\r\n\r\n\t\t\t\t\t}  /*OnRead Ends*/\r\n\r\n\t\t\t\t\tfunction fail(resp)\r\n\t\t\t\t\t{\r\n\t\t\t\t\tlog(resp);\r\n\t\t\t\t\tdefer.resolve(fileTypeCollection);\r\n\r\n\t\t\t\t\t}  /*Fail Ends*/\r\n\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tlog(\"No Cordova Installed.Cannot Seek File\");\r\n\t\t\t\tdefer.reject();\r\n\t\t\t\t//callback(undefined);\r\n\r\n\t\t\t}\r\n\t\t\t//log(fileTypeCollection);\r\n\t\t\t//log(\"Before Resolve\");\r\n\t\t\treturn  defer.promise;\r\n\r\n\t\t},  //Scan Function Ends\r\n```\r\n\r\nI even tried to use JS-ID3-READER suggestion for cordova and it is also not working\r\n\r\nID3.loadTags(element.name, function() {\r\n    var tags = ID3.getAllTags(element.name);\r\n    log(tags.comment + \" - \" + tags.track + \", \" + tags.lyrics);\r\n}, {\r\n    dataReader: ID3.FileAPIReader(element)\r\n});\r\n\r\n\r\nThis is the affected code. For my whole media scanner please refer to the below link\r\n[https://github.com/siddmegadeth/Cordova-Media-Scanner]\r\n\r\n\r\nPlease suggest. The ID3 Reader does not read .\r\n "},"comment":{"url":"https://api.github.com/repos/aadsm/jsmediatags/issues/comments/304961104","html_url":"https://github.com/aadsm/jsmediatags/issues/39#issuecomment-304961104","issue_url":"https://api.github.com/repos/aadsm/jsmediatags/issues/39","id":304961104,"user":{"login":"RoboDurden","id":12238841,"avatar_url":"https://avatars1.githubusercontent.com/u/12238841?v=3","gravatar_id":"","url":"https://api.github.com/users/RoboDurden","html_url":"https://github.com/RoboDurden","followers_url":"https://api.github.com/users/RoboDurden/followers","following_url":"https://api.github.com/users/RoboDurden/following{/other_user}","gists_url":"https://api.github.com/users/RoboDurden/gists{/gist_id}","starred_url":"https://api.github.com/users/RoboDurden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RoboDurden/subscriptions","organizations_url":"https://api.github.com/users/RoboDurden/orgs","repos_url":"https://api.github.com/users/RoboDurden/repos","events_url":"https://api.github.com/users/RoboDurden/events{/privacy}","received_events_url":"https://api.github.com/users/RoboDurden/received_events","type":"User","site_admin":false},"created_at":"2017-05-30T18:07:39Z","updated_at":"2017-05-30T18:07:39Z","body":"Okay i got confused by the confusing Cordova classes. This works (copied out of a bigger project..):\r\n\r\n```\r\nFolderID3 = function (sPath, o, rCallback)\r\n{\r\n\t//sPath = \"Music/ccMixter//\";\r\n\tif (rCallback) o.rCallback = rCallback;\r\n\tvar no = _No.bind(o);\r\n\twindow.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + sPath,\r\n\tfunction (dir)\r\n\t{\r\n\t\tvar reader = dir.createReader();\r\n\t\treader.readEntries(function (entries)\r\n\t\t{\r\n\t\t\tentries.forEach(function (entry)\r\n\t\t\t{\r\n\t\t\t\tentry.file(function (file)\r\n\t\t\t\t{\r\n\t\t\t\t\twindow.jsmediatags.read(file, {\r\n\t\t\t\t\t\tonSuccess: function (tag)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tconsole.log(tag);\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tonError: _No\r\n\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});\r\n\t}, _No);\r\n}\r\n\r\nFileID3 = function (sPath, o, rCallback)\r\n{\r\n\tif (rCallback) o.rCallback = rCallback;\r\n\tvar no = _No.bind(o);\r\n\twindow.resolveLocalFileSystemURL(sPath, function (oFile)\r\n\t{\r\n\t\toFile.file(function (file)\r\n\t\t{\r\n\t\t\twindow.jsmediatags.read(file, {\r\n\t\t\t\tonSuccess: function (tag)\r\n\t\t\t\t{\r\n\t\t\t\t\tconsole.log(tag);\r\n\t\t\t\t},\r\n\t\t\t\tonError: _No\r\n\t\t\t});\r\n\t\t});\r\n\t}, no);\r\n}\r\n\r\nfunction _No(e)\r\n{\r\n\tthis.oError = e;\r\n\tthis.rCallback(this);\r\n}\r\n\r\n````\r\n\r\nThank you António :-)"}}
{"actor":{"display_login":"RoboDurden"}}