Second Ratings Field with Star Display

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Just Guessing
Posts: 64
Joined: Mon Sep 03, 2012 12:06 pm

Second Ratings Field with Star Display

Post by Just Guessing » Mon Oct 01, 2012 9:02 am

For ages I've wanted a SECOND ratings field for files; it would be long-winded to explain why, but some will undoubtly appreciate the potential usefulness for such a tag.

I can use a CUSTOM field to hold an integer from 0-10, and with scripts I can easily have a dockable panel to get a bmp based alternate blue-star rating (or whatever color) displayed for the now-playing song.

...BUT, does anybody have a lead as to how to get a star ratings VISUAL(bmp/png) display into a CUSTOM tag field in the main music panel listing. The display of an integer would of course be automatic, and facilitate sorting - but a visual display would be far more friendly when scrolling through lists of songs sorted by another aspect while looking for something in particular.

Any thoughts?

Lowlander
Posts: 47299
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Second Ratings Field with Star Display

Post by Lowlander » Mon Oct 01, 2012 11:40 am

I doubt this is possible.
Lowlander (MediaMonkey user since 2003)

Mizery_Made
Posts: 2283
Joined: Tue Aug 29, 2006 1:09 pm
Location: Kansas City, Missouri, United States

Re: Second Ratings Field with Star Display

Post by Mizery_Made » Mon Oct 01, 2012 11:51 am

There have been a few discussions in the past about the ability of having multiple ratings. I think this one may be the most recent. Might be an interesting read to you. As for your request of showing a visual rating via the custom tags, like Lowlander says, don't think it's possible either. Something like MonkeyRok might be able to do it though, but... yeah.

Just Guessing
Posts: 64
Joined: Mon Sep 03, 2012 12:06 pm

Re: Second Ratings Field with Star Display

Post by Just Guessing » Mon Oct 01, 2012 2:55 pm

Thanks for the responses. Funny, I read that exact thread right before I posted the topic.

Really, the issue isnt so much about the tag itself (any custom tag will store an integer fine), but whether there's any scripting access to how MM constructs its main display track panel ('details view' in particular). If some degree of access to this primary panel is possible, then some really clever coding might just pull this off.

I should say I do NOT see the need for graphical ENTRY of the stars in the main panel (as with TRUE ratings tag). That would be coding too out of reach for me for certain. I dont mind a small panel which provides for an alternate rating entry track by track. I dont see any great necessity to enter visually within the main display (although its very nice). Its more about translating already entered ratings into a bmp (which again is primarily whether MM has made that main display 'out of bounds' or not).

I rather suspect its unlikely, as I don't think I've seen any scripts that get in there and fiddle with it. But then again I'm already blown away by how customizable this player is.

At the least, I absolutely can make a dockable panel which will translate an integer to a bmp star display, and as I've been thinking about this, have decided I certainly am going to do that much...but I really want to see it for all visible tracks in the main panel (for obvious reasons).

Eyal
Posts: 3111
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: Second Ratings Field with Star Display

Post by Eyal » Mon Oct 01, 2012 11:52 pm

I think the best working example you can get is MonkeyRok:

Image
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].

Just Guessing
Posts: 64
Joined: Mon Sep 03, 2012 12:06 pm

Re: Second Ratings Field with Star Display

Post by Just Guessing » Tue Oct 02, 2012 8:25 am

Well, personally, the screen real estate gets chewed up by other things far too quickly to devote a tall panel to redunandant listings just for a second star-system.

Let me suppress the ratings angle of the question and concentrate focus on this aspect:

Does anyone know an example, or have knowlegde of how one can manipulate MM's main track listing panel ??(excluding theme stylizations of course)
So, for example,
IF details view column Mood = happy
show smileyface.icon (not string "happy")

Just Guessing
Posts: 64
Joined: Mon Sep 03, 2012 12:06 pm

Re: Second Ratings Field with Star Display

Post by Just Guessing » Thu Oct 04, 2012 12:35 pm

Well look, heres an AUTO folder script to offer an alternate star ratings system ("AltStar") for immediate use. It is currently set to use field CUSTOM1. Tweak that in the top of the script.

PROS:
  • its free.
  • its here now.
  • the 'ratings' could be translated/transfered down the road to a better ratings system, if one shows up.
