Next Artist or Album

Get answers about using MediaMonkey 4 for Windows.

Moderator: Gurus

NickDiamond

Next Artist or Album

Post by NickDiamond »

Hi,
I can't find the function to switch to the next (or previous) artist (or Album) !

I'd like to have a short-cut for this function, so I could use this function with my remote control !

Hope someone can help me !

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

Post by Steegy »

You mean you just want to go to the next/previous node in the library tree?
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
NickDiamond

Post by NickDiamond »

Yes,
but I think it is not that easy (Or I have just not seen the right button !?!?! )...

Is it possible to go to next node ? How ?


Nick

Sorry, hope you can understand my english...
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

If you want to go next/previous only on the current node level (only sibling nodes), then use these methods:

Code: Select all

Sub GoToNextSiblingNode

    On Error Resume Next
    SDB.MainTree.CurrentNode = SDB.MainTree.NextSiblingNode(SDB.MainTree.CurrentNode)

End Sub

Sub GoToPreviousSiblingNode

    On Error Resume Next
    SDB.MainTree.CurrentNode = SDB.MainTree.PreviousSiblingNode(SDB.MainTree.CurrentNode)

End Sub
If you want to go to the next/previous node regardless of it's hierarchy, then use these methods:

Code: Select all

Sub GoToNextNode

    On Error Resume Next
    SDB.MainTree.CurrentNode = SDB.MainTree.NextNode(SDB.MainTree.CurrentNode)

End Sub

Sub GoToPreviousNode

    On Error Resume Next
    SDB.MainTree.CurrentNode = SDB.MainTree.PreviousNode(SDB.MainTree.CurrentNode)

End Sub
I don't have time to help you linking these methods to your remote, but I'm sure there are others here that can help you more.
(Peke seems to know a lot about remotes).


Cheers
Steegy
Last edited by Steegy on Tue Jan 02, 2007 3:51 pm, edited 2 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
NickDiamond

Post by NickDiamond »

THX for trying to help me,
but I think this is not exactly what I want.

It seems that mediamonkey does not support this function.

I just want to have the possibility to go to "next artist", the same way I can go to "next track" ,
with one button or hotkey...
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy »

you need a script to move the songs by artists instead of track names.

8)
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

So you want that a push on the button of your remote: starts playing the next album/artist (the next in alphabet).
Do you want to switch the tracks view to that (newly chosen) artist/album, or do you want it to stay as it was?


I don't have time to make this right now. (If nobody has done this in a month or so, please remind us/me, maybe I'll have time then)

@Other scripters:

How it would work:
- Get current playing Artist/Album name.
- Query database for the songs (alphabetically ordered) that have an Artist/Album name that is next (limit results to 1).
- Send all songs from that Artist/Album to the player as nowplaying list and start playing.
- Optionally: Browse to the correct Artist/Album node (using my BrowseToNode script).

If the correct Artist/Album tracks view has to be shown, there's a second way to do this:
- Get current playing Artist/Album name.
- Browse to the correct Artist/Album node (using my BrowseToNode script).
- Send all songs in the track view to the player as nowplaying list and start playing.
(so definately easier, but requires to open the Artist/Album node)

At least, these are the 2 things I would use. The choice depends on the fact if the Artist/Album node has to be opened. With the first method, this can be made optional.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Guest

Post by Guest »

Steegy wrote:So you want that a push on the button of your remote: starts playing the next album/artist (the next in alphabet).
That's it !
Steegy wrote: Do you want to switch the tracks view to that (newly chosen) artist/album, or do you want it to stay as it was?
I want it to stay as it it, so that I can "skip to next track" AND "skip to next Album/Artist" !!

So, together with mediamonkey would make my computer a great audiostation, used with a remote control !!!

Sorry, I don't know much about programming or things like this, so I'm not able to help anyway...

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

Post by Steegy »

I'll have a look at it this evening.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Here's the script you can use:

Code: Select all

