2.7.2-2.7.3版本应用中自定义图片源规则写法的变更
<p><a href="https://www.microsoft.com/store/apps/9MZRGV880V9N">点击这里</a>前往商店可以更新应用至最新版本。</p>
<p><a href="https://www.showdoc.com.cn/DailyPicsUWP/7273160488427022">点击这里</a>查看最新的自定义图片源规则写法。</p>
<h1>规则写法变更示例</h1>
<p>这是2.7.1及以下版本的必应壁纸规则写法</p>
<pre><code>{
&quot;mode&quot;:&quot;2&quot;,
&quot;api&quot;:&quot;https://cn.bing.com/HPImageArchive.aspx?format=js&amp;idx={0}&amp;n={1}&quot;,
&quot;roottype&quot;:&quot;object&quot;,
&quot;para&quot;:[
{
&quot;start&quot;:0,
&quot;stride&quot;:4
},
{
&quot;start&quot;:4,
&quot;stride&quot;:0
}
],
&quot;path&quot;:[
{
&quot;node&quot;:&quot;images&quot;,
&quot;type&quot;:&quot;array&quot;
}
],
&quot;model&quot;:{
&quot;uri&quot;:[
{
&quot;node&quot;:&quot;urlbase&quot;,
&quot;type&quot;:&quot;string&quot;
},
{
&quot;node&quot;:&quot;https://www.bing.com&quot;,
&quot;type&quot;:&quot;left&quot;
},
{
&quot;node&quot;:&quot;_1920x1080.jpg&quot;,
&quot;type&quot;:&quot;right&quot;
}
],
&quot;thumb&quot;:[
{
&quot;node&quot;:&quot;urlbase&quot;,
&quot;type&quot;:&quot;string&quot;
},
{
&quot;node&quot;:&quot;https://www.bing.com&quot;,
&quot;type&quot;:&quot;left&quot;
},
{
&quot;node&quot;:&quot;_800x480.jpg&quot;,
&quot;type&quot;:&quot;right&quot;
}
],
&quot;title&quot;:[
{
&quot;node&quot;:&quot;copyright&quot;,
&quot;type&quot;:&quot;string&quot;
},
{
&quot;node&quot;:&quot;,&amp;0&quot;,
&quot;type&quot;:&quot;split&quot;
}
],
&quot;details&quot;:[
{
&quot;node&quot;:&quot;&quot;,
&quot;type&quot;:&quot;default&quot;
}
],
&quot;date&quot;:[
{
&quot;node&quot;:&quot;enddate&quot;,
&quot;type&quot;:&quot;string&quot;
}
],
&quot;dateformat&quot;:&quot;yyyyMMdd&quot;,
&quot;copyright&quot;:[
{
&quot;node&quot;:&quot;copyright&quot;,
&quot;type&quot;:&quot;string&quot;
},
{
&quot;node&quot;:&quot;(?&lt;=[((])[^()()]*(?=[))])&quot;,
&quot;type&quot;:&quot;regex&quot;
}
],
&quot;size&quot;:[
{
&quot;node&quot;:&quot;1920x1080&quot;,
&quot;type&quot;:&quot;default&quot;
}
]
}
}
</code></pre>
<p>这是与之对应的新版本的解析规则的写法</p>
<pre><code>{
&quot;mode&quot;:&quot;2&quot;,
&quot;api&quot;:&quot;https://cn.bing.com/HPImageArchive.aspx?format=js&amp;idx={0}&amp;n={1}&quot;,
&quot;para&quot;:[
{
&quot;start&quot;:0,
&quot;stride&quot;:4
},
{
&quot;start&quot;:4,
&quot;stride&quot;:0
}
],
&quot;path&quot;:[
{
&quot;node&quot;:&quot;images&quot;
}
],
&quot;model&quot;:{
&quot;uri&quot;:[
{
&quot;node&quot;:&quot;urlbase&quot;
},
{
&quot;value&quot;:&quot;https://www.bing.com&quot;,
&quot;type&quot;:&quot;left&quot;
},
{
&quot;value&quot;:&quot;_1920x1080.jpg&quot;,
&quot;type&quot;:&quot;right&quot;
}
],
&quot;display&quot;:[
{
&quot;node&quot;:&quot;urlbase&quot;
},
{
&quot;value&quot;:&quot;https://www.bing.com&quot;,
&quot;type&quot;:&quot;left&quot;
},
{
&quot;value&quot;:&quot;_1920x1080.jpg&quot;,
&quot;type&quot;:&quot;right&quot;
}
],
&quot;thumb&quot;:[
{
&quot;node&quot;:&quot;urlbase&quot;
},
{
&quot;value&quot;:&quot;https://www.bing.com&quot;,
&quot;type&quot;:&quot;left&quot;
},
{
&quot;value&quot;:&quot;_800x480.jpg&quot;,
&quot;type&quot;:&quot;right&quot;
}
],
&quot;title&quot;:[
{
&quot;node&quot;:&quot;copyright&quot;
},
{
&quot;value&quot;:&quot;,&amp;0&quot;,
&quot;type&quot;:&quot;split&quot;
}
],
&quot;details&quot;:[
{
&quot;default&quot;:&quot;&quot;
}
],
&quot;date&quot;:[
{
&quot;node&quot;:&quot;enddate&quot;
}
],
&quot;dateformat&quot;:&quot;yyyyMMdd&quot;,
&quot;copyright&quot;:[
{
&quot;node&quot;:&quot;copyright&quot;
}
],
&quot;size&quot;:[
{
&quot;default&quot;:&quot;1920x1080&quot;
}
]
}
}</code></pre>
<h1>具体变更的地方:</h1>
<ul>
<li>您无需再指定<code>roottype</code>,解析器会自动解析json数据的格式</li>
<li><code>path</code>结点下,您无需再指定<code>type</code>,解析器会自动解析json数据的格式</li>
<li><code>model</code>结点下,对于每一个对象,无需在对象内指定<code>&quot;type&quot;:&quot;string&quot;</code>或<code>type:&quot;number&quot;</code>等等,直接指定<code>&quot;node&quot;:xxx</code>即可;此外,对象内的<code>type</code>将与<code>value</code>配合使用,以前版本的规则内没有<code>value</code>这一项,您在变更时,可能需要将<code>&quot;node&quot;</code>改为<code>&quot;value&quot;</code>。如果是要指定默认值,直接用<code>&quot;default&quot;:xxx</code>指定即可。</li>
<li>您可能会注意到,上面新版的解析规则少了
<pre><code>{
&quot;node&quot;:&quot;(?&lt;=[((])[^()()]*(?=[))])&quot;,
&quot;type&quot;:&quot;regex&quot;
}</code></pre>
<p>这是因为正则表达式的功能似乎在新版本遇到了一些bug,我正在排查此问题,如果排查成功,我将在2.7.4版本修正此问题,并更新本文档。</p></li>
</ul>