--- Revision None +++ Revision 633333336437 @@ -0,0 +1,788 @@ +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32016.573>] 71.19.150.86 - - GET /mygpo/_design/users/_view/episode_states_by_user_episode?include_docs=true&limit=1&key=%5B%2219d601e09560c3096c857dc97833abd9%22%2C+%229be5b4638392f1e21880e266d4da2845%22%5D 200 +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.11806.548>] Duplicates of document `8c40fc1a160920a958b95e8d111aabb0` detected in view group `_design/users`, database `mygpo` - view rebuild, from scratch, is required +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.11804.548>] ** Generic server <0.11804.548> terminating +** Last message in was {'EXIT',<0.11806.548>, + {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>}} +** When Server state == {file, + {file_descriptor,prim_file,{#Port<0.10242013>,70}}, + 4944417161} +** Reason for termination == +** {view_duplicated_id,<<"8c40fc1a160920a958b95e8d111aabb0">>} + +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.11804.548>] {error_report,<0.31.0>, + {<0.11804.548>,crash_report, + [[{initial_call,{couch_file,init,['Argument__1']}}, + {pid,<0.11804.548>}, + {registered_name,[]}, + {error_info, + {exit, + {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>}, + [{gen_server,terminate,6}, + {proc_lib,init_p_do_apply,3}]}}, + {ancestors,[<0.164.0>,<0.163.0>]}, + {messages,[]}, + {links,[]}, + {dictionary,[]}, + {trap_exit,true}, + {status,running}, + {heap_size,610}, + {stack_size,24}, + {reductions,813809184}], + []]}} +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.31996.573>] 71.19.150.86 - - GET /mygpo/_design/users/_view/episode_states_by_ref_urls?include_docs=true&limit=1&key=%5B%22123648da92647ac2a6aa6779295bc040%22%2C+%22http%3A%2F%2Fwww.cbc.ca%2Fpodcasting%2Fincludes%2Fspark.xml%22%2C+%22http%3A%2F%2Fpodcast.cbc.ca%2Fmp3%2Fpodcasts%2Fspark_20100613_33816.mp3%22%5D 200 +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.164.0>] ** Generic server <0.164.0> terminating +** Last message in was {'EXIT',<0.11806.548>, + {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>}} +** When Server state == {group_state,undefined,<<"mygpo">>, + {"/var/lib/couchdb",<<"mygpo">>, + {group, + <<53,2,238,250,177,14,34,184,223,68,148,80,27,54,51, + 55>>, + nil,<<"_design/users">>,<<"javascript">>,[], + [{view,0,0,0, + [<<"history">>], + <<"function(doc)\n{\n function processEpisodeAction(action)\n {\n action_obj = {\n type: \"Episode\",\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([doc.user, action_obj.timestamp], action_obj);\n }\n\n function processSubscriptionAction(action)\n {\n action_obj = {\n type: \"Subscription\",\n podcast_url: doc.ref_url,\n podcast_id: doc.podcast,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n device_id: action.device,\n }\n\n emit([doc.user, action_obj.timestamp], action_obj);\n }\n\n\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n processEpisodeAction(doc.actions[n]);\n }\n }\n if(doc.doc_type == \"PodcastUserState\")\n {\n for(var n in doc.actions)\n {\n processSubscriptionAction(doc.actions[n]);\n }\n }\n}">>, + nil,[],[]}, + {view,1,0,0, + [<<"device_history">>], + <<"function(doc)\n{\n function processEpisodeAction(action)\n {\n if(action.device == null)\n {\n return;\n }\n\n action_obj = {\n type: \"Episode\",\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([doc.user, action.device, action_obj.timestamp], action_obj);\n }\n\n function processSubscriptionAction(action)\n {\n action_obj = {\n type: \"Subscription\",\n podcast_url: doc.ref_url,\n podcast_id: doc.podcast,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n device_id: action.device,\n }\n\n emit([doc.user, action.device, action_obj.timestamp], action_obj);\n }\n\n\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n processEpisodeAction(doc.actions[n]);\n }\n }\n if(doc.doc_type == \"PodcastUserState\")\n {\n for(var n in doc.actions)\n {\n processSubscriptionAction(doc.actions[n]);\n }\n }\n}">>, + nil,[],[]}, + {view,2,0,0, + [<<"episode_states_by_podcast_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.podcast, doc.episode, doc.user], null);\n }\n}">>, + nil,[],[]}, + {view,3,0,0, + [<<"episode_states_by_user_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.user, doc.episode], null);\n }\n}">>, + nil,[],[]}, + {view,4,0,0, + [<<"episode_states_by_ref_urls">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.user, doc.podcast_ref_url, doc.ref_url], null);\n }\n}">>, + nil,[],[]}, + {view,5,0,0, + [<<"episode_actions_podcast_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n\n emit([\n doc.user,\n doc.podcast,\n action.device,\n action_obj.timestamp,\n ], action_obj\n );\n }\n }\n}">>, + nil,[],[]}, + {view,6,0,0, + [<<"episode_actions_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n action.device,\n action_obj.timestamp,\n ], action_obj\n );\n }\n }\n}">>, + nil,[],[]}, + {view,7,0,0, + [<<"episode_actions">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n action_obj.timestamp\n ], action_obj\n );\n }\n }\n}">>, + nil,[],[]}, + {view,8,0,0, + [<<"episode_actions_podcast">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n doc.podcast,\n action_obj.timestamp\n ], action_obj\n );\n }\n }\n}">>, + nil,[],[]}, + {view,9,0,0, + [<<"chapters_by_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.chapters)\n {\n var chapter = doc.chapters[n];\n emit([doc.episode, doc.user], chapter);\n }\n }\n}">>, + nil,[],[]}, + {view,10,0,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.episode, day], doc.user);\n return;\n }\n }\n }\n}">>, + nil, + [{<<"listeners_by_episode">>,<<"_count">>}], + []}, + {view,11,0,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.podcast, day], doc.user);\n return;\n }\n }\n }\n}">>, + nil, + [{<<"listeners_by_podcast">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i>}], + []}, + {view,12,0,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.podcast, doc.episode, day], doc.user);\n return;\n }\n }\n }\n}">>, + nil, + [{<<"listeners_by_podcast_episode">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i>}], + []}, + {view,13,0,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n if(doc.actions == null || doc.actions.length == 0)\n {\n return;\n }\n\n function sortByStarted(a, b)\n {\n var x = a.started;\n var y = b.started;\n return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n }\n\n function hasTimeValues(action)\n {\n return ((action != null) && (action.started != null) && (action.playmark != null));\n }\n\n var actions = doc.actions.slice(0); // creates a copy\n actions = actions.filter(hasTimeValues);\n actions.sort(sortByStarted);\n\n var played_parts = [];\n var flat_date = null;\n\n for(var n in actions)\n {\n var action = actions[n];\n\n if(flat_date == null)\n {\n flat_date = {start: action.started, end: action.playmark};\n played_parts.push(flat_date);\n continue;\n }\n\n if(action.started <= flat_date.end && action.playmark >= flat_date.end)\n {\n flat_date.end = action.playmark;\n }\n else if(action.started >= flat_date.start && action.playmark <= flat_date.end)\n {\n // part already contained\n continue;\n }\n else\n {\n flat_date = {start: action.started, end: action.playmark};\n played_parts.push(flat_date);\n }\n }\n\n if (played_parts.length == 0)\n {\n return;\n }\n\n var sections = [];\n for(var n in played_parts)\n {\n var part = played_parts[n];\n sections.push(part.start);\n sections.push(part.end);\n }\n\n emit([doc.podcast, doc.episode, doc.user], sections);\n }\n}">>, + nil, + [{<<"episode_heatmap">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i b)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n };\n\n function mergeBorders(borders, maxBorders)\n {\n last = null;\n newBorders = [];\n\n lastBorder = borders[borders.length-1];\n minDist = lastBorder / maxBorders;\n\n for(var n in borders)\n {\n border = borders[n];\n\n if(last == null)\n {\n }\n else if (border == lastBorder)\n {\n }\n else if ((border - last) < minDist)\n {\n continue;\n }\n\n newBorders.push(border);\n last = border;\n }\n\n return newBorders;\n };\n\n var all_borders = [];\n\n if (rereduce)\n {\n for(var n in values)\n {\n all_borders.push(values[n].borders);\n }\n }\n else\n {\n all_borders = values;\n }\n\n var borders = flatten(all_borders);\n borders = unique(borders);\n borders.sort(sortNumerical);\n borders = mergeBorders(borders, 50);\n\n var heatmap = [];\n\n for(var n=0; n>}], + []}, + {view,14,0,0, + [<<"episode_states">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n if(doc.actions.length < 1)\n {\n return;\n }\n\n action = doc.actions[doc.actions.length-1];\n\n action_obj = {\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n\n emit([doc.user, doc.podcast, doc.episode], action_obj);\n }\n}">>, + nil,[],[]}, + {view,15,0,0, + [<<"podcast_states_by_podcast">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n emit([doc.podcast, doc.user], null);\n }\n}">>, + nil,[],[]}, + {view,16,0,0, + [<<"podcast_states_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n emit([doc.user, doc.podcast], null);\n }\n}">>, + nil,[],[]}, + {view,17,0,0, + [<<"podcast_states_by_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var affected_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n if (affected_devices.indexOf(action.device) == -1)\n {\n affected_devices.push(action.device);\n }\n }\n\n for(var n in affected_devices)\n {\n var device = affected_devices[n];\n\n emit([device, doc.podcast], null);\n }\n }\n}">>, + nil,[],[]}, + {view,18,0,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n\n if(doc.settings == null || doc.settings.public_subscription == null)\n {\n var is_public = true;\n }\n else\n {\n var is_public = doc.settings.public_subscription;\n }\n\n emit([doc.user, is_public, doc.podcast, device], null);\n }\n }\n}">>, + nil, + [{<<"subscribed_podcasts_by_user">>, + <<"_count">>}], + []}, + {view,19,0,0, + [<<"subscribed_podcasts_by_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n emit([device, doc.podcast], null);\n }\n }\n}">>, + nil,[],[]}, + {view,20,0,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n emit([doc.podcast, doc.user, device], null);\n }\n }\n}">>, + nil, + [{<<"subscriptions_by_podcast">>,<<"_count">>}], + []}, + {view,21,0,0, + [<<"suggestions_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == \"Suggestions\")\n {\n emit(doc.user, null);\n }\n}">>, + nil,[],[]}, + {view,22,0,0, + [<<"favorite_episodes_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == 'EpisodeUserState')\n {\n if (doc.settings && doc.settings.is_favorite)\n {\n emit(doc.user, {_id: doc.episode});\n }\n }\n}">>, + nil,[],[]}], + {[]}, + nil,0,0,nil,nil}}, + {group, + <<53,2,238,250,177,14,34,184,223,68,148,80,27,54,51, + 55>>, + <0.165.0>,<<"_design/users">>,<<"javascript">>,[], + [{view,0,154765697,0, + [<<"history">>], + <<"function(doc)\n{\n function processEpisodeAction(action)\n {\n action_obj = {\n type: \"Episode\",\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([doc.user, action_obj.timestamp], action_obj);\n }\n\n function processSubscriptionAction(action)\n {\n action_obj = {\n type: \"Subscription\",\n podcast_url: doc.ref_url,\n podcast_id: doc.podcast,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n device_id: action.device,\n }\n\n emit([doc.user, action_obj.timestamp], action_obj);\n }\n\n\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n processEpisodeAction(doc.actions[n]);\n }\n }\n if(doc.doc_type == \"PodcastUserState\")\n {\n for(var n in doc.actions)\n {\n processSubscriptionAction(doc.actions[n]);\n }\n }\n}">>, + {btree,<0.165.0>, + {174516124054,{34264651,[]},9575427003}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,1,154765697,0, + [<<"device_history">>], + <<"function(doc)\n{\n function processEpisodeAction(action)\n {\n if(action.device == null)\n {\n return;\n }\n\n action_obj = {\n type: \"Episode\",\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([doc.user, action.device, action_obj.timestamp], action_obj);\n }\n\n function processSubscriptionAction(action)\n {\n action_obj = {\n type: \"Subscription\",\n podcast_url: doc.ref_url,\n podcast_id: doc.podcast,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n device_id: action.device,\n }\n\n emit([doc.user, action.device, action_obj.timestamp], action_obj);\n }\n\n\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n processEpisodeAction(doc.actions[n]);\n }\n }\n if(doc.doc_type == \"PodcastUserState\")\n {\n for(var n in doc.actions)\n {\n processSubscriptionAction(doc.actions[n]);\n }\n }\n}">>, + {btree,<0.165.0>, + {174516131543,{33941072,[]},10984289352}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,2,154765665,0, + [<<"episode_states_by_podcast_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.podcast, doc.episode, doc.user], null);\n }\n}">>, + {btree,<0.165.0>, + {174515962272,{21276414,[]},1661977208}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,3,154765665,0, + [<<"episode_states_by_user_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.user, doc.episode], null);\n }\n}">>, + {btree,<0.165.0>, + {174515973619,{21276414,[]},1299411882}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,4,154765665,0, + [<<"episode_states_by_ref_urls">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.user, doc.podcast_ref_url, doc.ref_url], null);\n }\n}">>, + {btree,<0.165.0>, + {174516011233,{21276414,[]},2257232263}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,5,154765697,0, + [<<"episode_actions_podcast_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n\n emit([\n doc.user,\n doc.podcast,\n action.device,\n action_obj.timestamp,\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516139789,{33677961,[]},7161312350}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,6,154765697,0, + [<<"episode_actions_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n action.device,\n action_obj.timestamp,\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516147469,{33677961,[]},6763096451}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,7,154765697,0, + [<<"episode_actions">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n action_obj.timestamp\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516153644,{33677961,[]},6485662706}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,8,154765697,0, + [<<"episode_actions_podcast">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n doc.podcast,\n action_obj.timestamp\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516161371,{33677961,[]},6781675859}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,9,0,0, + [<<"chapters_by_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.chapters)\n {\n var chapter = doc.chapters[n];\n emit([doc.episode, doc.user], chapter);\n }\n }\n}">>, + {btree,<0.165.0>, + {65286549651,{253,[]},13900}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,10,154765459,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.episode, day], doc.user);\n return;\n }\n }\n }\n}">>, + {btree,<0.165.0>, + {174515602943,{2882075,[2882075]},199075115}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"listeners_by_episode">>,<<"_count">>}], + []}, + {view,11,154765459,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.podcast, day], doc.user);\n return;\n }\n }\n }\n}">>, + {btree,<0.165.0>, + {174515607726,{2882075,[745247]},160815714}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"listeners_by_podcast">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i>}], + []}, + {view,12,154765459,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.podcast, doc.episode, day], doc.user);\n return;\n }\n }\n }\n}">>, + {btree,<0.165.0>, + {174515613550,{2882075,[1020610]},244659839}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"listeners_by_podcast_episode">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i>}], + []}, + {view,13,154765697,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n if(doc.actions == null || doc.actions.length == 0)\n {\n return;\n }\n\n function sortByStarted(a, b)\n {\n var x = a.started;\n var y = b.started;\n return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n }\n\n function hasTimeValues(action)\n {\n return ((action != null) && (action.started != null) && (action.playmark != null));\n }\n\n var actions = doc.actions.slice(0); // creates a copy\n actions = actions.filter(hasTimeValues);\n actions.sort(sortByStarted);\n\n var played_parts = [];\n var flat_date = null;\n\n for(var n in actions)\n {\n var action = actions[n];\n\n if(flat_date == null)\n {\n flat_date = {start: action.started, end: action.playmark};\n played_parts.push(flat_date);\n continue;\n }\n\n if(action.started <= flat_date.end && action.playmark >= flat_date.end)\n {\n flat_date.end = action.playmark;\n }\n else if(action.started >= flat_date.start && action.playmark <= flat_date.end)\n {\n // part already contained\n continue;\n }\n else\n {\n flat_date = {start: action.started, end: action.playmark};\n played_parts.push(flat_date);\n }\n }\n\n if (played_parts.length == 0)\n {\n return;\n }\n\n var sections = [];\n for(var n in played_parts)\n {\n var part = played_parts[n];\n sections.push(part.start);\n sections.push(part.end);\n }\n\n emit([doc.podcast, doc.episode, doc.user], sections);\n }\n}">>, + {btree,<0.165.0>, + {174516182266, + {710222, + [{[{<<"heatmap">>, + [502747,472976,420462,394372,378930,367863, + 278749,260118,226577,197559,142217,114262, + 17976]}, + {<<"borders">>, + [0,53893900,55948338,59075545,61846547, + 64402477,68750666,80158983,83051922, + 86398351,90634192,96316257,99695977, + 102195099]}]}]}, + 76966115}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"episode_heatmap">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i b)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n };\n\n function mergeBorders(borders, maxBorders)\n {\n last = null;\n newBorders = [];\n\n lastBorder = borders[borders.length-1];\n minDist = lastBorder / maxBorders;\n\n for(var n in borders)\n {\n border = borders[n];\n\n if(last == null)\n {\n }\n else if (border == lastBorder)\n {\n }\n else if ((border - last) < minDist)\n {\n continue;\n }\n\n newBorders.push(border);\n last = border;\n }\n\n return newBorders;\n };\n\n var all_borders = [];\n\n if (rereduce)\n {\n for(var n in values)\n {\n all_borders.push(values[n].borders);\n }\n }\n else\n {\n all_borders = values;\n }\n\n var borders = flatten(all_borders);\n borders = unique(borders);\n borders.sort(sortNumerical);\n borders = mergeBorders(borders, 50);\n\n var heatmap = [];\n\n for(var n=0; n>}], + []}, + {view,14,154765697,0, + [<<"episode_states">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n if(doc.actions.length < 1)\n {\n return;\n }\n\n action = doc.actions[doc.actions.length-1];\n\n action_obj = {\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n\n emit([doc.user, doc.podcast, doc.episode], action_obj);\n }\n}">>, + {btree,<0.165.0>, + {174516189474,{21272181,[]},6229489915}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,15,154760981,0, + [<<"podcast_states_by_podcast">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n emit([doc.podcast, doc.user], null);\n }\n}">>, + {btree,<0.165.0>, + {174505609463,{284567,[]},22510141}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,16,154760981,0, + [<<"podcast_states_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n emit([doc.user, doc.podcast], null);\n }\n}">>, + {btree,<0.165.0>, + {174505613746,{284567,[]},20394449}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,17,154760998,0, + [<<"podcast_states_by_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var affected_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n if (affected_devices.indexOf(action.device) == -1)\n {\n affected_devices.push(action.device);\n }\n }\n\n for(var n in affected_devices)\n {\n var device = affected_devices[n];\n\n emit([device, doc.podcast], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174505728883,{403564,[]},30533795}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,18,154765309,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n\n if(doc.settings == null || doc.settings.public_subscription == null)\n {\n var is_public = true;\n }\n else\n {\n var is_public = doc.settings.public_subscription;\n }\n\n emit([doc.user, is_public, doc.podcast, device], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174515117982,{299330,[299330]},26781332}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"subscribed_podcasts_by_user">>,<<"_count">>}], + []}, + {view,19,154765309,0, + [<<"subscribed_podcasts_by_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n emit([device, doc.podcast], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174515121176,{299330,[]},22969037}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,20,154765309,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n emit([doc.podcast, doc.user, device], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174515124209,{299330,[299330]},35024813}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"subscriptions_by_podcast">>,<<"_count">>}], + []}, + {view,21,154688024,0, + [<<"suggestions_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == \"Suggestions\")\n {\n emit(doc.user, null);\n }\n}">>, + {btree,<0.165.0>, + {173686983396,{24329,[]},1334860}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,22,154679416,0, + [<<"favorite_episodes_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == 'EpisodeUserState')\n {\n if (doc.settings && doc.settings.is_favorite)\n {\n emit(doc.user, {_id: doc.episode});\n }\n }\n}">>, + {btree,<0.165.0>, + {173529044751,{3201,[]},280464}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}], + {[]}, + {btree,<0.165.0>, + {174516118537,[],9103498326}, + #Fun, + #Fun, + #Fun,nil,snappy}, + 154765811,0,nil,nil}, + <0.32066.573>,<0.11806.548>,true, + [{{<0.31998.573>,#Ref<0.0.10599.159587>},154765812}, + {{<0.32018.573>,#Ref<0.0.10599.159130>},154765812}], + <0.167.0>,false} +** Reason for termination == +** {view_duplicated_id,<<"8c40fc1a160920a958b95e8d111aabb0">>} + +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.32018.573>] Uncaught server error: {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>} +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.31998.573>] Uncaught server error: {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>} +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.31997.573>] 71.19.150.86 - - GET /mygpo/_design/users/_view/episode_states_by_ref_urls?include_docs=true&limit=1&key=%5B%2288270d2e57b685fea74bf2a747f02236%22%2C+%22http%3A%2F%2Fwww.marklevinshow.com%2Frss%2Filevin.xml%22%2C+%22http%3A%2F%2Fpodloc.andomedia.com%2FdloadTrack.mp3%3Fprm%3D2069xhttp%3A%2F%2Fpodfuse-dl.andomedia.com%2F800185%2Fpodfuse-origin.andomedia.com%2Fcitadel_origin%2Fpods%2Fmarklevin%2FLevin11012011.mp3%22%5D 200 +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32012.573>] 71.19.150.86 - - GET /mygpo/_design/users/_view/episode_states_by_ref_urls?include_docs=true&limit=1&key=%5B%2288270d2e57b685fea74bf2a747f02236%22%2C+%22http%3A%2F%2Fwww.city-journal.org%2Fcjpodcasts.xml%22%2C+%22http%3A%2F%2Fwww.city-journal.org%2Fmp3%2F2009-03-04-Breitbart_Klavan.mp3%22%5D 200 +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.164.0>] {error_report,<0.31.0>, + {<0.164.0>,crash_report, + [[{initial_call,{couch_view_group,init,['Argument__1']}}, + {pid,<0.164.0>}, + {registered_name,[]}, + {error_info, + {exit, + {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>}, + [{gen_server,terminate,6}, + {proc_lib,init_p_do_apply,3}]}}, + {ancestors,[<0.163.0>]}, + {messages, + [{'$gen_cast', + {partial_update,<0.32066.573>, + {group, + <<53,2,238,250,177,14,34,184,223,68,148,80,27,54, + 51,55>>, + <0.165.0>,<<"_design/users">>,<<"javascript">>, + [], + [{view,0,154765697,0, + [<<"history">>], + <<"function(doc)\n{\n function processEpisodeAction(action)\n {\n action_obj = {\n type: \"Episode\",\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([doc.user, action_obj.timestamp], action_obj);\n }\n\n function processSubscriptionAction(action)\n {\n action_obj = {\n type: \"Subscription\",\n podcast_url: doc.ref_url,\n podcast_id: doc.podcast,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n device_id: action.device,\n }\n\n emit([doc.user, action_obj.timestamp], action_obj);\n }\n\n\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n processEpisodeAction(doc.actions[n]);\n }\n }\n if(doc.doc_type == \"PodcastUserState\")\n {\n for(var n in doc.actions)\n {\n processSubscriptionAction(doc.actions[n]);\n }\n }\n}">>, + {btree,<0.165.0>, + {174516124054,{34264651,[]},9575427003}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,1,154765697,0, + [<<"device_history">>], + <<"function(doc)\n{\n function processEpisodeAction(action)\n {\n if(action.device == null)\n {\n return;\n }\n\n action_obj = {\n type: \"Episode\",\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([doc.user, action.device, action_obj.timestamp], action_obj);\n }\n\n function processSubscriptionAction(action)\n {\n action_obj = {\n type: \"Subscription\",\n podcast_url: doc.ref_url,\n podcast_id: doc.podcast,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n device_id: action.device,\n }\n\n emit([doc.user, action.device, action_obj.timestamp], action_obj);\n }\n\n\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n processEpisodeAction(doc.actions[n]);\n }\n }\n if(doc.doc_type == \"PodcastUserState\")\n {\n for(var n in doc.actions)\n {\n processSubscriptionAction(doc.actions[n]);\n }\n }\n}">>, + {btree,<0.165.0>, + {174516131543,{33941072,[]},10984289352}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,2,154765665,0, + [<<"episode_states_by_podcast_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.podcast, doc.episode, doc.user], null);\n }\n}">>, + {btree,<0.165.0>, + {174515962272,{21276414,[]},1661977208}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,3,154765665,0, + [<<"episode_states_by_user_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.user, doc.episode], null);\n }\n}">>, + {btree,<0.165.0>, + {174515973619,{21276414,[]},1299411882}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,4,154765665,0, + [<<"episode_states_by_ref_urls">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n emit([doc.user, doc.podcast_ref_url, doc.ref_url], null);\n }\n}">>, + {btree,<0.165.0>, + {174516011233,{21276414,[]},2257232263}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,5,154765697,0, + [<<"episode_actions_podcast_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n\n emit([\n doc.user,\n doc.podcast,\n action.device,\n action_obj.timestamp,\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516139789,{33677961,[]},7161312350}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,6,154765697,0, + [<<"episode_actions_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n action.device,\n action_obj.timestamp,\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516147469,{33677961,[]},6763096451}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,7,154765697,0, + [<<"episode_actions">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n action_obj.timestamp\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516153644,{33677961,[]},6485662706}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,8,154765697,0, + [<<"episode_actions_podcast">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.actions)\n {\n action = doc.actions[n];\n\n action_obj = {\n podcast: doc.podcast_ref_url,\n episode: doc.ref_url,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n emit([\n doc.user,\n doc.podcast,\n action_obj.timestamp\n ], action_obj\n );\n }\n }\n}">>, + {btree,<0.165.0>, + {174516161371,{33677961,[]},6781675859}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,9,0,0, + [<<"chapters_by_episode">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n in doc.chapters)\n {\n var chapter = doc.chapters[n];\n emit([doc.episode, doc.user], chapter);\n }\n }\n}">>, + {btree,<0.165.0>, + {65286549651,{253,[]},13900}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,10,154765459,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.episode, day], doc.user);\n return;\n }\n }\n }\n}">>, + {btree,<0.165.0>, + {174515602943,{2882075,[2882075]},199075115}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"listeners_by_episode">>,<<"_count">>}], + []}, + {view,11,154765459,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.podcast, day], doc.user);\n return;\n }\n }\n }\n}">>, + {btree,<0.165.0>, + {174515607726,{2882075,[745247]},160815714}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"listeners_by_podcast">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i>}], + []}, + {view,12,154765459,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n for(var n=doc.actions.length-1; n>=0; n--)\n {\n var action = doc.actions[n];\n if(action.action == \"play\")\n {\n var day = action.timestamp.slice(0, 10);\n emit([doc.podcast, doc.episode, day], doc.user);\n return;\n }\n }\n }\n}">>, + {btree,<0.165.0>, + {174515613550,{2882075,[1020610]},244659839}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"listeners_by_podcast_episode">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i>}], + []}, + {view,13,154765697,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n if(doc.actions == null || doc.actions.length == 0)\n {\n return;\n }\n\n function sortByStarted(a, b)\n {\n var x = a.started;\n var y = b.started;\n return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n }\n\n function hasTimeValues(action)\n {\n return ((action != null) && (action.started != null) && (action.playmark != null));\n }\n\n var actions = doc.actions.slice(0); // creates a copy\n actions = actions.filter(hasTimeValues);\n actions.sort(sortByStarted);\n\n var played_parts = [];\n var flat_date = null;\n\n for(var n in actions)\n {\n var action = actions[n];\n\n if(flat_date == null)\n {\n flat_date = {start: action.started, end: action.playmark};\n played_parts.push(flat_date);\n continue;\n }\n\n if(action.started <= flat_date.end && action.playmark >= flat_date.end)\n {\n flat_date.end = action.playmark;\n }\n else if(action.started >= flat_date.start && action.playmark <= flat_date.end)\n {\n // part already contained\n continue;\n }\n else\n {\n flat_date = {start: action.started, end: action.playmark};\n played_parts.push(flat_date);\n }\n }\n\n if (played_parts.length == 0)\n {\n return;\n }\n\n var sections = [];\n for(var n in played_parts)\n {\n var part = played_parts[n];\n sections.push(part.start);\n sections.push(part.end);\n }\n\n emit([doc.podcast, doc.episode, doc.user], sections);\n }\n}">>, + {btree,<0.165.0>, + {174516182266, + {710222, + [{[{<<"heatmap">>, + [502747,472976,420462,394372,378930, + 367863,278749,260118,226577,197559, + 142217,114262,17976]}, + {<<"borders">>, + [0,53893900,55948338,59075545,61846547, + 64402477,68750666,80158983,83051922, + 86398351,90634192,96316257,99695977, + 102195099]}]}]}, + 76966115}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"episode_heatmap">>, + <<"function (keys, values, rereduce)\n{\n function unique(arr) {\n var a = [];\n var l = arr.length;\n for(var i=0; i b)\n {\n return 1;\n }\n else\n {\n return 0;\n }\n };\n\n function mergeBorders(borders, maxBorders)\n {\n last = null;\n newBorders = [];\n\n lastBorder = borders[borders.length-1];\n minDist = lastBorder / maxBorders;\n\n for(var n in borders)\n {\n border = borders[n];\n\n if(last == null)\n {\n }\n else if (border == lastBorder)\n {\n }\n else if ((border - last) < minDist)\n {\n continue;\n }\n\n newBorders.push(border);\n last = border;\n }\n\n return newBorders;\n };\n\n var all_borders = [];\n\n if (rereduce)\n {\n for(var n in values)\n {\n all_borders.push(values[n].borders);\n }\n }\n else\n {\n all_borders = values;\n }\n\n var borders = flatten(all_borders);\n borders = unique(borders);\n borders.sort(sortNumerical);\n borders = mergeBorders(borders, 50);\n\n var heatmap = [];\n\n for(var n=0; n>}], + []}, + {view,14,154765697,0, + [<<"episode_states">>], + <<"function(doc)\n{\n if(doc.doc_type == \"EpisodeUserState\")\n {\n if(doc.actions.length < 1)\n {\n return;\n }\n\n action = doc.actions[doc.actions.length-1];\n\n action_obj = {\n podcast_url: doc.podcast_ref_url,\n episode_url: doc.ref_url,\n podcast_id: doc.podcast,\n episode_id: doc.episode,\n action: action.action,\n timestamp: action.timestamp.slice(0, action.timestamp.length-1),\n }\n\n if(action.device != null)\n {\n action_obj[\"device_id\"] = action.device;\n }\n if(action.started != null)\n {\n action_obj[\"started\"] = action.started;\n }\n if(action.playmark != null)\n {\n action_obj[\"position\"] = action.playmark;\n }\n if(action.total != null)\n {\n action_obj[\"total\"] = action.total;\n }\n\n\n emit([doc.user, doc.podcast, doc.episode], action_obj);\n }\n}">>, + {btree,<0.165.0>, + {174516189474,{21272181,[]},6229489915}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,15,154760981,0, + [<<"podcast_states_by_podcast">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n emit([doc.podcast, doc.user], null);\n }\n}">>, + {btree,<0.165.0>, + {174505609463,{284567,[]},22510141}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,16,154760981,0, + [<<"podcast_states_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n emit([doc.user, doc.podcast], null);\n }\n}">>, + {btree,<0.165.0>, + {174505613746,{284567,[]},20394449}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,17,154760998,0, + [<<"podcast_states_by_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var affected_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n if (affected_devices.indexOf(action.device) == -1)\n {\n affected_devices.push(action.device);\n }\n }\n\n for(var n in affected_devices)\n {\n var device = affected_devices[n];\n\n emit([device, doc.podcast], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174505728883,{403564,[]},30533795}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,18,154765309,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n\n if(doc.settings == null || doc.settings.public_subscription == null)\n {\n var is_public = true;\n }\n else\n {\n var is_public = doc.settings.public_subscription;\n }\n\n emit([doc.user, is_public, doc.podcast, device], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174515117982,{299330,[299330]},26781332}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"subscribed_podcasts_by_user">>, + <<"_count">>}], + []}, + {view,19,154765309,0, + [<<"subscribed_podcasts_by_device">>], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n emit([device, doc.podcast], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174515121176,{299330,[]},22969037}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,20,154765309,0,[], + <<"function(doc)\n{\n if(doc.doc_type == \"PodcastUserState\")\n {\n var subscribed_devices = [];\n\n for(var n in doc.actions)\n {\n var action = doc.actions[n];\n\n if(action.action == \"subscribe\")\n {\n subscribed_devices.push(action.device);\n }\n else\n {\n var index = subscribed_devices.indexOf(action.device);\n subscribed_devices.splice(index, 1);\n }\n }\n\n for(var n in subscribed_devices)\n {\n var device = subscribed_devices[n];\n\n if(doc.disabled_devices && (doc.disabled_devices.indexOf(device) > -1))\n {\n continue;\n }\n\n emit([doc.podcast, doc.user, device], null);\n }\n }\n}">>, + {btree,<0.165.0>, + {174515124209,{299330,[299330]},35024813}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [{<<"subscriptions_by_podcast">>,<<"_count">>}], + []}, + {view,21,154688024,0, + [<<"suggestions_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == \"Suggestions\")\n {\n emit(doc.user, null);\n }\n}">>, + {btree,<0.165.0>, + {173686983396,{24329,[]},1334860}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}, + {view,22,154679416,0, + [<<"favorite_episodes_by_user">>], + <<"function(doc)\n{\n if(doc.doc_type == 'EpisodeUserState')\n {\n if (doc.settings && doc.settings.is_favorite)\n {\n emit(doc.user, {_id: doc.episode});\n }\n }\n}">>, + {btree,<0.165.0>, + {173529044751,{3201,[]},280464}, + #Fun, + #Fun, + #Fun, + #Fun,snappy}, + [],[]}], + {[]}, + {btree,<0.165.0>, + {174516118537,[],9103498326}, + #Fun, + #Fun, + #Fun,nil,snappy}, + 154765812,0,nil,nil}}}]}, + {links,[<0.165.0>,<0.123.0>]}, + {dictionary,[]}, + {trap_exit,true}, + {status,running}, + {heap_size,28657}, + {stack_size,24}, + {reductions,279415648}], + []]}} +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.165.0>] ** Generic server <0.165.0> terminating +** Last message in was {'EXIT',<0.164.0>, + {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>}} +** When Server state == {file,{file_descriptor,prim_file,{#Port<0.2656>,24}}, + 174516257850} +** Reason for termination == +** {view_duplicated_id,<<"8c40fc1a160920a958b95e8d111aabb0">>} + +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.165.0>] {error_report,<0.31.0>, + {<0.165.0>,crash_report, + [[{initial_call,{couch_file,init,['Argument__1']}}, + {pid,<0.165.0>}, + {registered_name,[]}, + {error_info, + {exit, + {view_duplicated_id, + <<"8c40fc1a160920a958b95e8d111aabb0">>}, + [{gen_server,terminate,6}, + {proc_lib,init_p_do_apply,3}]}}, + {ancestors,[<0.164.0>,<0.163.0>]}, + {messages,[]}, + {links,[<0.167.0>]}, + {dictionary,[]}, + {trap_exit,true}, + {status,running}, + {heap_size,2584}, + {stack_size,24}, + {reductions,131338932620}], + [{neighbour, + [{pid,<0.167.0>}, + {registered_name,[]}, + {initial_call, + {couch_ref_counter,init,['Argument__1']}}, + {current_function,{gen_server,loop,6}}, + {ancestors,[<0.164.0>,<0.163.0>]}, + {messages,[]}, + {links,[<0.165.0>]}, + {dictionary,[]}, + {trap_exit,false}, + {status,waiting}, + {heap_size,2584}, + {stack_size,9}, + {reductions,656072244}]}]]}} +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32010.573>] 83.169.6.40 - - GET /mygpo/_design/core/_view/podcasts_by_id?key=%225c156ecbf8c7df16b999c8fe7ff8e942%22&include_docs=true 200 +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.31996.573>] Uncaught error in HTTP request: {exit, + {noproc, + {gen_server,call, + [<0.165.0>, + {pread_iolist, + 73832222373}, + infinity]}}} +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32018.573>] 71.19.150.86 - - GET /mygpo/_design/users/_view/episode_actions?startkey=%5B%228cc9a038c211a5176e7d5383c4af3b79%22%2C+%221970-01-01T00%3A00%3A00%22%5D&endkey=%5B%228cc9a038c211a5176e7d5383c4af3b79%22%2C+%222012-04-17T06%3A01%3A36%22%5D 500 +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.31998.573>] 83.169.20.177 - - GET /mygpo/_design/users/_view/listeners_by_episode?endkey=%5B%2213a71e4257b823a76cd198de2d18508e%22%2C+%7B%7D%5D&group=true&group_level=1&reduce=true&startkey=%5B%2213a71e4257b823a76cd198de2d18508e%22%2C+null%5D 500 +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.32012.573>] Uncaught error in HTTP request: {exit, + {noproc, + {gen_server,call, + [<0.165.0>, + {pread_iolist, + 35471780464}, + infinity]}}} +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32014.573>] 83.169.6.40 - - GET /mygpo/_design/core/_view/podcasts_by_id?key=%22018c39faf7f11fb9691c66118259a26e%22&include_docs=true 200 +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.31996.573>] Stacktrace: [{gen_server,call,3}, + {couch_file,pread_iolist,2}, + {couch_file,pread_binary,2}, + {couch_file,pread_term,2}, + {couch_btree,get_node,2}, + {couch_btree,stream_node,7}, + {couch_btree,stream_kp_node,7}, + {couch_btree,stream_kp_node,8}] +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.31996.573>] Uncaught server error: {noproc, + {gen_server,call, + [<0.165.0>, + {pread_iolist,73832222373}, + infinity]}} +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32012.573>] Stacktrace: [{gen_server,call,3}, + {couch_file,pread_iolist,2}, + {couch_file,pread_binary,2}, + {couch_file,pread_term,2}, + {couch_btree,get_node,2}, + {couch_btree,stream_node,7}, + {couch_btree,stream_kp_node,7}, + {couch_btree,stream_kp_node,8}] +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.31996.573>] 71.19.150.86 - - GET /mygpo/_design/users/_view/episode_states_by_ref_urls?include_docs=true&limit=1&key=%5B%22123648da92647ac2a6aa6779295bc040%22%2C+%22http%3A%2F%2Fwww.cbc.ca%2Fpodcasting%2Fincludes%2Fspark.xml%22%2C+%22http%3A%2F%2Fpodcast.cbc.ca%2Fmp3%2Fpodcasts%2Fspark_20100613_33816.mp3%22%5D 500 +[Tue, 17 Apr 2012 06:02:54 GMT] [error] [<0.32012.573>] Uncaught server error: {noproc, + {gen_server,call, + [<0.165.0>, + {pread_iolist,35471780464}, + infinity]}} +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32012.573>] 71.19.150.86 - - GET /mygpo/_design/users/_view/episode_states_by_ref_urls?include_docs=true&limit=1&key=%5B%2288270d2e57b685fea74bf2a747f02236%22%2C+%22http%3A%2F%2Fwww.city-journal.org%2Fcjpodcasts.xml%22%2C+%22http%3A%2F%2Fwww.city-journal.org%2Fmp3%2F2009-03-04-Breitbart_Klavan.mp3%22%5D 500 +[Tue, 17 Apr 2012 06:02:54 GMT] [info] [<0.32017.573>] 83.169.20.177 - - PUT /mygpo/87870b03cac96dfe08791e34fcebed78 201 +