'========================================================================== 
' 
' MediaMonkey Script 
' 
' NAME: Previous&Next Album(Artist) v0.5.2
' DESCRIPTION: 
'  Exposes methods "PlayNextAlbum", "PlayPreviousAlbum", "PlayNextAlbumArtist",
'    "PlayPreviousAlbumArtist", "PlayNextAlbumSameArtist", "PlayPreviousAlbumSameArtist"
'   These methods can e.g. be called from use with a remote control.
' 
' AUTHOR: Steegy aka RC (Ruben Castelein)
' DATE  : 06/06/2006
' UPDATE: 14/06/2006
' 
'========================================================================== 


Const AlwaysClearPlaylistAndStop = False   ' Setting this to true will always clear the now playing list and stop playback, even if no matching album has been found
Const ShowNode = True                      ' Setting this to True will let the chosen album's node automaticly be selected


Dim SDB : Set SDB = CreateObject("SongsDB.SDBApplication")


'*****************************************************
'****            COMMAND LINE PARAMETERS          ****
'*****************************************************

If Not IsEmpty(WScript) Then
    If WScript.Arguments.Named.Exists("PlayNextAlbum") Then
        Call PlayNextAlbum
    ElseIf WScript.Arguments.Named.Exists("PlayPreviousAlbum") Then
        Call PlayPreviousAlbum
    ElseIf WScript.Arguments.Named.Exists("PlayNextAlbumArtist") Then
        Call PlayNextAlbumArtist
    ElseIf WScript.Arguments.Named.Exists("PlayPreviousAlbumArtist") Then
        Call PlayPreviousAlbumArtist
    ElseIf WScript.Arguments.Named.Exists("PlayNextAlbumSameArtist") Then
        Call PlayNextAlbumSameArtist
    ElseIf WScript.Arguments.Named.Exists("PlayPreviousAlbumSameArtist") Then
        Call PlayPreviousAlbumSameArtist
    End If
End If


'*****************************************************
'****                 MAIN METHODS                ****
'*****************************************************

Sub PlayNextAlbum

    If SDB.Player.CurrentSong Is Nothing Then Exit Sub
    Dim CurrentAlbumName : CurrentAlbumName = SDB.Player.CurrentSong.AlbumName
    Dim CurrentAlbumArtistName : CurrentAlbumArtistName = SDB.Player.CurrentSong.AlbumArtistName
    
    ' Fill the now playing list with an album with the same name, but the next album artist in alphabet
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE (Albums.Album='" & DoubleUpSingleQuotes(CurrentAlbumName) & "' " _
            &         "AND StrComp(Artists.Artist, '" & DoubleUpSingleQuotes(CurrentAlbumArtistName) & "')=1) " _
            &     "ORDER BY Artists.Artist" _
            & ") ORDER BY Songs.SongOrder", True)
    
    ' If the now playing list has been filled (so there is such an album as searched for above) then exit the subroutine 
    If SDB.Player.PlaylistCount <> 0 Then Exit Sub

    ' If no such album was found, then get the next album with the next name in the alphabet
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE StrComp(Albums.Album, '" & DoubleUpSingleQuotes(CurrentAlbumName) & "')=1 " _
            &     "ORDER BY Albums.Album, Artists.Artist" _
            & ") ORDER BY Songs.SongOrder", False)

End Sub


Sub PlayPreviousAlbum

    If SDB.Player.CurrentSong Is Nothing Then Exit Sub
    Dim CurrentAlbumName : CurrentAlbumName = SDB.Player.CurrentSong.AlbumName
    Dim CurrentAlbumArtistName : CurrentAlbumArtistName = SDB.Player.CurrentSong.AlbumArtistName
    
    ' Fill the now playing list with an album with the same name, but the previous album artist in alphabet
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE (Albums.Album='" & DoubleUpSingleQuotes(CurrentAlbumName) & "' " _
            &         "AND StrComp(Artists.Artist, '" & DoubleUpSingleQuotes(CurrentAlbumArtistName) & "')=-1) " _
            &     "ORDER BY Artists.Artist DESC" _
            & ") ORDER BY Songs.SongOrder", True)
            
    ' If the now playing list has been filled (so there is such an album as searched for above) then exit the subroutine 
    If SDB.Player.PlaylistCount <> 0 Then Exit Sub

    ' If no such album was found, then get the previous album with the next name in the alphabet
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE StrComp(Albums.Album, '" & DoubleUpSingleQuotes(CurrentAlbumName) & "')=-1 " _
            &     "ORDER BY Albums.Album DESC, Artists.Artist DESC" _
            & ") ORDER BY Songs.SongOrder", False)

