diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.028/source/chrome/content/common.js releases/unplug-2.029/source/chrome/content/common.js
135c135
< version : 2.028,
---
> version : 2.029,
139c139
< revision : 201007302040,
---
> revision : 201008090205,
diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.028/source/chrome/content/display/pop/pop.js releases/unplug-2.029/source/chrome/content/display/pop/pop.js
77a78
> var searchbar = document.getElementById("search_progress");
79,82c80,82
< with (document.getElementById("search_progress")) {
< mode = "determined";
< value = "100";
< }
---
> searchbar.mode = "determined";
> searchbar.value = "100";
>
94,95c94,98
< with (document.getElementById("search_progress")) {
< mode = "undetermined";
---
> if (statusinfo.percent == 0 || statusinfo.percent == 100) {
> searchbar.mode = "undetermined";
> } else {
> searchbar.mode = "determined";
> searchbar.value = statusinfo.percent;
384c387
< var file = UnPlug2SearchPage._save_as_box(res.details.description || res.details.name, res.details.file_ext);
---
> var file = UnPlug2SearchPage._save_as_box(res.details.name, res.details.file_ext);
diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.028/source/chrome/content/rules.xml releases/unplug-2.029/source/chrome/content/rules.xml
50a51
> cpro.baidu.com
51a53,59
>
>
>
55c63
<
---
>
64c72
<
---
>
68c76
<
---
>
74,76c82,86
< (http://[^"]+\.flv[^"]*)"
< <poster url="([^"]+jpg)"
<
---
>
>
>
>
>
80,84d89
<
<
< so\.addVariable\("file",\s*"(http://[^"]+)"\)
<
<
85a91,92
>
>
101,110d107
<
< iid\s*=\s*(\d+)
<
<
<
<
<
<
<
<
112,128c109,136
<
<
<
<
<
<
<
<
<
< iid\s*:\s*"(\d+)"
< title\s*:\s*"(.*?)"
<
<
<
<
<
<
---
>
>
>
> iid\s*=\s*(\d+)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> iid\s*:\s*"(\d+)"
> title\s*:\s*"(.*?)"
>
>
>
>
>
>
131c139,140
<
---
>
>
141c150,158
<
---
>
>
>
154c171,232
<
---
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> /watch/([^/]+)
>
>
>
>
>
>
>
> clip_id: '(\d+)',
>
>
>
>
>
>
>
>
>
>
>
>
>
>
156,160c234,239
<
<
<
< "videoUrl"\s*:\s*"(http://[^"]+)",
<
---
>
>
>
>
>
>
161a241,351
>
>
>
>
>
>
>
>
> /video/video\-(\d+)\.html
>
>
>
>
>
>
>
>
>
>
>
>
> <div\s+id=["']current\-title["']\s*>([\s\S]*?)</div\s*>
>
> href=["'](http://[^"']+)["']
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> /(\d+)
>
>
>
>
>
>
>
>
>
>
>
> (http.*?\.flv)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> /video/(\d+)
>
>
>
>
>
>
>
>
>
> intl\.esperanto\.mtvi\.com
> var uri\s*=\s*"(.*?)"
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
171a362
> This also work around scripts
174,231c365
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
---
>
233,244c367,385
<
<
<
<
<
<
<
<
< veoh\.com.*\.swf
<
< (?:\?|&)permalinkId=([^&]+)
<
---
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
246,253d386
<
<
<
<
<
<
<
<
256,257c389,390
< embed\.magnatune\.com.*playlist_url=([^&]+)
<
---
> magnatune\.com.*[&\?]playlist_url=([^&]+)
>
266c399
<
---
>
268a402
>
276,290c410,414
<
<
<
< /googleplayer\.swf\?videoUrl=([^&]+)&thumbnailUrl=([^&]*)
<
<
<
<
<
< youtube\.com\/v\/([^&]+)
<
<
< token=([^&]+)&
< title=([^&]+)&
<
---
>
>
>
>
>
294,296c418
<
< vimeo\.com/moogaloop\.swf\?clip_id=(\d+)&
<
---
>
305,312d426
<
313a428
>
316a432,435
>
>
>
>
317a437
>
321,333d440
<
<
<
<
< \.flv(?:\?|$)
<
<
<
<
<
<
<
<
334a442
>
342a451
>
352,365c461,499
<
<
< (movie|src|href)
<
<
<
<
< youtube\.com\/v\/([^&]+)
<
<
< token=([^&]+)&
< title=([^&]+)&
<
<
---
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
369a504,590
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> quality="very-high" title="${either:title.1:origtitle.innerHTML}" mediaid="${video_id.1}"
> description="${translate:hd_quality} - ${optional:title.1}" type="mp4" />
>
>
>
> quality="low" title="${either:title.1:origtitle.innerHTML}" mediaid="${video_id.1}"
> description="${translate:low_quality} - ${optional:title.1}" type="flv" />
>
>
>
> quality="mid" title="${either:title.1:origtitle.innerHTML}" mediaid="${video_id.1}"
> description="${translate:mid_quality} - ${optional:title.1}" type="flv" />
>
>
>
> quality="mid" title="${either:title.1:origtitle.innerHTML}" mediaid="${video_id.1}"
> description="${translate:mid_quality} (mp4) - ${optional:title.1}" type="mp4" />
>
>
>
> quality="mid" title="${either:title.1:origtitle.innerHTML}" mediaid="${video_id.1}"
> description="${translate:high_quality} - ${optional:title.1}" type="flv" />
>
>
>
> description="Unknown quality code ${fmt_url.1} - ${optional:title.1}" type="flv" />
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
370a592
>
376a599
>
381a605
>
416a641
>
425a651
>
446a673
>
452a680
>
464a693
>
474,476c703,714
<
<
<
---
>
>
>
>
>
>
>
>
>
>
>
>
481,507c719,723
<
<
<
< (?:filename|url)
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
---
>
>
>
> so\.addVariable\("file",\s*"(http://[^"]+)"\)
>
509,518c725,726
<
<
<
< video_id%3D%27(\d+)%27
< media_id%3D%27(\d+)%27
<
<
<
<
<
---
>
>
520,578c728,731
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
< /video(\d+)/
<
<
<
<
<
<
<
<
<
<
< /watch/([^/]+)
<
<
<
<
<
<
< clip_id: '(\d+)',
<
<
<
<
<
<
<
<
<
<
---
>
>
>
>
580,614d732
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
< /video/video\-(\d+)\.html
<
<
<
<
<
<
<
<
<
<
<
< <div\s+id=["']current\-title["']\s*>([\s\S]*?)</div\s*>
<
< href=["'](http://[^"']+)["']
<
<
618,679c736
<
<
<
<
<
<
<
<
<
<
<
<
< /(\d+)
<
<
<
<
<
<
<
<
<
<
< (http.*?\.flv)
<
<
<
<
<
<
<
<
<
<
<
<
< /video/(\d+)
<
<
<
<
<
<
<
<
< intl\.esperanto\.mtvi\.com
< var uri\s*=\s*"(.*?)"
<
<
<
<
<
<
<
<
<
<
<
<
< (googleplayer\.swf\?[^"']+)["']
<
<
---
>
683c740,745
<
---
>
>
687c749,753
<
---
>
>
>
>
>
710,795d775
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
< /music/item/(\d+)
<
<
<
<
<
<
<
<
<
< grab the video id
<
< /watch/([^/]+)
<
<
<
<
<
<
< /iplayer/episode/([^/]+)
<
<
<
<
<
<
<
<
<
<
<
<
<
< directdl\.iplayer\.bbc\.co\.uk
<
<
<
<
< live\.xml
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.028/source/chrome/content/search/rules.js releases/unplug-2.029/source/chrome/content/search/rules.js
443a444
> "string",
448c449
< if (!doc)
---
> if (data.string || !doc)
464c465
< var regresult = reg.exec(text);
---
> var regresult = reg.exec(data.string || text);
diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.028/source/chrome/content/search/search.js releases/unplug-2.029/source/chrome/content/search/search.js
353a354,381
> * ${required:varname}
> */
> case "required":
> var r = this._subst_apply_functions(parts);
> if (r) {
> return r;
> } else {
> throw "Variable gave empty string: " + parts.toSource()
> }
> /**
> * ${either:var1:var2:....}
> */
> case "either":
> parts = parts.reverse()
> while (parts) {
> var p = parts.pop()
> var z = "";
> try {
> z = this._subst_apply_functions([p]);
> } catch (e) {
> continue;
> }
> if (z) {
> return z;
> }
> }
> return "";
> /**
366,368c394,395
< var fullstring = this._subst_apply_functions(parts);
< var n1 = Number(parts[parts.length-1]);
< if (n1 < 0)
---
> var n1 = Number(parts.pop())
> if (n1 < 0) {
370,375d396
< var n2 = Number(parts[parts.length-2]);
< parts.pop(); // pop n1
< if (n2 === NaN) {
< if (n2 < 0)
< n2 += fullstring.length;
< return String(fullstring).substring(n1);
377,378c398,412
< parts.pop(); // pop n2 too
< return String(fullstring).substring(n1);
---
> var n2 = Number(parts[parts.length-1]);
> if (isNaN(n2)) {
> // ${substring:start:var}
> n2 = null;
> } else {
> // ${substring:start:end:var}
> parts.pop() // pop n2
> }
> var fullstring = String(this._subst_apply_functions(parts));
> if (!n2) {
> n2 = fullstring.length;
> } else if (n2 < 0) {
> n2 += fullstring.length;
> }
> return fullstring.substring(n1, n2);
420c454,457
< return m ? unescape(m[1]) : "";
---
> if (!m) {
> throw "qparam:" + qname + " is not in " + urlstring;
> }
> return unescape(m[1]);
436c473
< if (parts.length != 5) {
---
> if (parts.length != 6) {
438a476
> var mediatype = parts[5];
444c482
< return this.youku_url(key1, key2, seed, streamid, pieceid);
---
> return this.youku_url(mediatype, key1, key2, seed, streamid, pieceid);
510c548
< youku_url : (function (key1, key2, randomseed, streamid, piece_num) {
---
> youku_url : (function (mediatype, key1, key2, randomseed, streamid, piece_num) {
512a551,552
> piece_num = ((parseInt(piece_num) < 10) ? "0" : "") + piece_num;
>
538c578
< for (var i = 0; i < 11; ++i) {
---
> for (var i = 0; i < 8; ++i) {
543,546c583,586
< url.push("/st/flv/fileid/");
< url.push(fileid.substring(0, 8));
< url.push(piece_num);
< url.push(fileid.substring(8, fileid.length));
---
> url.push("/st/");
> url.push(mediatype);
> url.push("/fileid/");
> url.push(fileid);
548d587
< url.push((parseInt(key1, 16) ^ 0xa55aa5a5).toString(16).toLowerCase()); // xor
549a589
> url.push((parseInt(key1, 16) ^ 0xa55aa5a5).toString(16).toLowerCase()); // xor
694c734
< UnPlug2Search._downloads[dl.reference] = null;
---
> UnPlug2Search._downloads[dl.reference].download = null;
705c745
< UnPlug2Search._downloads[dl.reference] = null;
---
> UnPlug2Search._downloads[dl.reference].download = null;
997a1038,1061
> /*
> TODO -- new things to implement!
> url="http://...../" # required
>
> # display options:
> description="low quality" # default "" (used for display only)
> thumbnail="http://..../" # default null
>
> # file naming options
> title="A kitten" # default -- guess from url or "no title"
> type="flv" # default -- guess from url or "flv"
> certainty="low" # default "mid" (used to decide which name is "right" when merging duplicates)
>
> # grouping same media with different quality settings
> mediaid="foo" # default url (used to group media which are the same but are different quality settings
> quality="low" # default "mid" (used to order results)
>
> # grouping items which are in a playlist
> playlist="bar"
>
> />
> */
>
1022,1024c1086,1087
< node.getAttribute("type"),
< updated_variables.subst_optional(node.getAttribute("description")),
< updated_variables.subst_optional(node.getAttribute("thumbnail")),
---
> updated_variables,
> node,
1042a1106
> * (no no native objects, etc)
1054,1055c1118,1130
< _make_response_object_result : function (nsiuri, download_method, file_ext, description, thumbnailurl, trace) {
< var name = UnPlug2Search.get_name(nsiuri.spec);
---
> _make_response_object_result : function (nsiuri, download_method, variables, node, trace) {
> var levels = { "very-low" : -20, "low" : -10, "mid" : 0, "high" : +10, "very-high" : +20 };
> var guesses = UnPlug2Search.guess_from_uri(nsiuri);
> var default_quality = 0;
> var default_certainty = +10; // high!
>
> var title = variables.subst_optional(node.getAttribute("title"));
> var file_ext = variables.subst_optional(node.getAttribute("type"));
> var description = variables.subst_optional(node.getAttribute("description"));
> var thumbnailurl = variables.subst_optional(node.getAttribute("thumbnail"));
> var certainty = levels[variables.subst_optional(node.getAttribute("certainty"))];
> var quality = levels[variables.subst_optional(node.getAttribute("quality"))];
>
1059,1062c1134,1150
< "name" : name || "(no name!)",
< "url" : nsiuri.spec, // this is used for advice only (not used for downloading)
< "swf" : (nsiuri.path.indexOf(".swf") >= 0) ? true : false,
< "trace" : trace || "TRACE!?" },
---
> "name" : title || guesses.base_name,
> "mediaid" : variables.subst_optional(node.getAttribute("mediaid")) || null,
> "playlistid" : variables.subst_optional(node.getAttribute("playlistid")) || null,
> "certainty" : certainty === undefined ? default_certainty : certainty,
> "quality" : quality === undefined ? default_quality : quality,
>
> // IMPORTANT this is used for advice only (not used for downloading) !!
> "url" : nsiuri.spec,
> "protocol" : nsiuri.scheme,
> "host" : guesses.host,
>
> // more details we may know
> "swf" : ((file_ext || guesses.file_ext) == "swf"), // TODO roll this into file_ext?
> "file_ext" : file_ext || guesses.file_ext || "flv",
> "description" : description || null,
> "thumbnail" : thumbnailurl || null,
> "trace" : trace },
1065,1081d1152
< // details section ( { "label" : undefined } has odd results, so assign here )
< if (description)
< result_object.details.description = description;
< if (file_ext)
< result_object.details.file_ext = file_ext;
< if (thumbnailurl)
< result_object.details.thumbnail = thumbnailurl;
< try {
< result_object.details.protocol = nsiuri.scheme
< } catch (e) {
< // probably will never fail
< }
< try {
< result_object.details.host = nsiuri.host
< } catch (e) {
< // fails for rtmp links (difference between nsIURI and nsIURL?)
< }
1084,1105d1154
<
< /**
< * Turn a relative url into a full url
< */
< _abs_url : function (url, base_url) {
< UnPlug2.log("_abs_url is depricaed!");
< // TODO - should use nsIURI-type URIs everywhere
< UnPlug2.log("URL: " + url + " from base " + base_url);
< if (base_url) {
< var base_nsiuri = UnPlug2Search.make_uri(base_url);
< return UnPlug2Search.make_uri(url, base_nsiuri).spec;
< }
< return url;
< },
<
< make_uri : function (uri, base_uri) {
< UnPlug2.log("make_uri is depricated");
< // TODO - DEPRICATED
< var io_service = Components.classes["@mozilla.org/network/io-service;1"]
< .getService(Components.interfaces.nsIIOService);
< return io_service.newURI(uri, null, base_uri || null);
< },
1110,1135c1159,1200
< get_name : function (full_url) {
< if (full_url.indexOf("#") > 0)
< full_url = full_url.substring(0, full_url.indexOf("#"));
< // index of last slash (except slashes in query part)
< var last_slash = full_url.lastIndexOf("/");
< if (full_url.indexOf("?") > 0)
< last_slash = full_url.substring(0, full_url.indexOf("?")).lastIndexOf("/");
< // take everything after last slash, like foo.flv?foo=bar&woo=y
< full_url = full_url.substring(last_slash+1);
< // take first 30 chars of nnn?qqqq or take all of nnnnnn
< if (full_url.indexOf("?") > 0) {
< full_url = full_url.substring(0, Math.max(30, full_url.indexOf("?")));
< }
< if (!full_url)
< return "(no name)"
< return full_url;
< },
<
< /**
< * TODO depricated
< */
< _subst_node : function (node, attrib, variables) {
< throw "_subst_node is depricated!";
< },
< _subst : function (text, variables) {
< throw "_subst is depricated!";
---
> guess_from_uri : function (uri) {
> /* nsIRUI have scheme, host, port, and path (note: can be "")
> * nsIURL also have a fileName (made of fileBaseName and fileExtension) which can be "" if uri ends in "/". In this case we want to look at the directory which won't have #ref or ?query or ;param.
> */
> var data = {
> host : "",
> file_ext : "",
> base_name : "" };
>
> // the host SHOULD be available in the nsIURI,
> // but this raises an exception for unusual protocols!
> // there's no guarentee that "host" is meaningful, eg: data links
> try {
> data.host = nsiuri.hostPort
> } catch(e) {
> // pass
> }
>
> if (uri instanceof Components.interfaces.nsIURL) {
> // these are in nsIURL but not in nsIURI
> // easy! but these can be empty strings
> data.file_ext = uri.fileExtension;
> data.base_name = uri.fileBaseName;
> }
> if (!data.file_ext || !data.base_name) {
> var u = uri.spec;
> // trim endings, like #foo ;foo ?foo
> u = RegExp("^([^\\?;#]*)([\\?;#]|$)").exec(uri.spec)[1];
> // take the last meaningful segment after the final slash
> var r = RegExp("(^|/)([^/]+)/*$").exec(u);
> if (r) {
> u = r[2];
> r = RegExp("^(.*)\\.([a-zA-Z0-9]{1,5})$").exec(u);
> if (r) {
> data.base_name = r[1];
> data.file_ext = r[2];
> } else {
> data.base_name = u;
> }
> }
> }
> return data;
1146c1211,1213
< window.setInterval(UnPlug2Search.poll, 100);
---
> if (!UnPlug2Search._poll_timer) {
> UnPlug2Search._poll_timer = window.setInterval(UnPlug2Search.poll, 100);
> }
1155c1222
< if (UnPlug2Search._downloads[i])
---
> if (UnPlug2Search._downloads[i] && UnPlug2Search._downloads[i].download)
1166c1233,1236
< var info = { downloads : 0, finished : false };
---
> var info = { downloads : 0, finished : false, percent : 0 };
> var attempted_downloads = 0;
> var active_downloads = 0;
> var completed_pct = 0;
1168,1169c1238,1250
< if (UnPlug2Search._downloads[i])
< info.downloads ++
---
> var di = UnPlug2Search._downloads[i];
> if (di) {
> ++attempted_downloads;
> if (di.download) {
> completed_pct += di.download.percent_complete();
> if (di.download.is_complete() == false) {
> ++active_downloads;
> }
> } else {
> // we cleared the download because it was done
> completed_pct += 100;
> }
> }
1170a1252,1254
> info.downloads = active_downloads;
> // info.percent = 100 * (attempted_downloads - active_downloads) / (attempted_downloads || 1);
> info.percent = completed_pct / (attempted_downloads || 1);
diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.028/source/install.rdf releases/unplug-2.029/source/install.rdf
6c6
< 2.028
---
> 2.029
14c14
< 4.0b2pre
---
> 4.0b3
Binary files releases/unplug-2.028/unplug.xpi and releases/unplug-2.029/unplug.xpi differ