2
# Copyright 2009, Martin Owens.
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, either version 3 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
List images from a deviantArt search.
21
from gwc.base import add_lister
22
from gwc.rssbase import rssBase
24
class deviantLister(rssBase):
25
"""DeviantArt wallpaper search listing (via RSS)"""
27
variables = [ 'folder', 'search' ]
29
def __init__(self, folder, search):
30
self._search = unicode(search)
31
rssLister.__init__( self, folder, self.rssurl() )
34
"""Return the URL to get a DeviantArt search RSS result"""
35
return "http://backend.deviantart.com/rss.xml?q=in%3Acustomization/wallpaper%20sort%3Atime%20"+self._search+"&type=deviation"
37
def getItem(self, url):
38
"""Return a single item from this RSS result"""
39
da_page = self.get_url(url)
45
b = da_page.find('}', a)
47
for d in da_page[a:b].replace('"','').replace('\\','').split(','):
48
key,val = d.split(':',1)
50
return lister.getItem(self, meta['src'])