End Sub


Sub PlayNextAlbumArtist

    If SDB.Player.CurrentSong Is Nothing Then Exit Sub
    Dim CurrentAlbumName : CurrentAlbumName = SDB.Player.CurrentSong.AlbumName
    Dim CurrentAlbumArtistName : CurrentAlbumArtistName = SDB.Player.CurrentSong.AlbumArtistName
    
    ' Fill the now playing list with the first album of the next album artist in alphabet
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE StrComp(Artists.Artist, '" & DoubleUpSingleQuotes(CurrentAlbumArtistName) & "')=1 " _
            &     "ORDER BY Artists.Artist, Albums.Album" _
            & ") ORDER BY Songs.SongOrder", False)

End Sub


Sub PlayPreviousAlbumArtist

    If SDB.Player.CurrentSong Is Nothing Then Exit Sub
    Dim CurrentAlbumName : CurrentAlbumName = SDB.Player.CurrentSong.AlbumName
    Dim CurrentAlbumArtistName : CurrentAlbumArtistName = SDB.Player.CurrentSong.AlbumArtistName
    
    ' Fill the now playing list with the first album of the previous album artist in alphabet
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE StrComp(Artists.Artist, '" & DoubleUpSingleQuotes(CurrentAlbumArtistName) & "')=-1 " _
            &     "ORDER BY Artists.Artist DESC, Albums.Album" _
            & ") ORDER BY Songs.SongOrder", False)

End Sub


Sub PlayNextAlbumSameArtist

    If SDB.Player.CurrentSong Is Nothing Then Exit Sub
    Dim CurrentAlbumName : CurrentAlbumName = SDB.Player.CurrentSong.AlbumName
    Dim CurrentAlbumArtistName : CurrentAlbumArtistName = SDB.Player.CurrentSong.AlbumArtistName
    
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE StrComp(Artists.Artist, '" & DoubleUpSingleQuotes(CurrentAlbumArtistName) & "')=0 " _
            &     "AND StrComp(Albums.Album, '" & DoubleUpSingleQuotes(CurrentAlbumName) & "')=1 " _
            &     "ORDER BY Albums.Album" _
            & ") ORDER BY Songs.SongOrder", False)

End Sub


Sub PlayPreviousAlbumSameArtist

    If SDB.Player.CurrentSong Is Nothing Then Exit Sub
    Dim CurrentAlbumName : CurrentAlbumName = SDB.Player.CurrentSong.AlbumName
    Dim CurrentAlbumArtistName : CurrentAlbumArtistName = SDB.Player.CurrentSong.AlbumArtistName
    
    Call PlayFromQuery("" _
            & "AND Songs.IDAlbum IN (" _
            &     "SELECT TOP 1 Albums.ID " _
            &     "FROM (Albums INNER JOIN Artists ON Albums.IDArtist = Artists.ID) " _
            &     "WHERE StrComp(Artists.Artist, '" & DoubleUpSingleQuotes(CurrentAlbumArtistName) & "')=0 " _
            &     "AND StrComp(Albums.Album, '" & DoubleUpSingleQuotes(CurrentAlbumName) & "')=-1 " _
            &     "ORDER BY Albums.Album DESC" _
            & ") ORDER BY Songs.SongOrder", False)

End Sub


'*****************************************************
'****                WORKER METHOD                ****
'*****************************************************

Sub PlayFromQuery(Query, QueryFollows)
    
    If AlwaysClearPlaylistAndStop Or QueryFollows Then Call SDB.Player.PlaylistClear
    
    Dim FirstItem : Set FirstItem = Nothing
    
    Dim SongIter : Set SongIter = SDB.Database.QuerySongs(Query)
    If Not SongIter.EOF Then
        Call SDB.Player.PlaylistClear
        Set FirstItem = SongIter.Item
    End If
    Do While Not SongIter.EOF
        Call SDB.Player.PlaylistAddTrack(SongIter.Item)
        Call SongIter.Next
    Loop

    If Not FirstItem Is Nothing Then
        Call SDB.Player.Next
        If Not SDB.Player.isPlaying Then
            Call SDB.Player.Play
        End If
    
        If ShowNode Then
            If Not SDB.Objects("PreviousNodeFromRemote") Is Nothing Then SDB.MainTree.ParentNode(SDB.Objects("PreviousNodeFromRemote")).Expanded = False
            Dim NodeRef : Set NodeRef = GetNode(SDB.MainTree.FirstChildNode(SDB.MainTree.Node_Artist), Array(FirstItem.AlbumArtistName, FirstItem.AlbumName))
            If Not NodeRef Is Nothing Then SDB.MainTree.CurrentNode = NodeRef
            Set SDB.Objects("PreviousNodeFromRemote") = NodeRef
        End If
    Else
        If AlwaysClearPlaylistAndStop And Not QueryFollows Then Call SDB.Player.Stop
    End If

End Sub


Function GetNode(StartNode, PathToNode) 

    Set GetNode = Nothing
    
    On Error Resume Next 
    
    Dim Node2B : Set Node2B = StartNode
    
    Dim i
    For i = 0 To UBound(PathToNode)
        If i > 0 Then
            Node2B.Expanded = True 
            Set Node2B = SDB.MainTree.FirstChildNode(Node2B) 
        End If
        
        If Node2B.Caption <> PathToNode(i) Then 
            Do 
                Set Node2B = SDB.MainTree.NextSiblingNode(Node2B) 
                If Err <> 0 Then Exit Function 
            Loop While Node2B.Caption <> PathToNode(i) 
        End If 
    Next 
    
    Set GetNode = Node2B

End Function


'*****************************************************
'****               UTILITY METHOD                ****
'*****************************************************

Function DoubleUpSingleQuotes(strInput)

    DoubleUpSingleQuotes = Replace(strInput, "'", "''")
    
End Function
These methods "PlayNextAlbum", "PlayPreviousAlbum", "PlayNextAlbumArtist", "PlayPreviousAlbumArtist", "PlayNextAlbumSameArtist", "PlayPreviousAlbumSameArtist" can be called by the program (e.g. "Girder") that you use for your remote control.

The methods can be externaly called with command line parameters, e.g.:
C:\Program Files\MediaMonkey\Scripts\Previous&Next Album(Artist).vbs /PlayNextAlbum



In Girder, you'll probably need to set the application to execute to:
C:\Windows\System32\Wscript.exe

The command line parameters (next thing to specify in Girder) have to be set to something like:
C:\Program Files\MediaMonkey\Scripts\Previous&Next Album(Artist).vbs /PlayNextAlbum


How to add (for Girder 3.2.9b):
- Menu Edit > Add new Command
- Tabpage "O.S." > dropdown list > "Execute" (or something similar).
- Fill in the text areas as said above (one box for the wscript program location, one line for the command line parameters), and preferable set startup visibility to "hidden" (or "invisible").
- Click the apply button and then right-click the command icon in the left pane, and choose "test command".

For a more complete walkthrough with screenshots, please look at page 2.


Cheers
Steegy
Last edited by Steegy on Thu Jun 15, 2006 2:31 pm, edited 5 times in total.
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
NickDiamond

Post by NickDiamond »

Hi, thank you !!!

Will try it out.
I`m using Girder, and I hope I can make it work with you your help !!

...
Peke
Posts: 17493
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

NickDiamond
what version of girder do you use and what Remote Control?
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
NickDiamond

Post by NickDiamond »

I'm using Girder 3.2.9 (the last free version)

And a remote control from Leadtek, Winfast
(the one that came together with my "TV-Card Winfast 2000 Xpert" !! )
Peke
Posts: 17493
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Post by Peke »

@NickDiamond
THX, I'm using ATI Remote Wonder I and Girder 3.3.2.

Warning From Moderator 2 Peke: Stay On Topic :lol: :roll:
Last edited by Peke on Thu Jun 08, 2006 4:00 am, edited 1 time in total.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
NickDiamond

Post by NickDiamond »

No problem,
but I just started to use Girder, so I have no idea how to the script !

I have found the possibility to enter a script, but it said "precompiling failed" .

Can someone guide me?
What do I have to do where in Girder ?

I tried, but without any success...
Post Reply