From 1d71ac073d140664b091b4a1e2b5958c44b50a0d Mon Sep 17 00:00:00 2001 From: Wolfgang Rumpler Date: Sat, 7 Oct 2017 19:25:26 +0200 Subject: [PATCH] Add prefix for image url. This is needed for relative urls that do not contain the domain (e.g.: Bing picture of the day). Closes #22 --- randomwallpaper@iflow.space/prefs.js | 4 ++ .../schemas/gschemas.compiled | Bin 2760 -> 2832 bytes ...ns.space.iflow.randomwallpaper.gschema.xml | 5 +++ randomwallpaper@iflow.space/settings.ui | 37 ++++++++++++++++++ randomwallpaper@iflow.space/sourceAdapter.js | 1 + 5 files changed, 47 insertions(+) diff --git a/randomwallpaper@iflow.space/prefs.js b/randomwallpaper@iflow.space/prefs.js index 7a924bf..d839d13 100644 --- a/randomwallpaper@iflow.space/prefs.js +++ b/randomwallpaper@iflow.space/prefs.js @@ -224,6 +224,10 @@ const RandomWallpaperSettings = new Lang.Class({ this._builder.get_object('generic-json-response-path'), 'text', Gio.SettingsBindFlags.DEFAULT); + this._generic_json_settings.bind('generic-json-url-prefix', + this._builder.get_object('generic-json-url-prefix'), + 'text', + Gio.SettingsBindFlags.DEFAULT); } }); diff --git a/randomwallpaper@iflow.space/schemas/gschemas.compiled b/randomwallpaper@iflow.space/schemas/gschemas.compiled index 9fc79979329ae7a063d8af2532606edc7bcdc621..86238554d0509b533519ca409de5ce1da16d7146 100644 GIT binary patch delta 786 zcmY+CKWGzi6vtoET$(h*1WUA5T@<7u*{ZZc0$rp8QBY7&aH&_RXl>J85L%nfMTbBv z7C~?n|DhH!gJKpj2(_XJb+8m%1Wj?XL)-ZI9vtYw_defz-@Erq-ldVLY^zKcrXyyv zFLTR|ndP`0vO$}KPoriJ&RlOQ_hM!Phs9n9>&n+Ut#VS+)=kUGL*eIab+~?6)$DSitg~pRkLcc?Ns-F z)uKD@xf7G>qTGy3m9?67#@FC$RQNdXPQ&GuH{f@)qceY8xqOCv4Q?RsR^h91`3~|} zyIB$idyv;2(y$lpTRga`e)%m{D%&7t2$fogcc~yBWzZP>guXmHw_mw@iu?!sjY^+y zrBpVkbr z-6&K{98oSGC+~q-6r3rqGyC8ay0hocruyaiu~vbzD08ykl*{v*j@f<8V|4T9fy*k$ iCwZU_-=gKY1wWV9mtTV4P_SirZFvQ*&yUAXhyDW2R;gV8 delta 722 zcmXw%Pe>GD7{=e(byjzmRFaj{x+H{B)}ay%T=WvM^att?bPzoRdl8pa7ZG(lb*K&t zqa=0dC>o-;(w|Fvi58+CcgEhX}^sgXLf zrBD5Pu9^LVdu_;W@Q{v}tv-Kwq`arWY>+&IPe#q$gjtoV5M$6Dn7kD8e>;7f)uWI{ zmEdx?ht5@;n~!UWwsS3KX?#t5UP`P|AMpaJ7L(grFK%ak8LyykcRueZ7hfVj!S&iV zGozDf@>}CszcV~gZ($xn=Fil1`W^0-aMwh)Uv_%^3Af)^=$;ZmY3Gxkm8%-^yc9n}`8uZ*_b)AIukDRDHasVQW2- z40-yFak2&cD_Vc;Jz+TDX4N38ASWBYuUs4@|BLUV+MZ(Vd4k{OKX`Zb^uOkdY1W4D zhbZy1&y5+{9FVLHV>th-aUtqyBK8N;}e+9W%FQ3PkQ0JSON Path The JSON path that describes the picture URL. + + "" + Image URL prefix + This prefix is added to the final image URL. + diff --git a/randomwallpaper@iflow.space/settings.ui b/randomwallpaper@iflow.space/settings.ui index 8c54bd8..2134cbd 100644 --- a/randomwallpaper@iflow.space/settings.ui +++ b/randomwallpaper@iflow.space/settings.ui @@ -153,6 +153,43 @@ You have to specify an URL to a JSON response and a path to the target picture u 3 + + + True + False + vertical + + + True + False + start + Image URL prefix + + + False + True + 0 + + + + + True + True + Image URL prefix + + + False + True + 1 + + + + + False + True + 4 + + 1 diff --git a/randomwallpaper@iflow.space/sourceAdapter.js b/randomwallpaper@iflow.space/sourceAdapter.js index 684482c..6b80657 100644 --- a/randomwallpaper@iflow.space/sourceAdapter.js +++ b/randomwallpaper@iflow.space/sourceAdapter.js @@ -296,6 +296,7 @@ let GenericJsonAdapter = new Lang.Class({ let response = JSON.parse(message.response_body.data); let JSONPath = this._settings.get("generic-json-response-path", "string"); let imageUrl = this._jsonPathParser.access(response, JSONPath); + imageUrl = this._settings.get("generic-json-url-prefix", "string")+imageUrl; if (callback) { let historyEntry = new HistoryModule.HistoryEntry(null, 'Generic JSON Source', imageUrl);