Commit b06c332d authored by Bastien Nocera's avatar Bastien Nocera Committed by Victor Toso

pocket: Remove Pocket plugin

It requires gnome-online-accounts Pocket support, and that's getting
removed.

See gnome-online-accounts!18
parent 278ef974
Pipeline #57375 passed with stage
in 3 minutes and 26 seconds
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/grilo/plugins/pocket">
<file compressed="true">pocket.svg</file>
</gresource>
</gresources>
--[[
* Copyright (C) 2015 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
*
--]]
-- Documented at:
-- http://getpocket.com/developer/docs/v3/retrieve
--
-- We only get videos here because if we didn't filter ahead of time
-- we'd need to check whether each URL was supported through
-- totem-pl-parser/quvi, which would be too slow
POCKET_GET_URL = 'https://getpocket.com/v3/get?consumer_key=%s&access_token=%s&sort=newest&contentType=video&detailType=complete&count=%d&offset=%d'
HAS_VIDEO = '1'
IS_VIDEO = '2'
---------------------------
-- Source initialization --
---------------------------
source = {
id = "grl-pocket-lua",
name = 'Pocket',
description = 'A source for browsing Pocket videos',
goa_account_provider = 'pocket',
goa_account_feature = 'read-later',
supported_keys = { 'id', 'thumbnail', 'title', 'url', 'favourite', 'creation-date' },
supported_media = 'video',
icon = 'resource:///org/gnome/grilo/plugins/pocket/pocket.svg',
tags = { 'net:internet' }
}
------------------
-- Source utils --
------------------
function grl_source_browse(media_id)
local count = grl.get_options("count")
local skip = grl.get_options("skip")
local operation_id = grl.get_options('operation-id')
local url = string.format(POCKET_GET_URL, grl.goa_consumer_key(), grl.goa_access_token(), count, skip)
grl.debug ("Fetching URL: " .. url .. " (count: " .. count .. " skip: " .. skip .. ")")
grl.fetch(url, pocket_fetch_cb)
end
------------------------
-- Callback functions --
------------------------
-- Newest first
function sort_added_func(itema, itemb)
return itema.time_added > itemb.time_added
end
-- From http://lua-users.org/wiki/StringRecipes
function string.starts(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
-- return all the media found
function pocket_fetch_cb(results)
local count = grl.get_options("count")
if not results then
grl.callback ()
return
end
json = grl.lua.json.string_to_table(results)
-- Put the table in an array so we can sort it
local array = {}
for n, item in pairs(json.list) do table.insert(array, item) end
table.sort(array, sort_added_func)
for i, item in ipairs(array) do
local media = create_media(item)
if media then
count = count - 1
grl.callback(media, count)
end
-- Bail out if we've given enough items
if count == 0 then
return
end
end
grl.callback()
end
-------------
-- Helpers --
-------------
function create_media(item)
local media = {}
if not item.has_video or
(item.has_video ~= HAS_VIDEO and item.has_video ~= IS_VIDEO) then
grl.debug("We filtered for videos, but this isn't one: " .. grl.lua.inspect(item))
return nil
end
if item.has_video == HAS_VIDEO then
if not item.videos then
grl.debug('Item has no video, skipping: ' .. grl.lua.inspect(item))
return nil
end
if #item.videos > 1 then
grl.debug('Item has than one video, skipping: ' .. grl.lua.inspect(item))
return nil
end
end
media.type = "video"
media.id = item.resolved_id
if media.id == '' then
media.id = item.item_id
end
local url = item.resolved_url
if url == '' then
url = item.given_url
end
if item.has_video == HAS_VIDEO then
url = item.videos['1'].src
-- BUG: Pocket puts garbage like:
-- src = "//player.vimeo.com/video/75911370"
-- FIXME: this should be https instead but then
-- quvi doesn't detect it
if string.starts(url, '//') then url = 'http:' .. url end
end
if grl.is_video_site(url) then
media.external_url = url
else
media.url = url
end
media.title = item.resolved_title
if media.title == '' then
media.title = item.given_title
end
if media.title == '' then
media.title = media.url
end
media.favourite = (item.favorite and item.favorite == '1')
if item.image then
media.thumbnail = item.image.src
end
media.creation_date = item.time_added
media.modification_date = item.time_updated
return media
end
......@@ -13,7 +13,6 @@ sources = [
'grl-itunes-podcast',
'grl-lastfm-cover',
'grl-musicbrainz',
'grl-pocket',
'grl-radiofrance',
'grl-spotify-cover',
'grl-theaudiodb-cover',
......@@ -25,7 +24,6 @@ resources = [
'grl-euronews',
'grl-guardianvideos',
'grl-radiofrance',
'grl-pocket',
'grl-appletrailers',
'grl-itunes-podcast',
]
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="channel-youtube.svg">
<defs
id="defs4">
<clipPath
id="clipPath6193"
clipPathUnits="userSpaceOnUse">
<path
id="path6195"
d="m 1600,2252.8 5020,0 0,3650 -5020,0 0,-3650 z" />
</clipPath>
<linearGradient
id="linearGradient6181"
spreadMethod="pad"
gradientTransform="matrix(-3.593e-5,822,822,3.593e-5,411,0)"
gradientUnits="userSpaceOnUse"
y2="0"
x2="1"
y1="0"
x1="0">
<stop
id="stop6183"
offset="0"
style="stop-opacity:1;stop-color:#c01e25" />
<stop
id="stop6185"
offset="1"
style="stop-opacity:1;stop-color:#e62426" />
</linearGradient>
<clipPath
id="clipPath6177"
clipPathUnits="userSpaceOnUse">
<path
id="path6179"
d="M 8220,0 0,0 l 0,8220 8220,0 0,-8220 m -6620,5902.8 0,-3650 5020,0 0,3650 -5020,0" />
</clipPath>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#505050"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="1"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="120.49386"
inkscape:cy="175.09957"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
borderlayer="true"
inkscape:showpageshadow="false"
inkscape:window-width="2560"
inkscape:window-height="1374"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:snap-bbox="true"
inkscape:object-nodes="true" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-796.36218)">
<g
transform="matrix(630.025,0,0,-458.9,-77.5125,1218.8747)"
id="g6197" />
<path
style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 30.115602,817.66358 197.356268,0 8.00002,11.43214 L 235,1033.6169 l -212.5,0 -0.384417,-204.52118 z"
id="rect7653"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<path
style="color:#000000;fill:#ee4055;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 70.934854,870.79411 c -8.818633,0 -15.925195,7.19797 -15.925195,16.13479 l 0,34.39697 c 0,46.31516 24.636814,78.60443 72.990311,78.60443 47.87064,0 72.99037,-32.01415 72.99037,-78.60443 l 0,-34.39697 c 0,-8.93682 -7.1065,-16.13479 -15.92514,-16.13479 z m 90.664866,36.33346 c 2.50474,0 5.01393,0.98537 6.937,2.93364 3.84636,3.89713 3.84636,10.22089 0,14.11802 l -32.84559,33.2774 c -2.11228,2.13974 -4.94066,4.42546 -7.6911,4.21491 -2.7505,0.21336 -5.57882,-2.07517 -7.69116,-4.21491 l -32.845583,-33.2774 c -3.846309,-3.89713 -3.846309,-10.22089 0,-14.11802 1.923126,-1.94827 4.457406,-2.90276 6.967205,-2.90276 2.50986,0 4.98384,0.95449 6.906958,2.90276 l 26.66258,27.01316 26.66252,-27.01316 c 1.92324,-1.94827 4.43236,-2.93364 6.93717,-2.93364 z"
id="path4636"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssssssssscssssscss" />
<g
transform="matrix(5.6146396,0,0,5.6146396,-2740.2871,170.98003)"
style="display:inline;enable-background:new"
id="g10051">
<path
style="color:#000000;fill:#75d4a5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
d="m 493.42485,115 7.57515,0 0,2.03613 -9,0 z"
id="rect10035"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="color:#000000;fill:#50b6b1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
d="m 501,115 10,0 0,2.03613 -10.40074,0 z"
id="rect10037"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="color:#000000;fill:#e94055;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
d="m 511,115 10,0 0.44526,2.03613 -10.44526,0 z"
id="rect10039"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="color:#000000;fill:#e8a945;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:new"
d="m 521,115 7.57515,0 1.42485,2.03613 -8.59926,0 z"
id="rect10041"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment