Merge lp:~jlu5/variety/remove-panoramio into lp:~variety/variety/trunk
- remove-panoramio
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 598 | ||||||||
Proposed branch: | lp:~jlu5/variety/remove-panoramio | ||||||||
Merge into: | lp:~variety/variety/trunk | ||||||||
Diff against target: |
596 lines (+1/-478) 10 files modified
data/panoramio/panoramio.html (+0/-16) data/panoramio/panoramio.js (+0/-101) data/panoramio/style.css (+0/-67) data/panoramio/underscore-min.js (+0/-6) tests/TestPanoramioDownloader.py (+0/-34) variety/AddPanoramioDialog.py (+0/-114) variety/Options.py (+1/-3) variety/PanoramioDownloader.py (+0/-126) variety/PreferencesVarietyDialog.py (+0/-8) variety/VarietyWindow.py (+0/-3) |
||||||||
To merge this branch: | bzr merge lp:~jlu5/variety/remove-panoramio | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Peter Levi | Pending | ||
Review via email: mp+326627@code.launchpad.net |
Commit message
Description of the change
Disable and remove the Panoramio source, which has been broken for quite some time. I have tested this code locally with no apparent problems, but I would like to know if I'm actually purging this old source correctly.
This also fixes up one half of https:/
- 595. By James Lu
-
Disable and migrate away from Panoramio sources, which no longer work
Based off the patch by Balló György in Arch Linux: https:/
/git.archlinux. org/svntogit/ community. git/tree/ repos/community -any/disable- panoramio. patch?h= packages/ variety& id=7e536e3e6c1a 5311953731b10ed 49760f7eaaa8a - 596. By James Lu
-
Remove PanoramioDownloader and friends
These are unused and depend on a deprecated version of WebKit.
- 597. By James Lu
-
Remove obsolete tests for PanoramioDownloader
- 598. By James Lu
-
Remove unused panoramio pages from data/
Preview Diff
1 | === removed file 'data/panoramio/panoramio.html' |
2 | --- data/panoramio/panoramio.html 2014-07-12 16:42:47 +0000 |
3 | +++ data/panoramio/panoramio.html 1970-01-01 00:00:00 +0000 |
4 | @@ -1,16 +0,0 @@ |
5 | -<!DOCTYPE html> |
6 | -<html> |
7 | - <head> |
8 | - <title>Panoramio Layer</title> |
9 | - <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> |
10 | - <meta charset="utf-8"> |
11 | - <link rel="stylesheet" type="text/css" href="style.css"> |
12 | - <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=panoramio,places"></script> |
13 | - <script type="text/javascript" src="underscore-min.js"></script> |
14 | - <script type="text/javascript" src="panoramio.js"></script> |
15 | - </head> |
16 | - <body> |
17 | - <input id="search" class="controls" type="text" placeholder="Search" style="display: none"> |
18 | - <div id="map-canvas"></div> |
19 | - </body> |
20 | -</html> |
21 | |
22 | === removed file 'data/panoramio/panoramio.js' |
23 | --- data/panoramio/panoramio.js 2014-07-14 21:14:02 +0000 |
24 | +++ data/panoramio/panoramio.js 1970-01-01 00:00:00 +0000 |
25 | @@ -1,101 +0,0 @@ |
26 | -var map; |
27 | - |
28 | -function python(command) { |
29 | - console.log('Python command: ' + command); |
30 | - window.status = new Date().getTime() + '|' + command; |
31 | -} |
32 | - |
33 | -function initialize() { |
34 | - var mapOptions = { |
35 | - zoom: 1, |
36 | - center: new google.maps.LatLng(0, 20) |
37 | - //mapTypeId: google.maps.MapTypeId.SATELLITE |
38 | - }; |
39 | - |
40 | - map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); |
41 | - |
42 | - var panoramioLayer = new google.maps.panoramio.PanoramioLayer(); |
43 | - panoramioLayer.setMap(map); |
44 | - |
45 | - // Create the search box and link it to the UI element. |
46 | - var input = document.getElementById('search'); |
47 | - map.controls[google.maps.ControlPosition.TOP_LEFT].push(input); |
48 | - var searchBox = new google.maps.places.SearchBox(input); |
49 | - |
50 | - // Listen for the event fired when the user selects an item from the |
51 | - // pick list. Retrieve the matching places for that item. |
52 | - google.maps.event.addListener(searchBox, 'places_changed', function () { |
53 | - var places = searchBox.getPlaces(); |
54 | - |
55 | - if (places.length == 0) { |
56 | - return; |
57 | - } |
58 | - |
59 | - var bounds = new google.maps.LatLngBounds(); |
60 | - for (var i = 0, place; place = places[i]; i++) { |
61 | - if (place.geometry.viewport) { |
62 | - bounds.union(place.geometry.viewport); |
63 | - } else { |
64 | - bounds.extend(place.geometry.location); |
65 | - } |
66 | - } |
67 | - |
68 | - map.fitBounds(bounds); |
69 | - }); |
70 | - |
71 | - // Bias the SearchBox results towards places that are within the bounds of the |
72 | - // current map's viewport. |
73 | - google.maps.event.addListener(map, 'bounds_changed', function () { |
74 | - var bounds = map.getBounds(); |
75 | - searchBox.setBounds(bounds); |
76 | - }); |
77 | - |
78 | - google.maps.event.addListenerOnce(map, 'idle', function () { |
79 | - document.getElementById('search').style.display = 'block'; |
80 | - }); |
81 | -} |
82 | - |
83 | -function setLocation(json) { |
84 | - var l = JSON.parse(json, jsonReviver); |
85 | - map.setZoom(l["zoom"]); |
86 | - map.setCenter(l["center"]); |
87 | - if (l["search"]) { |
88 | - document.getElementById('search').value = l["search"]; |
89 | - } |
90 | -} |
91 | - |
92 | -function reportLocation() { |
93 | - var search = document.getElementById('search').value.trim(); |
94 | - var data = _.extend((search ? {search: search} : {}), { |
95 | - zoom: map.getZoom(), |
96 | - center: map.getCenter(), |
97 | - minx: map.getBounds().getSouthWest().lng(), |
98 | - miny: map.getBounds().getSouthWest().lat(), |
99 | - maxx: map.getBounds().getNorthEast().lng(), |
100 | - maxy: map.getBounds().getNorthEast().lat() |
101 | - }); |
102 | - var json = JSON.stringify(data, jsonReplacer); |
103 | - console.log("Reporting location: " + json); |
104 | - python('location:' + json); |
105 | -} |
106 | - |
107 | -function jsonReplacer(k, v) { |
108 | - if (v instanceof google.maps.LatLng) { |
109 | - return {lat: v.lat(), lng: v.lng()}; |
110 | - } else if (v instanceof google.maps.LatLngBounds) { |
111 | - return {sw: v.getSouthWest(), ne: v.getNorthEast()} |
112 | - } |
113 | - return v; |
114 | -} |
115 | - |
116 | -function jsonReviver(k, v) { |
117 | - if (_.isEqual(_.isObject(v) && _.keys(v).sort(), ['lat', 'lng'])) { |
118 | - return new google.maps.LatLng(v.lat, v.lng); |
119 | - } else if (_.isEqual(_.isObject(v) && _.keys(v).sort(), ['sw', 'ne'])) { |
120 | - return new google.maps.LatLngBounds(v.sw, v.ne); |
121 | - } |
122 | - return v; |
123 | -} |
124 | - |
125 | -google.maps.event.addDomListener(window, 'load', initialize); |
126 | - |
127 | |
128 | === removed file 'data/panoramio/style.css' |
129 | --- data/panoramio/style.css 2014-07-12 16:42:47 +0000 |
130 | +++ data/panoramio/style.css 1970-01-01 00:00:00 +0000 |
131 | @@ -1,67 +0,0 @@ |
132 | -html, body, #map-canvas { |
133 | - height: 100%; |
134 | - margin: 0px; |
135 | - padding: 0px |
136 | -} |
137 | - |
138 | -#panel { |
139 | - position: absolute; |
140 | - top: 5px; |
141 | - left: 50%; |
142 | - margin-left: -180px; |
143 | - z-index: 5; |
144 | - background-color: #fff; |
145 | - padding: 5px; |
146 | - border: 1px solid #999; |
147 | -} |
148 | - |
149 | -html, body, #map-canvas { |
150 | - height: 100%; |
151 | - margin: 0px; |
152 | - padding: 0px |
153 | -} |
154 | - |
155 | -.controls { |
156 | - margin-top: 16px; |
157 | - border: 1px solid transparent; |
158 | - border-radius: 2px 0 0 2px; |
159 | - box-sizing: border-box; |
160 | - -moz-box-sizing: border-box; |
161 | - height: 32px; |
162 | - outline: none; |
163 | - box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); |
164 | -} |
165 | - |
166 | -#search { |
167 | - background-color: #fff; |
168 | - padding: 0 11px 0 13px; |
169 | - width: 400px; |
170 | - font-family: Roboto; |
171 | - font-size: 15px; |
172 | - font-weight: 300; |
173 | - text-overflow: ellipsis; |
174 | - box-shadow: 5px 5px 10px #444; |
175 | -} |
176 | - |
177 | -#search:focus { |
178 | - border-color: #4d90fe; |
179 | - margin-left: -1px; |
180 | - padding-left: 14px; /* Regular padding-left + 1. */ |
181 | - width: 401px; |
182 | -} |
183 | - |
184 | -.pac-container { |
185 | - font-family: Roboto; |
186 | -} |
187 | - |
188 | -#type-selector { |
189 | - color: #fff; |
190 | - background-color: #4d90fe; |
191 | - padding: 5px 11px 0px 11px; |
192 | -} |
193 | - |
194 | -#type-selector label { |
195 | - font-family: Roboto; |
196 | - font-size: 13px; |
197 | - font-weight: 300; |
198 | -} |
199 | |
200 | === removed file 'data/panoramio/underscore-min.js' |
201 | --- data/panoramio/underscore-min.js 2014-07-12 16:42:47 +0000 |
202 | +++ data/panoramio/underscore-min.js 1970-01-01 00:00:00 +0000 |
203 | @@ -1,6 +0,0 @@ |
204 | -// Underscore.js 1.6.0 |
205 | -// http://underscorejs.org |
206 | -// (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors |
207 | -// Underscore may be freely distributed under the MIT license. |
208 | -(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])<u?i=o+1:a=o}return i},j.toArray=function(n){return n?j.isArray(n)?o.call(n):n.length===+n.length?j.map(n,j.identity):j.values(n):[]},j.size=function(n){return null==n?0:n.length===+n.length?n.length:j.keys(n).length},j.first=j.head=j.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:0>t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r<arguments.length;)e.push(arguments[r++]);return n.apply(this,e)}},j.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw new Error("bindAll must be passed function names");return A(t,function(t){n[t]=j.bind(n[t],n)}),n},j.memoize=function(n,t){var r={};return t||(t=j.identity),function(){var e=t.apply(this,arguments);return j.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},j.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},j.defer=function(n){return j.delay.apply(j,[n,1].concat(o.call(arguments,1)))},j.throttle=function(n,t,r){var e,u,i,a=null,o=0;r||(r={});var c=function(){o=r.leading===!1?0:j.now(),a=null,i=n.apply(e,u),e=u=null};return function(){var l=j.now();o||r.leading!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this); |
209 | -//# sourceMappingURL=underscore-min.map |
210 | \ No newline at end of file |
211 | |
212 | === removed file 'tests/TestPanoramioDownloader.py' |
213 | --- tests/TestPanoramioDownloader.py 2016-06-04 09:11:18 +0000 |
214 | +++ tests/TestPanoramioDownloader.py 1970-01-01 00:00:00 +0000 |
215 | @@ -1,34 +0,0 @@ |
216 | -#!/usr/bin/python2 |
217 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
218 | -### BEGIN LICENSE |
219 | -# Copyright (c) 2012, Peter Levi <peterlevi@peterlevi.com> |
220 | -# This program is free software: you can redistribute it and/or modify it |
221 | -# under the terms of the GNU General Public License version 3, as published |
222 | -# by the Free Software Foundation. |
223 | -# |
224 | -# This program is distributed in the hope that it will be useful, but |
225 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
226 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
227 | -# PURPOSE. See the GNU General Public License for more details. |
228 | -# |
229 | -# You should have received a copy of the GNU General Public License along |
230 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
231 | -### END LICENSE |
232 | - |
233 | -import sys |
234 | -import os.path |
235 | -import unittest |
236 | -from TestDownloader import test_download_one_for |
237 | - |
238 | -sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))) |
239 | - |
240 | -from variety.PanoramioDownloader import PanoramioDownloader |
241 | - |
242 | - |
243 | -class TestPanoramioDownloader(unittest.TestCase): |
244 | - def test_download_one(self): |
245 | - test_download_one_for(self, PanoramioDownloader( |
246 | - None, '{"zoom":1,"center":{"lat":0,"lng":20},"minx":-180,"miny":-83.82994542398042,"maxx":180,"maxy":83.82994542398042}')) |
247 | - |
248 | -if __name__ == '__main__': |
249 | - unittest.main() |
250 | |
251 | === removed file 'variety/AddPanoramioDialog.py' |
252 | --- variety/AddPanoramioDialog.py 2017-04-27 20:38:59 +0000 |
253 | +++ variety/AddPanoramioDialog.py 1970-01-01 00:00:00 +0000 |
254 | @@ -1,114 +0,0 @@ |
255 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
256 | -### BEGIN LICENSE |
257 | -# Copyright (c) 2012, Peter Levi <peterlevi@peterlevi.com> |
258 | -# This program is free software: you can redistribute it and/or modify it |
259 | -# under the terms of the GNU General Public License version 3, as published |
260 | -# by the Free Software Foundation. |
261 | -# |
262 | -# This program is distributed in the hope that it will be useful, but |
263 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
264 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
265 | -# PURPOSE. See the GNU General Public License for more details. |
266 | -# |
267 | -# You should have received a copy of the GNU General Public License along |
268 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
269 | -### END LICENSE |
270 | -import json |
271 | - |
272 | -import logging |
273 | -import gi |
274 | -gi.require_version('WebKit', '3.0') |
275 | - |
276 | -from gi.repository import Gtk, WebKit, GObject # pylint: disable=E0611 |
277 | -from variety.Options import Options |
278 | -from variety_lib.helpers import get_builder |
279 | -from variety import _, _u |
280 | -from variety_lib import varietyconfig |
281 | - |
282 | -logger = logging.getLogger('variety') |
283 | - |
284 | -class AddPanoramioDialog(Gtk.Dialog): |
285 | - __gtype_name__ = "AddPanoramioDialog" |
286 | - |
287 | - def __new__(cls): |
288 | - """Special static method that's automatically called by Python when |
289 | - constructing a new instance of this class. |
290 | - |
291 | - Returns a fully instantiated AddPanoramioDialog object. |
292 | - """ |
293 | - builder = get_builder('AddPanoramioDialog') |
294 | - new_object = builder.get_object('add_panoramio_dialog') |
295 | - new_object.finish_initializing(builder) |
296 | - return new_object |
297 | - |
298 | - def finish_initializing(self, builder): |
299 | - """Called when we're finished initializing. |
300 | - |
301 | - finish_initalizing should be called after parsing the ui definition |
302 | - and creating a AddPanoramioDialog object with it in order to |
303 | - finish initializing the start of the new AddPanoramioDialog |
304 | - instance. |
305 | - """ |
306 | - # Get a reference to the builder and set up the signals. |
307 | - self.builder = builder |
308 | - self.ui = builder.get_ui(self) |
309 | - self.edited_row = None |
310 | - self.load_map() |
311 | - |
312 | - def set_edited_row(self, edited_row): |
313 | - self.edited_row = edited_row |
314 | - js = "setLocation('" + edited_row[2] + "')" |
315 | - self.js(js) |
316 | - |
317 | - def path2url(self, path): |
318 | - import urllib |
319 | - return 'file://' + urllib.pathname2url(path) |
320 | - |
321 | - def js(self, command): |
322 | - logger.debug(lambda: 'Panoramio: js(%s)' % command) |
323 | - if hasattr(self, "web_view_loaded"): |
324 | - GObject.idle_add(lambda: self.web_view.execute_script(command)) |
325 | - else: |
326 | - GObject.timeout_add(100, lambda: self.js(command)) |
327 | - |
328 | - def on_js_action(self, action, argument): |
329 | - if action == 'location': |
330 | - location = argument |
331 | - self.parent.on_add_dialog_okay(Options.SourceType.PANORAMIO, location, self.edited_row) |
332 | - self.destroy() |
333 | - |
334 | - def load_map(self): |
335 | - with open(varietyconfig.get_data_file('panoramio/panoramio.html')) as f: |
336 | - html = f.read() |
337 | - |
338 | - self.web_view = WebKit.WebView() |
339 | - |
340 | - def nav(wv, command): |
341 | - if command: |
342 | - logger.info(lambda: 'Received command: ' + command) |
343 | - command = command[command.index('|') + 1:] |
344 | - index = command.index(':') |
345 | - action = command[:index] |
346 | - argument = command[index + 1:] |
347 | - self.on_js_action(action, argument) |
348 | - self.web_view.connect("status-bar-text-changed", nav) |
349 | - |
350 | - def _loaded(wv, data): |
351 | - self.web_view_loaded = True |
352 | - self.web_view.connect('document-load-finished', _loaded) |
353 | - |
354 | - self.web_view.load_string(html, "text/html", "UTF-8", self.path2url(varietyconfig.get_data_path()) + '/panoramio/') |
355 | - self.web_view.set_visible(True) |
356 | - self.ui.scrolledwindow.add(self.web_view) |
357 | - |
358 | - def on_btn_ok_clicked(self, widget, data=None): |
359 | - self.js('reportLocation()') |
360 | - |
361 | - def on_btn_cancel_clicked(self, widget, data=None): |
362 | - self.destroy() |
363 | - |
364 | - |
365 | -if __name__ == "__main__": |
366 | - dialog = AddPanoramioDialog() |
367 | - dialog.show() |
368 | - Gtk.main() |
369 | |
370 | === modified file 'variety/Options.py' |
371 | --- variety/Options.py 2016-10-28 17:11:56 +0000 |
372 | +++ variety/Options.py 2017-06-30 21:10:38 +0000 |
373 | @@ -42,7 +42,6 @@ |
374 | APOD = 8 |
375 | MEDIA_RSS = 10 |
376 | EARTH = 11 |
377 | - PANORAMIO = 12 |
378 | WALLHAVEN = 13 |
379 | REDDIT = 14 |
380 | BING = 15 |
381 | @@ -60,7 +59,6 @@ |
382 | APOD: "apod", |
383 | MEDIA_RSS: "mediarss", |
384 | EARTH: "earth", |
385 | - PANORAMIO: "panoramio", |
386 | WALLHAVEN: "wallhaven", |
387 | REDDIT: "reddit", |
388 | BING: "bing", |
389 | @@ -72,7 +70,7 @@ |
390 | str_to_type = dict((v,k) for k, v in type_to_str.items()) |
391 | |
392 | dl_types = [DESKTOPPR, FLICKR, APOD, MEDIA_RSS, EARTH, |
393 | - PANORAMIO, WALLHAVEN, REDDIT, BING, UNSPLASH, RECOMMENDED, LATEST] |
394 | + WALLHAVEN, REDDIT, BING, UNSPLASH, RECOMMENDED, LATEST] |
395 | |
396 | class LightnessMode: |
397 | DARK = 0 |
398 | |
399 | === removed file 'variety/PanoramioDownloader.py' |
400 | --- variety/PanoramioDownloader.py 2015-01-11 12:27:48 +0000 |
401 | +++ variety/PanoramioDownloader.py 1970-01-01 00:00:00 +0000 |
402 | @@ -1,126 +0,0 @@ |
403 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
404 | -### BEGIN LICENSE |
405 | -# Copyright (c) 2012, Peter Levi <peterlevi@peterlevi.com> |
406 | -# This program is free software: you can redistribute it and/or modify it |
407 | -# under the terms of the GNU General Public License version 3, as published |
408 | -# by the Free Software Foundation. |
409 | -# |
410 | -# This program is distributed in the hope that it will be useful, but |
411 | -# WITHOUT ANY WARRANTY; without even the implied warranties of |
412 | -# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
413 | -# PURPOSE. See the GNU General Public License for more details. |
414 | -# |
415 | -# You should have received a copy of the GNU General Public License along |
416 | -# with this program. If not, see <http://www.gnu.org/licenses/>. |
417 | -### END LICENSE |
418 | -import os |
419 | -import urllib |
420 | -import json |
421 | -import random |
422 | - |
423 | -import logging |
424 | -import time |
425 | -from variety import Downloader |
426 | -from variety.Util import Util |
427 | -from variety_lib import varietyconfig |
428 | - |
429 | -logger = logging.getLogger('variety') |
430 | - |
431 | -random.seed() |
432 | - |
433 | -class PanoramioDownloader(Downloader.Downloader): |
434 | - API_URL = "http://www.panoramio.com/map/get_panoramas.php?set=public&from=%d&to=%d&minx=%s&miny=%s&maxx=%s&maxy=%s&size=original" |
435 | - |
436 | - last_download_time = 0 |
437 | - |
438 | - def __init__(self, parent, location): |
439 | - super(PanoramioDownloader, self).__init__(parent, "panoramio", "Panoramio", location) |
440 | - self.parse_location() |
441 | - self.last_fill_time = 0 |
442 | - self.queue = [] |
443 | - |
444 | - def convert_to_filename(self, url): |
445 | - return "panoramio_" + super(PanoramioDownloader, self).convert_to_filename(url) |
446 | - |
447 | - def parse_location(self): |
448 | - data = json.loads(self.location) |
449 | - self.minx = data['minx'] |
450 | - self.miny = data['miny'] |
451 | - self.maxx = data['maxx'] |
452 | - self.maxy = data['maxy'] |
453 | - |
454 | - def search(self, _from, _to): |
455 | - url = PanoramioDownloader.API_URL % (_from, _to, self.minx, self.miny, self.maxx, self.maxy) |
456 | - logger.info(lambda: "Performing Panoramio API call: url=%s" % url) |
457 | - return Util.fetch_json(url) |
458 | - |
459 | - def download_one(self): |
460 | - min_download_interval, min_fill_queue_interval = self.parse_server_options("panoramio", 0, 0) |
461 | - |
462 | - if time.time() - PanoramioDownloader.last_download_time < min_download_interval: |
463 | - logger.info(lambda: "Minimal interval between Panoramio downloads is %d, skip this attempt" % min_download_interval) |
464 | - return None |
465 | - |
466 | - logger.info(lambda: "Downloading an image from Panoramio, " + self.location) |
467 | - logger.info(lambda: "Queue size: %d" % len(self.queue)) |
468 | - |
469 | - if not self.queue: |
470 | - if time.time() - self.last_fill_time < min_fill_queue_interval: |
471 | - logger.info(lambda: "Panoramio queue empty, but minimal interval between fill attempts is %d, " |
472 | - "will try again later" % min_fill_queue_interval) |
473 | - return None |
474 | - |
475 | - self.fill_queue() |
476 | - |
477 | - if not self.queue: |
478 | - logger.info(lambda: "Panoramio queue still empty after fill request") |
479 | - return None |
480 | - |
481 | - PanoramioDownloader.last_download_time = time.time() |
482 | - |
483 | - photo = self.queue.pop() |
484 | - image = self.save_locally(photo["photo_url"], |
485 | - photo["photo_file_url"], |
486 | - extra_metadata={"author": photo["owner_name"], |
487 | - "authorURL": photo["owner_url"], |
488 | - "headline": photo["photo_title"]}) |
489 | - |
490 | - # Uncomment to overlay Panoramio logo: |
491 | - # logo = os.path.join(varietyconfig.get_data_path(), 'panoramio/logo.png') |
492 | - # logo_command = u"mogrify -gravity SouthEast -draw 'image Over 70,70 0,0 \"%s\"' \"%s\"" % (logo, image) |
493 | - # os.system(logo_command.encode('utf8')) |
494 | - |
495 | - return image |
496 | - |
497 | - def fill_queue(self): |
498 | - self.last_fill_time = time.time() |
499 | - |
500 | - logger.info(lambda: "Filling Panoramio queue: " + self.location) |
501 | - |
502 | - total_count = int(self.search(0, 0)["count"]) |
503 | - _from = random.randint(0, max(0, total_count - 100)) |
504 | - _to = min(_from + 100, total_count) |
505 | - |
506 | - data = self.search(_from, _to) |
507 | - |
508 | - for photo in data["photos"]: |
509 | - try: |
510 | - width = int(photo["width"]) |
511 | - height = int(photo["height"]) |
512 | - if self.parent and not self.parent.size_ok(width, height): |
513 | - continue |
514 | - if self.parent and photo["photo_url"] in self.parent.banned: |
515 | - continue |
516 | - except Exception: |
517 | - # consider ok |
518 | - pass |
519 | - |
520 | - self.queue.append(photo) |
521 | - |
522 | - random.shuffle(self.queue) |
523 | - |
524 | - if len(self.queue) >= 20: |
525 | - self.queue = self.queue[:len(self.queue)//2] |
526 | - # only use randomly half the images - if we ever hit the same page again, we'll still have what to download |
527 | - |
528 | - logger.info(lambda: "Panoramio queue populated with %d URLs" % len(self.queue)) |
529 | |
530 | === modified file 'variety/PreferencesVarietyDialog.py' |
531 | --- variety/PreferencesVarietyDialog.py 2017-02-05 11:08:46 +0000 |
532 | +++ variety/PreferencesVarietyDialog.py 2017-06-30 21:10:38 +0000 |
533 | @@ -32,7 +32,6 @@ |
534 | from variety.AddFlickrDialog import AddFlickrDialog |
535 | from variety.AddMediaRssDialog import AddMediaRssDialog |
536 | from variety.AddRedditDialog import AddRedditDialog |
537 | -from variety.AddPanoramioDialog import AddPanoramioDialog |
538 | from variety.EditFavoriteOperationsDialog import EditFavoriteOperationsDialog |
539 | from variety.SmartFeaturesConfirmationDialog import SmartFeaturesConfirmationDialog |
540 | from variety.LoginOrRegisterDialog import LoginOrRegisterDialog |
541 | @@ -64,7 +63,6 @@ |
542 | EDITABLE_TYPES = [ |
543 | Options.SourceType.FLICKR, |
544 | Options.SourceType.MEDIA_RSS, |
545 | - Options.SourceType.PANORAMIO, |
546 | Options.SourceType.WALLHAVEN, |
547 | Options.SourceType.REDDIT, |
548 | ] |
549 | @@ -381,7 +379,6 @@ |
550 | '-', |
551 | (_("Flickr"), self.on_add_flickr_clicked), |
552 | (_("Wallhaven.cc"), self.on_add_wallhaven_clicked), |
553 | - (_("Panoramio"), self.on_add_panoramio_clicked), |
554 | (_("Reddit"), self.on_add_reddit_clicked), |
555 | (_("Media RSS"), self.on_add_mediarss_clicked), |
556 | ] |
557 | @@ -672,8 +669,6 @@ |
558 | self.dialog = AddRedditDialog() |
559 | elif type == Options.SourceType.MEDIA_RSS: |
560 | self.dialog = AddMediaRssDialog() |
561 | - elif type == Options.SourceType.PANORAMIO: |
562 | - self.dialog = AddPanoramioDialog() |
563 | |
564 | self.dialog.set_edited_row(edited_row) |
565 | self.show_dialog(self.dialog) |
566 | @@ -786,9 +781,6 @@ |
567 | def on_add_wallhaven_clicked(self, widget=None): |
568 | self.show_dialog(AddWallhavenDialog()) |
569 | |
570 | - def on_add_panoramio_clicked(self, widget=None): |
571 | - self.show_dialog(AddPanoramioDialog()) |
572 | - |
573 | def show_dialog(self, dialog): |
574 | self.dialog = dialog |
575 | self.dialog.parent = self |
576 | |
577 | === modified file 'variety/VarietyWindow.py' |
578 | --- variety/VarietyWindow.py 2017-04-29 05:20:33 +0000 |
579 | +++ variety/VarietyWindow.py 2017-06-30 21:10:38 +0000 |
580 | @@ -56,7 +56,6 @@ |
581 | from variety.RedditDownloader import RedditDownloader |
582 | from variety.BingDownloader import BingDownloader |
583 | from variety.UnsplashDownloader import UnsplashDownloader |
584 | -from variety.PanoramioDownloader import PanoramioDownloader |
585 | from variety.DesktopprDownloader import DesktopprDownloader |
586 | from variety.APODDownloader import APODDownloader |
587 | from variety.FlickrDownloader import FlickrDownloader |
588 | @@ -542,8 +541,6 @@ |
589 | return UnsplashDownloader(self) |
590 | elif type == Options.SourceType.MEDIA_RSS: |
591 | return MediaRssDownloader(self, location) |
592 | - elif type == Options.SourceType.PANORAMIO: |
593 | - return PanoramioDownloader(self, location) |
594 | elif type == Options.SourceType.RECOMMENDED: |
595 | if self.smart.user: |
596 | return MediaRssDownloader(self, '%s/user/%s/recommended/rss' % (Smart.SITE_URL, self.smart.user["id"])) |