MediaItem Porting

Stefan Burnicki stefan.burnicki at burnicki.net
Sun Jul 5 11:02:59 UTC 2015


Hi Eshton,

On 30.06.2015 13:24, Eshton Robateau wrote:
>
> I've working on moving the architecture over to the mediaItem class
> (commits coming soon).
> However, I've come across 2 issues I would prefer to discuss.
>
> 1) The usage of itemDataRole
> The old mediaItemModel makes use of itemDataRoles extensively throught
> OldMediaItem, 
> Given, that we're moving to qml, I fail to see any of these roles
> necessary, and I'm all 
> for dropping them moving forward, unless there is valid usage that
> I've missed.
Using the DataRoles was the old way to access MediaItem properties as it
was suggested by the Qt docs. However, with the amount of metadata saved
in MediaItem this got pretty messy.
Because of this, my idea was that the new bangarang should just use
properties.As MediaItem
derives from QObject and defines them with the Q_PROPERTY macros, they
should be accessible
via QtQuick.
> 2) Metadata in MediaItem
> The OldMediaItem stores so much metadata, it keeps a "fields" hashmap,
> along with traditional
> metadate members such as title, artwork,duration etc. Stefan has moved
> most of this metadata out of mediaItem
> but the question arises of how do we keep track of non-traditional
> metadata.
> How do we associate all that metadata?, are we keeping that in mediaUri?
My idea was to derive several classes from MediaItem for special kinds.
E.g. deriving a
PlayableMediaItem with properties that all playable items share: e.g.
LastPlayed, Duration, PlayCount.
Then we could derive more specific items like MusicMediaItem from it
with properties as Album, Genre,
Artists, etc.
>From an object-oriented point of view, this way is the most elegant (and
"safe") way to associated specific metadata with a specific kind of
MediaItem, I think.
Also take a look at doc/architecture.png for my ideas on this.

Stefan


More information about the Bangarang mailing list