Grilo
: Easy Access to Online Multimedia Content
LinuxCon Europe 2012, Barcelona
Juan A. Suarez Romero <[email protected]>
Grilo
: Easy Access to Online Multimedia Content
About me
Juan A. Suárez Romero
Computer engineer, Coruña University
Working at Igalia since 2007
Experience in multimedia
Involved in Maemo and MeeGo
Co-author of MAFW
Outline
1
Current problems
2
Grilo
3
Conclusions
Grilo
: Easy Access to Online Multimedia Content
Current problems
Many sources of content
Online/offline sources
Different protocol/API
Sources that do not
provide content
(meta-information)
Many different devices
Different screen sizes
Different hardware
components
Different platforms
Current approach
Develop one application per service
Each application with different UX
Not easily scalable: new sources require new applications
Expensive maintenance
In some cases, one application attending more than one
service
Services of the same type (e.g., Photo storage service)
Define a common layer between application and the service
What we need?
Stop reinventing the wheel!
Platform-level solution for accessing multimedia content
Provide homogeneous access to all content
Scalable with new sources of information
Collaboration!
Consistent user experience
Users care about the content, not the provider
Grilo
: Easy Access to Online Multimedia Content
What is
Grilo
?
Framework focused on making discovery and browsing
easy for application developers
A single, high-level API for all the sources
A collection plugins that provides access to the sources
An extendable system to provide more plugins
http://live.gnome.org/Grilo
Media types and Keys
Collection of keys and
values
Several keys provided by
core: title, URL, author, . . .
Plugins can extend them
with new keys
Support for multiple
values
Support for relations
between keys
Plugins and Sources
Key component of the
system
Plugins are dynamically
loaded by core
Plugins create one or more
sources
Sources support multiple
operations
Browse, Search, Store,
Remove, . . .
Plugins and Sources
Sources perform two main
roles:
Provide new media
content
Enrich already existent
media content
Sources collaborate among
them to solve the requests
Example of collaboration
Developer wants to show content from UPnP server and
play it
They need the
url
to play, a
title
and a
thumbnail
to show
1Perform the request through core API
2
Core checks if the requested keys are supported by the
source
thumbnail
is not supported by UPnP source
3
Checks which sources are able to resolve
thumbnail
key
CoverArt source is able to
Example of collaboration
4
Core checks if those required keys are supported by
original UPnP source
If not, repeat the process as in the case of
thumbnail
5
Perform the request in the UPnP source with the keys
requested plus the new keys
6
When the results arrive, send them to CoverArt source to
include the
thumbnail
7
Send the final results to application
Developer only needs to deal with one provider
Implementing applications
Main language is C
Other languages supported through gobject introspection
(Python, Javascript, Vala, . . . )
Support for C++ (
grilomm
)
Code example
1 # ! / u s r / b i n / p y t h o n 2 3 import sys 4 from g i . r e p o s i t o r y import Grl 56 def main ( argv ) :
7 i f l e n ( argv ) < 1 : 8 p r i n t " Usage : m a k e _ l i s t . py < s e a r c h _ t e x t > " 9 r e t u r n 1 10 11 Grl . i n i t ( [ ] ) 12 r e g i s t r y = Grl . R e g i s t r y . g e t _ d e f a u l t ( ) 13 r e g i s t r y . l o a d _ a l l _ p l u g i n s ( ) 14 keys = [ Grl .METADATA_KEY_DURATION, 15 Grl . METADATA_KEY_TITLE, 16 Grl .METADATA_KEY_URL]
17 o p t i o n s = Grl . OperationOptions . new ( None )
18 o p t i o n s . s e t _ c o u n t ( 2 0 0 ) ;
19 r e s u l t s = Grl . m u l t i p l e _ s e a r c h _ s y n c ( None , argv [ 0 ] , keys , o p t i o n s ) 20 p r i n t " #EXT3MU"
21 f o r media in r e s u l t s :
22 i f i s i n s t a n c e ( media , Grl . MediaAudio ) :
23 p r i n t " #EXT3INF : " + s t r ( media . g e t _ d u r a t i o n ( ) ) + " , " + media . g e t _ t i t l e ( ) 24 p r i n t media . g e t _ u r l ( )
25
26 i f __name__ == " __main__ " :
27 main ( sys . argv [ 1 : ] )
Implementing plugins
Plugins must be written in C
Adding support for writing plugins declaratively (in XML)
Adding support for other languages (Lua)
Grilo
: Easy Access to Online Multimedia Content
Conclusions
Resources
Wiki
http://live.gnome.org/Grilo
Source code
http://git.gnome.org/browse/grilo
http://git.gnome.org/browse/grilo-plugins
http://git.gnome.org/browse/grilomm
IRC
#grilo
at
irc.gnome.org
Mailing list
http://mail.gnome.org/mailman/listinfo/
grilo-list
Grilo
: Easy Access to Online Multimedia Content
Thank you!
Images used in this presentation
Hard Disk Icon by Mazenl77
(CC Attribution)
http://www.iconspedia.com/icon/hard-disk-1600.html
Memory Card Icon by Custom Icon Design Studio
http://www.gettyicons.com/free-icon/103/
pretty-office-2-icon-set/free-memory-card-icon-png
Vimeo, Flickr, Jamendo, YouTube and UpnP logos under copyright of their own