Skip to content
Snippets Groups Projects

lua: http: add medialibrary endpoints

Open Aymeric Guillien requested to merge Aymeriic/vlc:luamedialib into master

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
123 end
124
125 local function get_genre_artists(get)
126 local genreId = get['genreId']
127 if not genreId then
128 return wrap_result(400, "Missing genreId" )
129 end
130 local artists = vlc.ml.genre_artists(genreId, get)
131 return wrap_result(200, artists)
132 end
133
134 local function wrap_thumbnail(thumbMrl)
135 if not thumbMrl then
136 return wrap_result(404, "Thumbnail not found")
137 end
138 filename = vlc.strings.make_path(thumbMrl)
  • 129 end
    130 local artists = vlc.ml.genre_artists(genreId, get)
    131 return wrap_result(200, artists)
    132 end
    133
    134 local function wrap_thumbnail(thumbMrl)
    135 if not thumbMrl then
    136 return wrap_result(404, "Thumbnail not found")
    137 end
    138 filename = vlc.strings.make_path(thumbMrl)
    139 local windowsdrive = string.match(filename, "^/%a:/.+$") --match windows drive letter
    140 if windowsdrive then
    141 filename = string.sub(filename, 2) --remove starting forward slash before the drive letter
    142 end
    143 local size = vlc.net.stat(filename).size
    144 local ext = string.match(filename,"%.([^%.]-)$")
  • 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    14 GNU General Public License for more details.
    15
    16 You should have received a copy of the GNU General Public License
    17 along with this program; if not, write to the Free Software
    18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
    19 --]==========================================================================]
    20
    21 local medialib = {}
    22 local dkjson = require ("dkjson")
    23
    24 local function wrap_result(code, content, mime)
    25 -- Automatically encode the content in json when the request didn't fail
    26 -- and when no mime is provided
    27 if code >= 200 and code < 300 and not mime then
    28 content = dkjson.encode (content, { indent = true })
  • 20
    21 local medialib = {}
    22 local dkjson = require ("dkjson")
    23
    24 local function wrap_result(code, content, mime)
    25 -- Automatically encode the content in json when the request didn't fail
    26 -- and when no mime is provided
    27 if code >= 200 and code < 300 and not mime then
    28 content = dkjson.encode (content, { indent = true })
    29 end
    30 if not mime then
    31 mime = "text/plain"
    32 end
    33 local res= "Status: " .. tostring(code) .. "\r\n" ..
    34 "Content-Type: " .. mime .. "\r\n" ..
    35 "Content-Length: " .. #content ..
  • added MRStatus::Stale label and removed MRStatus::InReview label

  • 10
    11 This program is distributed in the hope that it will be useful,
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    14 GNU General Public License for more details.
    15
    16 You should have received a copy of the GNU General Public License
    17 along with this program; if not, write to the Free Software
    18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
    19 --]==========================================================================]
    20
    21 local medialib = {}
    22 local dkjson = require ("dkjson")
    23
    24 local function wrap_result(code, content, mime)
    25 -- Automatically encode the content in json when the request didn't fail
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading