/usr/share/grilo-plugins/grl-lua-factory/grl-euronews.lua is in grilo-plugins-0.2-extra 0.2.17-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | --[[
* Copyright (C) 2014 Bastien Nocera
*
* Contact: Bastien Nocera <hadess@hadess.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
--]]
EURONEWS_URL = 'http://euronews.hexaglobe.com/json/'
---------------------------
-- Source initialization --
---------------------------
source = {
id = "grl-euronews-lua",
name = "Euronews",
description = "A source for watching Euronews online",
supported_keys = { "id", "title", "url" },
supported_media = 'video',
icon = 'resource:///org/gnome/grilo/plugins/euronews/euronews.svg',
tags = { 'news', 'tv', 'net:internet', 'net:plaintext' }
}
------------------
-- Source utils --
------------------
function grl_source_browse(media_id)
if grl.get_options("skip") > 0 then
grl.callback()
else
grl.fetch(EURONEWS_URL, "euronews_fetch_cb")
end
end
------------------------
-- Callback functions --
------------------------
-- return all the media found
function euronews_fetch_cb(results)
local json = {}
json = grl.lua.json.string_to_table(results)
if not json or json.stat == "fail" or not json.primary then
grl.callback()
return
end
for index, item in pairs(json.primary) do
local media = create_media(index, item)
if media ~= nil then
grl.callback(media, -1)
end
end
grl.callback()
end
-------------
-- Helpers --
-------------
function get_lang(id)
local langs = {}
langs.ru = "Russian"
langs.hu = "Hungarian"
langs.de = "German"
langs.fa = "Persian"
langs.ua = "Ukrainian"
langs.ar = "Arabic"
langs.es = "Spanish; Castilian"
langs.gr = "Greek, Modern (1453-)"
langs.tr = "Turkish"
langs.pe = "Persian" -- Duplicate?
langs.en = "English"
langs.it = "Italian"
langs.fr = "French"
langs.pt = "Portuguese"
if not langs[id] then
grl.warning('Could not find language ' .. id)
return id
end
return grl.dgettext('iso_639', langs[id])
end
function create_media(lang, item)
local media = {}
if item.rtmp_flash["750"].name == 'UNAVAILABLE' then
return nil
end
media.type = "video"
media.id = lang
media.title = "Euronews " .. get_lang(lang)
media.url = item.rtmp_flash["750"].server ..
item.rtmp_flash["750"].name ..
" playpath=" .. item.rtmp_flash["750"].name ..
" swfVfy=1 " ..
"swfUrl=http://euronews.com/media/player_live_1_14.swf "..
"live=1"
return media
end
|