XMMS2 Collections Sbastien Cevey <seb@cine7.net> - - PowerPoint PPT Presentation

xmms2 collections
SMART_READER_LITE
LIVE PREVIEW

XMMS2 Collections Sbastien Cevey <seb@cine7.net> - - PowerPoint PPT Presentation

XMMS2 Collections Sbastien Cevey <seb@cine7.net> http://bytes.inso.cc/ Metaweb presentation (October 22, 2009) Swiss Federal Institute XMMS2 Music Player Playlouder MSP of Technology, Lausanne Outline 1. Introduction 2. Concept 3.


slide-1
SLIDE 1

XMMS2 Collections

Sébastien Cevey <seb@cine7.net>

http://bytes.inso.cc/

Metaweb presentation (October 22, 2009)

Swiss Federal Institute

  • f Technology, Lausanne

XMMS2 Music Player Playlouder MSP

slide-2
SLIDE 2

Outline

  • 1. Introduction
  • 2. Concept
  • 3. Usage
  • 4. Future
  • 5. Conclusion

2

slide-3
SLIDE 3
  • 1. Introduction

“why all the fuss?”

3

slide-4
SLIDE 4

Personal Interests

The project initially comes from personal interest in:

  • Software engineering

design smart abstractions to build powerful things

  • Information architecture

exploit computers to manage large collections of structure information

4

slide-5
SLIDE 5

XMMS2 Land

5

Clients Server

IPC

IPC IPC IPC

Interface: CLI, GUI, headless Language: C, C++, Python, Ruby, Perl, etc.

Ruby/Qt CLI last.fm scrobbler

Media Library (SQLite) playlists playback

Unix Domain Socket TCP

slide-6
SLIDE 6

XMMS2 Media Library

  • SQLite database
  • Store of objects (“media”, typically songs) with

arbitrary properties

  • Denormalized schema, with unique (id, key)
  • SQL queries require lots of JOINs

6

id key value 42 artist Britney Spears 42 title Toxic 42 duration 245497 43 artist Beyonce

slide-7
SLIDE 7

UI Requirements

  • Browse
  • Search
  • Organize

7

slide-8
SLIDE 8

UI Requirements

  • Browse
  • Search
  • Organize

8

slide-9
SLIDE 9

UI Requirements

  • Browse
  • Search
  • Organize

9

slide-10
SLIDE 10

UI Requirements

  • Browse
  • Search
  • Organize

10

slide-11
SLIDE 11

UI Requirements

  • Browse
  • Search
  • Organize

i.e. view & manipulate subsets of the media library

11

slide-12
SLIDE 12

The Problem

  • Abstract the structure of the media library
  • Simplify querying of subsets of the media library
  • Share abstraction of such subsets among clients
  • Allow refining, editing, composing the subsets

12

slide-13
SLIDE 13

The Problem

13

Old API client server API

user input abstract representation SQL query set of media

slide-14
SLIDE 14

The Solution

14

Old API client server API

user input abstract representation SQL query set of media

New API client server API

slide-15
SLIDE 15

The Solution

15

user input abstract representation set of media

client API server Collections

=

slide-16
SLIDE 16
  • 2. Concept

“what are you on about?”

16

slide-17
SLIDE 17

Collection: Definition

“A collection is a representation of a subset of the media library, structured as a Directed Acyclic Graph (DAG) of operators.”

17

slide-18
SLIDE 18

Collection: Definition

“A collection is a representation of a subset of the media library, structured as a Directed Acyclic Graph (DAG) of operators.”

18

Universe

slide-19
SLIDE 19

Collection: Definition

“A collection is a representation of a subset of the media library, structured as a Directed Acyclic Graph (DAG) of operators.”

19

Universe Compare

artist=“Pink Floyd”

slide-20
SLIDE 20

Collection: Definition

“A collection is a representation of a subset of the media library, structured as a Directed Acyclic Graph (DAG) of operators.”

20

Universe Compare

artist=“Pink Floyd”

Compare

year<=1975

slide-21
SLIDE 21

Collection: Definition

“A collection is a representation of a subset of the media library, structured as a Directed Acyclic Graph (DAG) of operators.”

21

Universe Compare

artist=“Pink Floyd”

Compare

year<=1975

Intersection

slide-22
SLIDE 22

Collection: Definition

“A collection is a representation of a subset of the media library, structured as a Directed Acyclic Graph (DAG) of operators.”

22

Universe Idlist Compare

artist=“Pink Floyd”

Compare

year<=1975

Intersection

slide-23
SLIDE 23

Collection: Definition

“A collection is a representation of a subset of the media library, structured as a Directed Acyclic Graph (DAG) of operators.”

23

Universe Idlist Compare

artist=“Pink Floyd”

Compare

year<1975

