/
bookmark.py
45 lines (36 loc) · 1.25 KB
/
bookmark.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -*- coding: utf-8 -*-
from lxml import etree
from odoo import http
from .common import SubsonicREST
class MusicSubsonicBookmarks(http.Controller):
@http.route(
["/rest/getBookmarks.view"], type="http", auth="public", csrf=False, methods=["GET", "POST"]
)
def getBookmarks(self, **kwargs):
rest = SubsonicREST(kwargs)
success, response = rest.check_login()
if not success:
return response
root = etree.Element("subsonic-response", status="ok", version=rest.version_server)
xml_bookmarks = rest.make_Bookmarks()
root.append(xml_bookmarks)
return rest.make_response(root)
@http.route(
[
"/rest/createBookmark.view",
"/rest/deleteBookmark.view",
"/rest/getPlayQueue.view",
"/rest/savePlayQueue.view",
],
type="http",
auth="public",
csrf=False,
methods=["GET", "POST"],
)
def actionBookmark(self, **kwargs):
rest = SubsonicREST(kwargs)
success, response = rest.check_login()
if not success:
return response
root = etree.Element("subsonic-response", status="ok", version=rest.version_server)
return rest.make_response(root)