CONS:
  • I dont know whats needed to offer backward compatability. I'm on MM4, and thats all I know about. Maybe it breaks on MM3 etc.
  • These 'icons' are UNICODE characters. I always expect unicode to someday cause some grief somewhere. Its not ideal. I have seen options where tags are not permited to even have unicode. Obviously thats an issue. Also, different font useage/skin font selections could potentially destroy the idea. One could try different unicode characters as a solution if needed.
  • As a font, the now-playing selection is increased in size, making that one track look like it has more 'stars' than it actually does, but only temporarily.
  • The panel should also be rewritten in HTML and made prettier. Use icons instead of numeric buttons as well. Maybe later, or perhaps someone else wants to fix that up?
BTW, does anybody know if MM can give a BACKCOLOR/BACKGROUND COLOR to a generic dockable panel. I tried many ideas and never found the functionality.

I did implement a 'view menu' option to remove the panel header once you have it where you want it. I can't figure out why I haven't seen anyone else do this. I hate the wasted space, small as it is. Its just completely unecessary (in MM4 anyway) to go to the buried user.ini file and find line 1023 or whatever and hard code a visibility option. Just hit the option in the view sub menu. Breezy - easy - make it go away - bring it back - repeat - until its just no fun anymore!

So its 10 simple buttons. Enter your ratings choice IN THE PANEL ONLY for full column integrity (though its not critical). The radio buttons to the right in the panel are for writing the stars to
  • 1) the single currently playing song,
  • 2) SELECTED/multiple songs.
The labels for these buttons are in unicode also, if they look wrong on your system. Thats a fix that could go lots of easy directions if its failing on your system.

Code: Select all

'==========================================================================
'--------------AltStar 1.0 by Just Guessing aka KingDavidCaul--------------
' --- for MM4 - maybe others. Just a workaround till second star system ---
' --- hopefully implemented. Different Skins will use different fonts -----
' --- and systems will have different fonts. Thats gonna make problems. ---
' --- Also, these are unicode characters. Some will have these prohibited -
' --- in their tags. Only way to nicely fix this is to get code to  -------
' --- access the main panel and use icons. Never seen that done that I ---
'---------------noticed. Sorry. ------------------------------------------
'==========================================================================
Private Const AltStarTag = "Custom1"  ' change this to a tag you consider unused
Private Const AltStarSTAR = &H25c6 '  might otherwise want &H2605 = star,  &H2588 = block, &H25c6 = diamond
Private Const AltStarShowToolbarOption = True ' change if dont want toolbar button
Private Const AltStarFontColor = &H730207 ' will have to lookup color to match personal skin used
Private Const AltStarFontSize = 6 ' button font size
Private Const AltStarPadding = 3 ' space between buttons
Private Const AltStarFontwidth = 6  ' if changing font size creates squeezed look
Private Const AltStarBtnPadding = 8 ' inner button padding
Private Const AltStarBtnTopMargin = 6 ' space above button
Private Const AltStarBtnHeight = 25
' -------------------------------------------------tweak above
Dim AltStarMenu, AltStarMenuShow, AltStarPanel, UI, AltStarHeaderOption
Set UI = SDB.UI
Sub OnStartup 
	If AltStarShowToolbarOption = True Then
		Dim AltStarBox : Set AltStarBox = UI.AddMenuItem(UI.Menu_TbStandard, 0, 0)
		AltStarBox.Caption = "AltStar"
		AltStarBox.UseScript = Script.ScriptPath
		AltStarBox.Checked = True
		Script.RegisterEvent AltStarBox, "OnClick", "AltStarShowPanel" 	
	End If
	
	Set AltStarMenu = UI.AddMenuItemSub(UI.Menu_View, 0, 0) 
	AltStarMenu.Caption = "AltStar" 
		
	Set AltStarMenuShow = UI.AddMenuItem(AltStarMenu, 0, 0) 
	AltStarMenuShow.Caption = "Show it?" 
	AltStarMenuShow.Checked = True
	Script.RegisterEvent AltStarMenuShow, "OnClick", "AltStarShowPanel" 
	
	Set AltStarHeaderOption = UI.AddMenuItem(AltStarMenu, 0, 0)
	AltStarHeaderOption.Caption = "Show titlebar?"
	AltStarHeaderOption.Checked = False  
	SDB.Objects("AltStarHeaderOption") = AltStarHeaderOption
	Script.RegisterEvent AltStarHeaderOption, "OnClick", "AltStarGetsHeader"	
		
	MakeAltStarPanel
End Sub

Sub AltStarGetsHeader(o)
	If SDB.Objects("AltStarHeaderOption").Checked Then
	SDB.Objects("AltStarHeaderOption").Checked = False
	Else
	SDB.Objects("AltStarHeaderOption").Checked = True
	End If
	MakeAltStarPanel
End Sub
			