Intersection Union

slide-24
SLIDE 24

Source Operators

24

Universe Idlist Reference

All media in the Media Library Static list of media (by id) All media in the saved collection $name in

$namespace

$name $namespace

slide-25
SLIDE 25

Saved Collections

25

Idlist

Playlists Collections ...

Idlist

...

Idlist

...

Idlist

...

Intersection

...

Compare

year<=1975

...

“Default” “DJ Mix” “Cool playlist” “70’s favourites” “Chillout tracks” “Early stuff”

slide-26
SLIDE 26

Set Operators

26

Intersection Union Complement

1..N 1 1..N

All media present in all the operands All media present in any of the operands All media not present in the operand

slide-27
SLIDE 27

Filter Operators

27

Compare

$field $operation $value

Match

$field $pattern

Has

$field 1 1 1

Similar to Compare, but takes a $pattern with wildcards (*, ?) instead of an exact value All media that have $field set All media where $field satisfies the comparison $operation with $value

($operation: <, <=, =, =>, >)

slide-28
SLIDE 28

Example Structures

28

Universe

slide-29
SLIDE 29

Example Structures

29

Universe Compare

artist=“The XX”

slide-30
SLIDE 30

Example Structures

30

Universe Compare

artist=“The XX”

Idlist

slide-31
SLIDE 31

Example Structures

31

Universe Compare

artist=“The XX”

Union Idlist

“Hipster Songs”

Organize

slide-32
SLIDE 32

Example Structures

32

Universe Compare

artist=“The XX”

Union Idlist

“Hipster Songs”

Reference

“Hipster Songs” in ”Collections”

slide-33
SLIDE 33

Example Structures

33

Universe Compare

artist=“The XX”

Union Idlist

“Hipster Songs”

Reference

“Hipster Songs” in ”Collections”

Compare

lastplayed<3days

Browse

slide-34
SLIDE 34

Example Structures

34

Universe Compare

artist=“The XX”

Union Idlist

“Hipster Songs”

Reference

“Hipster Songs” in ”Collections”

Compare

lastplayed<3days

Match

title=”Crystal*”

Search

slide-35
SLIDE 35

Remarks

35

  • Used to organize, browse, search, or any

combination of those

  • Can use different UI approaches to combine

them, but all using the collection API

  • Dynamic sets but allows manual edits
slide-36
SLIDE 36

Collections 2.0

  • Support for sources:
  • Support “medialists” (ordered, with duplicates,

as opposed to “mediasets”) in the DAG

  • Token matching operator
  • Fix, improve and optimize querying (more later)

36

id key value 42 artist Britney Spears 42 title Toxic 42 url file:///home/... Google Summer of Code 2008 project by Erik Massop (nesciens)

slide-37
SLIDE 37

Collections 2.0

  • Support for sources:
  • Support “medialists” (ordered, with duplicates,

as opposed to “mediasets”) in the DAG

  • Token matching operator
  • Fix, improve and optimize querying (more later)

37

id key source value 42 artist plugins/id3v2 Britny Spaers 42 artist clients/nycli Britney Spears 42 title plugins/id3v2 Toxic 42 url server file:///home/... Google Summer of Code 2008 project by Erik Massop (nesciens)

slide-38
SLIDE 38

Collections 2.0 Operators

38

Token

$property $value 1

All media where $property token-matches

$value (e.g. “Floyd” matches “Pink Floyd”)

Order

$type $order 1

Returns a medialist ordered by $order

Limit

$start $length 1

Mediaset

1

Returns $length entries from the operand, starting at $start Returns the mediaset of the operand (no

  • rdering, no duplicate)
slide-39
SLIDE 39
  • 3. Usage

“how, then?”

39

slide-40
SLIDE 40

Command-line Interface

Collections are exposed in nycli (the new XMMS2 CLI) through

collection patterns

e.g.:

  • Idioteque
  • Pink Floyd Echoes
  • artist:“Sufjan Stevens” l:Illinois
  • (genre:Rock OR genre:Pop/Rock) date<1980
  • title~usa url:*ogg +tag.favourite in:Awesome

40

slide-41
SLIDE 41

Collection Patterns

  • API helper function to parse patterns into

collection structures

  • Supported in multiple nycli commands:
  • search <pattern>
  • add <pattern>
  • jump <pattern>
  • coll create <name> <pattern>
  • etc.
  • More generally: share a common syntax across

clients (GUI, CLI, etc) Note: NOT a bijection with collection structures

41

slide-42
SLIDE 42

Collection Patterns

42

nycli (new official CLI) http://xmms2.sf.net/

slide-43
SLIDE 43

Collection Patterns

43

abraca http://abraca.xmms.se/

slide-44
SLIDE 44

Collection Structure API

44

