Running python snipped on prefix

10 views
Skip to first unread message

per...@gmail.com

unread,
Feb 12, 2018, 7:48:09 PM2/12/18
to Sonospy Development
Returning back to playing with sonospy. It's worked pretty well for me in the past year doing the basics; now I want to overcome some of the annoying limitations of what the Sonos controller displays (e.g. omits composer, title is limited length).

If track metadata has composer as "Mozart, W.A." and title is "Kegelstatt Trio....", I want sonospy to feed to Sonos the title as "Mozart - Kegelstatt Trio..."

If I didn't mind the ", W.A.", then the following works marvellously
index=track
entry_prefix=composer

To save screen real-estate on the controller, following the instructions on Python snippets in defaultindex.ini, I thought the following should do the trick. But it makes me unable to browse music in this branch of the tree:

index=track
entry_prefix=composer{composer.split(',', 1)[0]}

What am I doing wrong? Someone with better python experience can probably see immediately what the problem is, I suspect something about when stuff gets substituted in the exec call in dynamic_makepresuffix in mediaserver.py
In pycpoint.log, it chokes in mediaserver.py line 6529 (where it does the actual exec fix=data) with a NameError: name 'Mozart' is not defined.

Thanks, Martin

Mark Henkelis

unread,
Feb 13, 2018, 11:25:08 AM2/13/18
to sonosp...@googlegroups.com

There's nothing wrong with your snippet, there was a bug in the code - it only worked with numeric fields (I guess it has only ever been used for dates). I've pushed a fix to the msrefactor5 branch.

Mark.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.
To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

Martin Pergler

unread,
Feb 13, 2018, 12:29:19 PM2/13/18
to sonosp...@googlegroups.com
Thanks. Installed and works like a charm. Martin

On 13 February 2018 at 11:25, Mark Henkelis <mark.h...@tesco.net> wrote:

There's nothing wrong with your snippet, there was a bug in the code - it only worked with numeric fields (I guess it has only ever been used for dates). I've pushed a fix to the msrefactor5 branch.

Mark.


On 13/02/18 00:48, per...@gmail.com wrote:
Returning back to playing with sonospy. It's worked pretty well for me in the past year doing the basics; now I want to overcome some of the annoying limitations of what the Sonos controller displays (e.g. omits composer, title is limited length).

If track metadata has composer as "Mozart, W.A." and title is "Kegelstatt Trio....", I want sonospy to feed to Sonos the title as "Mozart - Kegelstatt Trio..."

If I didn't mind the ", W.A.", then the following works marvellously
index=track
entry_prefix=composer

To save screen real-estate on the controller, following the instructions on Python snippets in defaultindex.ini, I thought the following should do the trick. But it makes me unable to browse music in this branch of the tree:

index=track
entry_prefix=composer{composer.split(',', 1)[0]}

What am I doing wrong? Someone with better python experience can probably see immediately what the problem is, I suspect something about when stuff gets substituted in the exec call in dynamic_makepresuffix in mediaserver.py
In pycpoint.log, it chokes in mediaserver.py line 6529 (where it does the actual exec fix=data) with a NameError: name 'Mozart' is not defined.

Thanks, Martin

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Sonospy Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonospy-devel/dtY1PSDzVzY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonospy-devel+unsubscribe@googlegroups.com.

To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.



--
Martin Pergler
m...@pergler.org
Reply all
Reply to author
Forward
0 new messages