Author Topic: custom formatting  (Read 4747 times)

val43

  • Newbie
  • *
  • Posts: 17
    • View Profile
custom formatting
« on: March 03, 2013, 22:53:37 »
I'd love to have a fully customizable playlist viewer (a la foobar w/ columns_ui).

foobar titleformatting has proven to be a great tool for customization of how tag information is represented.
for example I would show my rating as 6 unicode stars, with color ranging from dark to light yellow, and a unicode spade for songs I wanted to skip (rated -1). nobody but me uses a 8 steps rating system, but thanks to titleformatting I could do as I please. And in foobar titleformatting not only applies to the title and the playlist, but to anything else as well. I think that giving that kind of power and control to the user is amazing.

I really whish GMB will one day offer similar features. I'd love to help developing them.

Quentin Sculo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1082
    • View Profile
Re: custom formatting
« Reply #1 on: March 05, 2013, 05:25:58 »
I do plan to offer that level of customization.

For what it is worth you can already have 6 stars for rating, internally the rating is a number between 0 and 100. The mapping to stars is only made via the pictures, you just need to put the pictures in ~/.config/gmusicbrowser/icons (the stars are not really icons, but all the other files are icons) and it will override those from the default icon theme

I actually started implementing something like foobar's titleformatting, for the songtree columns (http://wiki.gmusicbrowser.org/customization/songtree), but the result is a bit more complicated than I hoped. On you can only use that in the SongTree widget.

The plan is now to implement something more generic, that will be usable in many places. First I need to come up with a syntax, then it will be usable everywhere $title and friends are used, by using ${ some syntax }, and plan for being able to define virtual fields whose value will be determined by this syntax, so you should be able to add columns with this syntax, maybe use them in search, or in filterlist.

val43

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: custom formatting
« Reply #2 on: March 08, 2013, 03:41:37 »
I noticed that the "run system command" shortcut already can export information about the currently playing song, using both syntax $title and %title. that's great!!
I'm writing a little shellscript for tagging files with custom tags, making use of lltag, so that I can tag the rating and other stuff however I please =)
I'll post it here when it's ready, if you don't mind Quentin

the next step in my agenda is to find a way to display those tags.. is it the sort of thing that a plugin can solve, while you make your decision wheter support them or not?

Quentin Sculo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1082
    • View Profile
Re: custom formatting
« Reply #3 on: March 12, 2013, 22:42:09 »
If you are talking about displaying the custom fields, it is already possible. You can add columns (by right clicking on columns) panes in FilterPanes for some of them (right click on the tabs).
To display the fields for the current song, you have to edit the layout where you can for example use something like Text1(markup="<i>$customname</i>") or even redefine existing ones : Title(markup="$title - $customname") (see the newly updated layout doc : http://gmusicbrowser.org/layout_doc.html
Note that you can also use the SongInfo widget to display all tags of the current songs, you can easily add it as a page to layouts that use TabbedLists and some others (right-click on tabs -> open page layout -> song informations)

val43

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: custom formatting
« Reply #4 on: April 06, 2013, 22:41:14 »
I don't get it.. you say in the documentation that a $word can represent any field tag, even custom fields.
But I cant get it to work: custom fields do not show.
Not with the text widget, not in the SongInfo widget.


other questions:
- will markup support IF sentences with boolean operators?
- would you provide an example of how to customize font and color with markup?
- is, or will ever be,  possible to use markup on a SongList column?

Quentin Sculo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1082
    • View Profile
Re: custom formatting
« Reply #5 on: April 07, 2013, 02:58:35 »
I've just did a test and it works. Note that custom fields will always begin with an uppercase letter, to avoid clashes with possible future standard fields. And it is case sensitive, so you need to use exactly the word that appear in the column in the Fields tab.
In the SongInfo widget, by default it will only show the field if the current song has a value for it. You can also look at the info tab of a song properties dialog, there the field should appear even if empty.

Quote
- will markup support IF sentences with boolean operators?
yes

Quote
- would you provide an example of how to customize font and color with markup?
The pango markup doc is there : https://developer.gnome.org/pango/unstable/PangoMarkupFormat.html
Example with a Test custom field : Text1(markup='<span foreground="blue" font="Arial 15">$Test</span>')
You have to pay attention to quotes, use one kind (single or double quotes) for the markup='...' and another for the span properties.

Quote
- is, or will ever be,  possible to use markup on a SongList column?
I don't know

val43

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: custom formatting
« Reply #6 on: April 07, 2013, 03:59:30 »
I've just did a test and it works. Note that custom fields will always begin with an uppercase letter, to avoid clashes with possible future standard fields. And it is case sensitive, so you need to use exactly the word that appear in the column in the Fields tab.
still no luck
custom fields tags "written"* by GMB are read. others are ignored.


Quote
In the SongInfo widget, by default it will only show the field if the current song has a value for it. You can also look at the info tab of a song properties dialog, there the field should appear even if empty.

Quote
- will markup support IF sentences with boolean operators?
yes
good! dumb question: is this already implemented? if so, what's the syntax? thanks


Quote
Quote
- would you provide an example of how to customize font and color with markup?
The pango markup doc is there : https://developer.gnome.org/pango/unstable/PangoMarkupFormat.html
Example with a Test custom field : Text1(markup='<span foreground="blue" font="Arial 15">$Test</span>')
You have to pay attention to quotes, use one kind (single or double quotes) for the markup='...' and another for the span properties.
thank you

Quote
Quote
- is, or will ever be,  possible to use markup on a SongList column?
I don't know
???


PS
* why isn't writing to TAG allowed? =/
« Last Edit: April 07, 2013, 04:05:15 by val43 »

Quentin Sculo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1082
    • View Profile
Re: custom formatting
« Reply #7 on: April 13, 2013, 02:45:35 »
Quote
custom fields tags "written"* by GMB are read. others are ignored.
I think we're not mis-understanding each other, gmb only knows about the fields listed in the fields list in the settings dialog.
You can see other fields in the advanced tag dialog but that dialog is mostly completely separate from the rest of gmb.


Quote
Quote
Quote
        - is, or will ever be,  possible to use markup on a SongList column?

    I don't know
???
To be clearer, no it is not currently possible. and I don't know if it will be.


Quote
PS
* why isn't writing to TAG allowed? =/
Because it's complicated, some of the reasons :
1) formatting of the values, in particular for numbers, or list of values.
For example "rating:3" is really ambiguous, as there is no indication of the maximum value, or the minimum.
2) making sure the user doesn't specify a tag name that is used by another field
3) how should the user specify which tag to use, can the name of the tag be different in different tag system, and for that I need to check how other players are handling this
4) id3v2 and m4a tags are a mess/ For id3v2 for example, I don't know if I should only allow using TXXX tags or not, and if I allow other tags that makes 3) much more complicated

I'm thinking about giving it a try for text fields as they have less format problems.

If you want to help, you (or anyone interested) could do some research. I'd like to know every player that support custom tags, I currently know of foobar2000, quodlibet (I think), not sure about others. And for all these players I'd like screenshots of the custom tag configuration dialog, and screenshots of gmb's advanced tag edition dialog after writing a custom tag in these players, with a ogg, a mp3 and a m4a files (and maybe a flac and an ape files).