add CouchDB view for file-type stats
[mygpo.git] / couchdb / _design / episode_stats / views / filetypes / map.js
blobfa9a6d514160b7ca70192338f4f0ebbc5a03114b
1 function(doc)
3     if(doc.doc_type == "Episode")
4     {
5         for(var n in doc.urls)
6         {
7             var url = doc.urls[n];
8             var i = url.lastIndexOf(".");
10             if(i >= 0)
11             {
12                 /* exclude the dot */
13                 var ext = url.substr(i+1);
15                 /* make sure we exclude obvious non-extensions */
16                 if (ext.length < 10)
17                 {
18                     emit(ext, url);
19                 }
20             }
21         }
22     }