all = coll_universe() m_floyd = coll_match(all, field=”artist”,

  • peration=”=”

value=”Pink Floyd”) m_early = coll_match(m_floyd, field=”year”,

  • peration=”<“,

value=”1975”) m_static = coll_idlist([42,1337,666]) m_join = coll_union(m_early, m_static)

slide-45
SLIDE 45

Collection (1.0) Query API

coll_query_ids(conn, coll, order[], limit_start, limit_len);

=> List of object ids matched by coll, ordered by the list

  • f properties order, optionally restricted to a range.

coll_query_infos(conn, coll, order[], limit_start, limit_len, fetch[], group[]);

=> Dict of properties (selected by fetch) of objects

matched by coll, ordered by the list of properties

  • rder, optionally restricted to a range and grouped.

45

slide-46
SLIDE 46

Collection Query Example

coll_query_ids(conn, m_join, [‘artist’,‘album’,‘tracknr’]); => [412, 413, 414, 323, 5454, 4234, ...] coll_query_infos(conn, m_join, [‘artist’,‘album’,‘tracknr’], 0, 50, [‘artist’, ‘title’]); => [{artist: ‘Pink Floyd’, title: ‘Eclipse’}, {artist: ‘Pink Floyd’, title: ‘Echoes’}, {artist: ‘Britney Spears’, title: ‘Toxic’}, ...]

46

slide-47
SLIDE 47

Collection Query Example

coll_query_infos(conn, m_join, [‘artist’,‘album’], 0, 50, [‘artist’,‘album’], [‘album’]); => [{artist: ‘Pink Floyd’, album: ‘Meddle’}, {artist: ‘Britney Spears’, album: ‘Foo’}, ...]

47

slide-48
SLIDE 48

Collection Server API

Save collections in the XMMS2 server:

xmmsc_coll_save(conn, coll, name, namespace); xmmsc_coll_get(conn, name, namespace); xmmsc_coll_list(conn, namespace); xmmsc_coll_rename(conn, name, to, namespace); xmmsc_coll_remove(conn, name, namespace); xmmsc_coll_find(conn, media_id, namespace);

48

slide-49
SLIDE 49

Example GUIs

49

Spring http://my-trac.assembla.com/spring/

slide-50
SLIDE 50

Example GUIs

50

Spring http://my-trac.assembla.com/spring/

slide-51
SLIDE 51

Example GUIs

51

Spring http://my-trac.assembla.com/spring/

slide-52
SLIDE 52

Example GUIs

52

Spring http://my-trac.assembla.com/spring/

slide-53
SLIDE 53

Example GUIs

53

Spring http://my-trac.assembla.com/spring/

slide-54
SLIDE 54

Example GUIs

54

Spring http://my-trac.assembla.com/spring/

slide-55
SLIDE 55

Example GUIs

55

abraca http://abraca.xmms.se/

slide-56
SLIDE 56

Example GUIs

56

Etude http://code.google.com/p/etude-music-player/

slide-57
SLIDE 57
  • 4. Future

“fair enough, what’s next?”

57

slide-58
SLIDE 58

Collections 2.0

Finish & Merge:

  • New querying API
  • Finalize support for sources
  • Performance optimization
  • More tests

58

slide-59
SLIDE 59

Coll 2.0: Advanced Queries

59

Current querying too limited:

  • No count
  • No custom aggregation function
  • No variable in operators (lastplayed<NOW-1day)
  • Simplistic grouping, always returns flat tuples

=> Collections 2.0 will allow specifying the “cluster structure” to return. Not unlike Freebase querying, API still under works.

slide-60
SLIDE 60

New Uses/GUI Front-Ends

  • Save filtered views, load and edit them
  • Organize using “shelf analogy”:
  • spatial
  • drag entities as filters (e.g. artist, tag) or

atomically (e.g. selection of tracks)

  • New & custom views, e.g. on a timeline, by

properties, etc.

  • Share across XMMS2 server instances (à la XSPF)

60

slide-61
SLIDE 61

S4

  • New XMMS2 media library backend, optimized

for our data model

  • Uses collections as native query language
  • Doesn’t support all operators, only works with

sets (selection of properties, grouping, ordering done externally)

=> brings collections to the world, as a

generic interface for browsing, searching & organizing collections of objects!

61

(Storage System for Short Strings)

slide-62
SLIDE 62
  • 5. Conclusion

“is that it?”

62

slide-63
SLIDE 63

Conclusion

  • Simple common abstraction of searching,

browsing and organization

  • Flexible: can be modified, refined, composed
  • Powerful API for building UIs to manipulate a

large database of information

  • Works well for XMMS2
  • Could be applied to other collections of objects

63

slide-64
SLIDE 64

Questions?

http://xmms2.sf.net/

64