Toolbar_MoreFromTheSame

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Contact:

Toolbar_MoreFromTheSame

Post by Steegy »

Hello

This is a script that adds a toolbar menu to support "More from the same..." (Artist, Album, Genre, Year, FolderLibrary, FolderMyComputer, FolderExplorer).

UPDATE: Added FULL support (also FolderLibrary, FolderMyComputer, FolderExplorer) and changed the toolbar icon.

REMARKS:
- Just a minor problem that you can't MoreFromFolderLibrary when you're in the My Computer tree. This could be solved by using DB SQL, but I suspect a bug in MM that causes this behaviour. (I'm not implementing a workaround for now)
- Might give problems for tracks on CD's or Network. I haven't tested that yet.
- Because the strange icon implementation in MM, the 3 folder icons are simply a folder. (I couldn't use the normal icons without adding them manually to the program).

Code: Select all

'========================================================================== 
' 
' MediaMonkey Script 
' 
' NAME: Toolbar_MoreFromTheSame v1.1 
' DESCRIPTION:
'  Adds a toolbar menu (light bulb icon) to support "More from the same..."
'   (Artist, Album, Genre, Year, FolderLibrary, FolderMyComputer, FolderExplorer).
' 
' AUTHOR: Steegy aka RC
' DATE  : 29.11.2005 
' 
' INSTALL:
' - Copy script to MM directory scripts\auto 
' 
'========================================================================== 
Dim lcNothingToSend
Dim MyMoreTBB, MyMoreArtist, MyMoreAlbum, MyMoreGenre, MyMoreYear, MyMoreFolderLibrary, MyMoreFolderMyComputer, MyMoreFolderExplorer

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' Variable Configuration: Localise this if necessary
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
' Dutch Localisation ;)
lcNothingToSend = "Er is niets geselecteerd."
lcNotPossibleFromMyComputer = "Dit is onmogelijk vanuit 'Deze Computer'"

'lcNothingToSend = "Nothing selected."
'lcNotPossibleFromMyComputer = "This isn't possible from within a 'My Computer' tree."

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' Here's the code
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
Sub onStartUp 

   SDB.UI.AddMenuItemSep SDB.UI.Menu_TbStandard,0,0

   Set MyMoreTBB = SDB.UI.AddMenuItemSub(SDB.UI.Menu_TbStandard,0,0) 
   MyMoreTBB.Caption = SDB.Localize("&Find More from Same")
   MyMoreTBB.OnClickFunc = "CheckAvailability" 
   MyMoreTBB.UseScript = Script.ScriptPath 
   MyMoreTBB.IconIndex = 19

   Set MyMoreArtist = SDB.UI.AddMenuItem(MyMoreTBB,0,0) 
   MyMoreArtist.Caption = SDB.Localize("Artist")
   MyMoreArtist.OnClickFunc = "MoreArtist" 
   MyMoreArtist.UseScript = Script.ScriptPath 
   MyMoreArtist.IconIndex = 60 

   Set MyMoreAlbum = SDB.UI.AddMenuItem(MyMoreTBB,0,0) 
   MyMoreAlbum.Caption = SDB.Localize("Album")
   MyMoreAlbum.OnClickFunc = "MoreAlbum" 
   MyMoreAlbum.UseScript = Script.ScriptPath 
   MyMoreAlbum.IconIndex = 57 

   Set MyMoreGenre = SDB.UI.AddMenuItem(MyMoreTBB,0,0) 
   MyMoreGenre.Caption = SDB.Localize("Genre")
   MyMoreGenre.OnClickFunc = "MoreGenre" 
   MyMoreGenre.UseScript = Script.ScriptPath 
   MyMoreGenre.IconIndex = 58 

   Set MyMoreYear = SDB.UI.AddMenuItem(MyMoreTBB,0,0) 
   MyMoreYear.Caption = SDB.Localize("Year")
   MyMoreYear.OnClickFunc = "MoreYear" 
   MyMoreYear.UseScript = Script.ScriptPath 
   MyMoreYear.IconIndex = 59 

   Set MyMoreFolderLibrary = SDB.UI.AddMenuItem(MyMoreTBB,0,0) 
   MyMoreFolderLibrary.Caption = SDB.Localize("Folder (&Library)")
   MyMoreFolderLibrary.OnClickFunc = "MoreFolderLibrary" 
   MyMoreFolderLibrary.UseScript = Script.ScriptPath 
   MyMoreFolderLibrary.IconIndex = 70 

   Set MyMoreFolderMyComputer = SDB.UI.AddMenuItem(MyMoreTBB,0,0) 
   MyMoreFolderMyComputer.Caption = SDB.Localize("Folder (&Computer)")
   MyMoreFolderMyComputer.OnClickFunc = "MoreFolderMyComputer" 
   MyMoreFolderMyComputer.UseScript = Script.ScriptPath 
   MyMoreFolderMyComputer.IconIndex = 70 

   Set MyMoreFolderExplorer = SDB.UI.AddMenuItem(MyMoreTBB,0,0) 
   MyMoreFolderExplorer.Caption = SDB.Localize("Folder (&Explorer)")
   MyMoreFolderExplorer.OnClickFunc = "MoreFolderExplorer" 
   MyMoreFolderExplorer.UseScript = Script.ScriptPath 
   MyMoreFolderExplorer.IconIndex = 70 

   SDB.Objects("MyMoreTBB") = MyMoreTBB
   SDB.Objects("MyMoreArtist") = MyMoreArtist
   SDB.Objects("MyMoreAlbum") = MyMoreAlbum
   SDB.Objects("MyMoreGenre") = MyMoreGenre
   SDB.Objects("MyMoreYear") = MyMoreYear
   SDB.Objects("MyMoreFolderLibrary") = MyMoreFolderLibrary
   SDB.Objects("MyMoreFolderMyComputer") = MyMoreFolderMyComputer
   SDB.Objects("MyMoreFolderExplorer") = MyMoreFolderExplorer

End Sub 

Function CheckValid(WhatToCheck)
    If "" & WhatToCheck = "" Or "" & WhatToCheck = "0" Then
      Exit Function
    End If

  CheckValid = True
End Function


Function CheckAvailability(arg)
  Dim list

  Set list = SDB.CurrentSongList
  If list.count = 0 Then
    SDB.Objects("MyMoreArtist").Enabled = False
    SDB.Objects("MyMoreAlbum").Enabled = False
    SDB.Objects("MyMoreGenre").Enabled = False
    SDB.Objects("MyMoreYear").Enabled = False
    SDB.Objects("MyMoreFolderLibrary").Enabled = False
    SDB.Objects("MyMoreFolderMyComputer").Enabled = False
    SDB.Objects("MyMoreFolderExplorer").Enabled = False
  Else
    SDB.Objects("MyMoreArtist").Enabled = CheckValid(list.item(0).ArtistName)
    SDB.Objects("MyMoreAlbum").Enabled = CheckValid(list.item(0).AlbumName)
    SDB.Objects("MyMoreGenre").Enabled = CheckValid(list.item(0).Genre)
    SDB.Objects("MyMoreYear").Enabled = CheckValid(list.item(0).Year)
    SDB.Objects("MyMoreFolderLibrary").Enabled = True
    SDB.Objects("MyMoreFolderMyComputer").Enabled = True
    SDB.Objects("MyMoreFolderExplorer").Enabled = True
  End If

End Function


Sub MoreArtist(arg) 
   ChooseMore("Artist") 
End Sub 
Sub MoreAlbum(arg) 
   ChooseMore("Album") 
End Sub 
Sub MoreGenre(arg) 
   ChooseMore("Genre") 
End Sub 
Sub MoreYear(arg) 
   ChooseMore("Year") 
End Sub 
Sub MoreFolderLibrary(arg) 
   ChooseMore("FolderLibrary") 
End Sub 
Sub MoreFolderMyComputer(arg) 
   ChooseMore("FolderMyComputer") 
End Sub
Sub MoreFolderExplorer(arg) 
   ChooseMore("FolderExplorer") 
End Sub

Function ChooseMore(MyChoice) 

  Dim Result, list, MyLocation

  Set list = SDB.CurrentSongList
  If list.count = 0 Then 
    Result = SDB.MessageBox(lcNothingToSend, mtError, Array(mbOK))
    Exit Function
  End If
  'Result = SDB.MessageBox(list.item(0).Media.MediaLabel, mtError, Array(mbOK))

  Dim MyChooseMore
  Dim Node2B
  Dim MyChooseNode

  Select Case MyChoice
    Case "Artist":
      Set MyChooseNode = SDB.MainTree.Node_Artist
      MyChooseMore = list.item(0).ArtistName
    Case "Album":
      Set MyChooseNode = SDB.MainTree.Node_Album
      If list.item(0).AlbumArtistName = "" Then
        MyChooseMore = list.item(0).AlbumName
      Else
        MyChooseMore = list.item(0).AlbumName & " (" & list.item(0).AlbumArtistName & ")"
      End If
    Case "Genre":
      Set MyChooseNode = SDB.MainTree.Node_Genre
      MyChooseMore = list.item(0).Genre
    Case "Year":
      Set MyChooseNode = SDB.MainTree.Node_Year
      MyChooseMore = Left(list.item(0).Year,3) & "0's"
      MyYear = "" & list.item(0).Year
    Case "FolderLibrary":
      If list.item(0).Media.DriveType = 0 Then
        Result = SDB.MessageBox(lcNotPossibleFromMyComputer, mtError, Array(mbOK))
        Exit Function
      End If
      Set MyChooseNode = SDB.MainTree.Node_Location
      MyLocation = Split(list.item(0).Path,"\")
      Select Case list.item(0).Media.DriveType
        Case 2,3,4:
          MyChooseMore = "HD:" & list.item(0).Media.MediaLabel & " (" & MyLocation(0) & ")"
        Case 5:
          MyChooseMore = "CD:Audio CD"
        Case 12345:
          MyChooseMore = SDB.Localize("Network")
      End Select
    Case "FolderMyComputer":
      Set MyChooseNode = SDB.MainTree.Node_MyComputer
      MyLocation = Split(list.item(0).Path,"\")
      Select Case list.item(0).Media.DriveType
        Case 2,3,4:
          If list.item(0).Media.MediaLabel = "" Then
            MyChooseMore = MyLocation(0) & "\"
          Else
            MyChooseMore = MyLocation(0) & "\ [" & list.item(0).Media.MediaLabel & "]"
          End If
        Case 5:
          If list.item(0).Media.MediaLabel = "" Then
            MyChooseMore = MyLocation(0) & "\"
          Else
            MyChooseMore = MyLocation(0) & "\ [" & list.item(0).Media.MediaLabel & "]"
          End If
        Case 12345:
          MyChooseMore = SDB.Localize("Network")
      End Select
      'Result = SDB.MessageBox(MyChooseMore, mtError, Array(mbOK))
    Case "FolderExplorer":
      Command = "explorer " & Left(list.item(0).Path, InStrRev(list.item(0).Path, "\"))
      
      Set WShell = CreateObject("WScript.Shell") 
      Result = WShell.Run(Command, 1, False)

      Exit Function

  End Select
  
      'Result = SDB.MessageBox(MyChooseMore, mtError, Array(mbOK))
      'Result = SDB.MessageBox(list.item(0).Media.DriveType & " TTT" & MyChooseMore, mtError, Array(mbOK))
      
  If Not CheckValid(MyChooseMore) Then
    Exit Function
  End If

  MyChooseNode.Expanded = True

  Set Node2B = SDB.MainTree.FirstChildNode(MyChooseNode)
  If Not Node2B.Caption = MyChooseMore Then
    Do
      Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
      'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
    Loop While Node2B.Caption <> MyChooseMore
  End If

  If MyChoice = "Year" Then
    Node2B.Expanded = True

    Set Node2B = SDB.MainTree.FirstChildNode(Node2B)
    If Not Node2B.Caption = MyYear Then
      Do
        Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
        'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
      Loop While Node2B.Caption <> MyYear
    End If

  End If

  If MyChoice = "FolderLibrary" Then
    i = 1
    Do While i < UBound(MyLocation)
      Node2B.Expanded = True
          'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
      Set Node2B = SDB.MainTree.FirstChildNode(Node2B)
          'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
      If Not Node2B.Caption = MyLocation(i) Then
        Do
          Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
        'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
        Loop While Node2B.Caption <> MyLocation(i)
      End If
      i = i + 1
    Loop
  End If

  If (MyChoice = "FolderMyComputer" Or MyChoice = "FolderMyComputer") Then
    i = 1
    Do While i < UBound(MyLocation)
      Node2B.Expanded = True
          'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
      Set Node2B = SDB.MainTree.FirstChildNode(Node2B)
          'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
      If Not Node2B.Caption = MyLocation(i) Then
        Do
          Set Node2B = SDB.MainTree.NextSiblingNode(Node2B)
        'Result = SDB.MessageBox(Node2B.Caption, mtError, Array(mbOK))
        Loop While Node2B.Caption <> MyLocation(i)
      End If
      i = i + 1
    Loop
  End If

  SDB.MainTree.CurrentNode = Node2B

End Function 
Cheers
Steegy
Last edited by Steegy on Tue Nov 29, 2005 3:36 pm, edited 1 time in total.
judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia
Contact:

Post by judas »

Lovin' it!!!!!!!

Thanks!!!
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Contact:

Post by Steegy »

It's a pleasure! :D
agentsmart

Post by agentsmart »

steegy i see it says author steegy aka RC

are you the cowboy joined up by another server in another country?

how did you do that ?
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Contact:

Post by Steegy »

Oups! :o

I'm sorry for the misunderstanding! :-? :lol:
(Steegy aka RC) NOT EQUAL TO (Roving Cowboy)

Two different persons 8)

BTW: You are really "smart", agent, for having noticed that :wink:

Cheers
Steegy
judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia
Contact:

Post by judas »

Then the mystery is un-solved: who is this steegy everyone's been talking about lately???

Interesting, very interesting ideed!!!! :roll:
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

So what does the RC stand for? We're all interested now! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Contact:

Post by Steegy »

Well, R and C are just my initials :D

Steegy is a name I "invented", somewhere in the begin of 2003 (on www.askearth.com). As of today, there seem to be other Steegy's on the web and I regret that.
Because I have been using this name in quite some forums and I sometimes using my real name, I sometimes add "aka RC" to say that it's me.
(I don't pretend that I was the first person ever that used "Steegy". Some well known inventions were made by different independant people in the history, almost at the same time. This may be something like that.)

Now you (all?) know the story.

Cheers
Steegy aka RC :wink:
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

Hi Steegy,
great script, specially if you use the searchfunction! :D

But I have a small question: If I want to find more from the same album it goes to the album node. But would it be possible that it goes to the artist-node and choses the album there?

So if I have the song Emily (from Adam Green) I want it to go to "Adam Green/Gemstones" (artist node) instead of "Gemstones (Adam Green)" (album node).

Thanks! :)
Big_Berny
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Contact:

Post by Steegy »

I don't have much time, but here's a *very* quick and dirty solution:

Replace this:

Code: Select all

    Case "Album":
      Set MyChooseNode = SDB.MainTree.Node_Album
      If list.item(0).AlbumArtistName = "" Then
        MyChooseMore = list.item(0).AlbumName
      Else
        MyChooseMore = list.item(0).AlbumName & " (" & list.item(0).AlbumArtistName & ")"
      End If
with this:

Code: Select all

	Case "Album":
	  MyChoice = "FolderLibrary"
      Set MyChooseNode = SDB.MainTree.Node_Artist
      MyLocation = Split(list.item(0).AlbumArtistName & "\" & list.item(0).AlbumName & "\" & "justsomedummytext","\")
	  MyChooseMore = list.item(0).AlbumArtistName
Obviously the code looks strange, but that was probably because I hadn't slept good enough when I made the script.
I'll improve (clean up) it later...

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Post by Big_Berny »

Thanks! Semms to work! :D
Eyal
Posts: 3114
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec
Contact:

Re: Toolbar_MoreFromTheSame

Post by Eyal »

Wow! Thank you Steegy.

Just found this script.
This is what I was looking for since 2005!
(I wanted a fast way to go to Library->Location->Folder, instead of Rightclick->FindMore...)

One thing for the "Folder (Library)" to work with other languages:
Change line 196:

Code: Select all

MyChooseMore = "HD:" & list.item(0).Media.MediaLabel & " (" & MyLocation(0) & ")"
To:

Code: Select all

MyChooseMore = SDB.Localize("HD") &":" & list.item(0).Media.MediaLabel & " (" & MyLocation(0) & ")"
It's working fine with MM3. Using button->"Folder (Library)" is instantaneous. But when a library filter is active, it's taking almost 10 seconds to locate the folder. Any idea why?

Thanks
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
shawn
Posts: 33
Joined: Sat Apr 11, 2009 5:18 pm
Contact:

Re: Toolbar_MoreFromTheSame

Post by shawn »

Very useful script, thanks!

One bug I've encountered:

....I select a track by the artist 10,000 Maniacs and choose Find More From Same... Folder (Explorer)

This message is generated

....Image

....The path to the file is: G:\Music\1\10,000 Maniacs\Our Time in Eden\10_Tolerance.mp3

Looks like that pesky comma is causing the trouble. Any thoughts for a fix?

Thanks, Steegy!

-Shawn

MediaMonkey version 3.2.0.1294 Gold
Windows 7 Professional


Image
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm
Contact:

Re: Toolbar_MoreFromTheSame

Post by Steegy »

A little late, but changing

Code: Select all

Command = "explorer " & Left(list.item(0).Path, InStrRev(list.item(0).Path, "\"))
to

Code: Select all

Command = "explorer " & """" & Left(list.item(0).Path, InStrRev(list.item(0).Path, "\")) & """"
might do the trick.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Sub

Re: Toolbar_MoreFromTheSame

Post by Sub »

Hello Steegy,

Thank you for developing this script. The task that I am trying to find a solution for is this: In the case of a randomly playing song I would like to find more songs from the same artist, (which your script does), and then randomly play all the songs from that same artist. Could you suggest a method using your script which will achieve this goal or if that is not possible then perhaps an alternative method to accomplish this goal?

Thanks in advance,

Sub
Post Reply