Skip to content

Commit

Permalink
Merge pull request #1447 from philborman/master
Browse files Browse the repository at this point in the history
Rss feed changes to improve compatibility - still not working with some apps
  • Loading branch information
philborman authored Jun 3, 2018
2 parents d7feebb + 55e19b8 commit c7de4d7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion data/interfaces/bookstrap/audio.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
%endif
<a href="audioWall" class="button btn btn-sm btn-primary"><i class="fa fa-calendar-check"></i> Recent AudioBooks</a>
%if lazylibrarian.CONFIG['USER_ACCOUNTS'] == True:
<a href="rssFeed?user=${user}&type=AudioBook&limit=10.xml" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="RSS feed of recent downloads"><i class="fa fa-rss"></i></a>
<a href="rssFeed?user=${user}&type=AudioBook&limit=10.xml" type="application/rss+xml" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="RSS feed of recent downloads"><i class="fa fa-rss"></i></a>
%endif
</div>
<div class="col-xs-2">
Expand Down
2 changes: 1 addition & 1 deletion data/interfaces/bookstrap/books.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a href="bookWall?have=0" class="button btn btn-sm btn-primary"><i class="fa fa-calendar-plus"></i> Additions</a>
<a href="bookWall?have=1" class="button btn btn-sm btn-primary"><i class="fa fa-calendar-alt"></i> Downloads</a>
%if lazylibrarian.CONFIG['USER_ACCOUNTS'] == True:
<a href="rssFeed?user=${user}&type=eBook&limit=10.xml" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="RSS feed of recent downloads"><i class="fa fa-rss"></i></a>
<a href="rssFeed?user=${user}&type=eBook&limit=10.xml" type="application/rss+xml" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="RSS feed of recent downloads"><i class="fa fa-rss"></i></a>
%endif
</div>
%if len(languages) > 1:
Expand Down
2 changes: 1 addition & 1 deletion data/interfaces/bookstrap/magazines.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
%endif
<a href="magWall" class="button btn btn-sm btn-primary"><i class="fa fa-calendar-check"></i> Recent Issues</a>
%if lazylibrarian.CONFIG['USER_ACCOUNTS'] == True:
<a href="rssFeed?user=${user}&type=Magazine&limit=10.xml" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="RSS feed of recent downloads"><i class="fa fa-rss"></i></a>
<a href="rssFeed?user=${user}&type=Magazine&limit=10.xml" type="application/rss+xml" class="button btn btn-sm btn-primary" data-toggle="tooltip" title="RSS feed of recent downloads"><i class="fa fa-rss"></i></a>
%endif
</div>
<div class="clearfix visible-xs"><hr/></div>
Expand Down
14 changes: 10 additions & 4 deletions lazylibrarian/webServe.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
from lazylibrarian.csvfile import import_CSV, export_CSV, dump_table, restore_table
from lazylibrarian.downloadmethods import NZBDownloadMethod, TORDownloadMethod, DirectDownloadMethod
from lazylibrarian.formatter import unaccented, unaccented_str, plural, now, today, check_int, replace_all, \
safe_unicode, cleanName, surnameFirst, sortDefinite, getList, makeUnicode, md5_utf8, dateFormat, check_year
safe_unicode, cleanName, surnameFirst, sortDefinite, getList, makeUnicode, makeBytestr, md5_utf8, dateFormat, \
check_year
from lazylibrarian.gb import GoogleBooks
from lazylibrarian.gr import GoodReads
from lazylibrarian.images import getBookCover
Expand Down Expand Up @@ -1809,6 +1810,8 @@ def mimetype(filename):
return 'application/pdf'
elif name.endswith('.mp3'):
return 'audio/mpeg3'
elif name.endswith('.xml'):
return 'application/rss+xml'
return "application/x-download"

@cherrypy.expose
Expand Down Expand Up @@ -3439,11 +3442,14 @@ def rssFeed(self, **kwargs):
netloc = cherrypy.request.headers['X-Forwarded-Host']
except KeyError:
pass
filename = 'LazyLibrarian_RSS_' + ftype + '.xml'
path = path.replace('rssFeed', '').rstrip('/')
baseurl = urlunsplit((scheme, netloc, path, qs, anchor))
remote_ip = cherrypy.request.remote.ip
logger.info("RSS Feed request %s %s%s for %s" % (limit, ftype, plural(limit), remote_ip))
return genFeed(ftype, limit=limit, user=userid, baseurl=baseurl)
logger.info("RSS Feed request %s %s%s" % (limit, ftype, plural(limit)))
cherrypy.response.headers["Content-Type"] = 'application/rss+xml'
cherrypy.response.headers["Content-Disposition"] = 'attachment; filename="%s"' % filename
res = genFeed(ftype, limit=limit, user=userid, baseurl=baseurl)
return makeBytestr(res)

@cherrypy.expose
def importCSV(self):
Expand Down

0 comments on commit c7de4d7

Please sign in to comment.