Sub MakeAltStarPanel
	Set AltStarPanel = UI.NewDockablePersistentPanel("AltStar") 
	If AltStarPanel.IsNew Then 
	AltStarPanel.DockedTo = 1 : AltStarPanel.Common.Width = 250 : AltStarPanel.Common.Height = AltStarBtnHeight + (AltStarBtnTopMargin * 3)
	End If 
		
	If SDB.Objects("AltStarHeaderOption").Checked Then
		AltStarPanel.ShowCaption = True : AltStarPanel.Caption = "AltStar" 
	Else
		AltStarPanel.ShowCaption = 0		
	End If
		Script.RegisterEvent AltStarPanel, "OnClose", "AltStarPanelClose" 
	
	Dim AltStarBtn, AltStarBtnCoX, AltStarBtnWidth, AltStarRadio1, AltStarRadio2
	AltStarBtnCoX = AltStarPadding * 2
		
	For i = 1 To 10
	Set AltStarBtn = UI.NewButton(AltStarPanel) 
	AltStarBtn.Common.ControlName = "AltStarBtn" 
	AltStarBtn.Caption = i 
	AltStarBtnWidth = (Len(AltStarBtn.Caption) * AltStarFontWidth) + AltStarBtnPadding
	AltStarBtn.Common.SetRect AltStarBtnCoX, AltStarBtnTopMargin, AltStarBtnWidth, AltStarBtnHeight 
	AltStarBtn.Common.FontColor = AltStarFontColor 
	AltStarBtn.Common.FontSize = AltStarFontSize  
	AltStarBtn.Common.FontBold = True
	Script.RegisterEvent AltStarBtn.Common, "OnClick", "AltStarBtnClick"
	AltStarBtnCoX = AltStarBtnCoX + AltStarBtnWidth + AltStarPadding
	Next
	
	Set AltStarRadio2 = UI.NewRadioButton(AltStarPanel) 
	AltStarRadio2.Common.SetRect AltStarBtnCoX, 4, 35, 13
	AltStarRadio2.Caption =  ChrW(&H2212) 
	AltStarRadio2.Common.FontBold = True 
	AltStarRadio2.Common.FontSize = 15
	AltStarRadio2.Checked = True
	AltStarRadio2.Common.ControlName = "AltStarOnly"		
			
	Set AltStarRadio1 = UI.NewRadioButton(AltStarPanel) 
	AltStarRadio1.Common.SetRect AltStarBtnCoX, 18, 35, 13
	AltStarRadio1.Caption =  ChrW(&H2630) 
	AltStarRadio1.Common.FontBold = True   
	AltStarRadio1.Common.FontSize = 9  
	AltStarRadio1.Checked = False
	AltStarRadio1.Common.ControlName = "AltStarAny"		
			
End Sub 
 
Sub AltStarShowPanel(Item) 
	AltStarPanel.Common.Visible = Not AltStarPanel.Common.Visible 
	AltStarMenu.Checked = AltStarPanel.Common.Visible 
End Sub 
 
Sub AltStarPanelClose(Item) 
	AltStarMenu.Checked = False 
End Sub 
 
Sub AltStarBtnClick(AltStarBtn) 
	If AltStarPanel.Common.ChildControl("AltStarAny").Checked Then   		 
		If SDB.SelectedSongList.count = 0 Then
			SDB.MessageBox "Select tracks to be updated", mtError, Array(mbOk)
			Exit Sub
		End If
		Dim AltStarSongsList, AltStarItems, i, AltStarOldTags, AltStarNewTags, AltStarAddToTags
		Set AltStarSongsList = SDB.SelectedSongList 
		For i = 0 To AltStarSongsList.count - 1
			Set AltStarItems = AltStarSongsList.Item(i)
			Execute("AltStarItems."&AltStarTag&" = String(AltStarBtn.Caption,ChrW(AltStarSTAR))")
			AltStarItems.UpdateDB
		Next
		AltStarSongsList.UpdateAll
		Exit Sub
	End If
	
	If AltStarPanel.Common.ChildControl("AltStarOnly").Checked Then 
		Dim AltStarCurrentSong, AltStarSongList
		Set AltStarSongList = SDB.NewSongList
		Set AltStarCurrentSong = SDB.Player.CurrentSong
		AltStarSongList.Add(AltStarCurrentSong)
		Execute("AltStarCurrentSong."&AltStarTag&" = String(AltStarBtn.Caption,ChrW(AltStarSTAR))")
		AltStarSongList.UpdateAll           
		Set AltStarSongList = Nothing : Set AltStarCurrentSong = Nothing
	End If
End Sub

Post Reply