SDB.Database.QuerySongs

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: SDB.Database.QuerySongs

Re: SDB.Database.QuerySongs

by hh_perth » Wed Apr 06, 2022 9:08 am

Although this topic may be outdated – I couldn’t find an answer anywhere else :
with a large database of songs I like to check / manipulate tags by applying VBA-EXCEL macros.
With SDB = CreateObject("SongsDB.SDBApplication") access works great in MM4
(with change SDB = CreateObject("SongsDB5.SDBApplication" unfortunately it does not work in MM5)
manipulating selected songs.
Problem: I want to check, whether a song “Artist – Title” already exists any how many (with what quality (bitrate) and length and where stored (path)).
With trying QuerySongs or OpenSQL both did not work properly, as a I was not able to formulate a direct search with
Artist & Title.

Set objSongListiterator = SDB.Database.QuerySongs("SongLength > 6*1000")

While Not objSongListiterator.EOF
Set objSongData = objSongListiterator.Item
If LCase(objSongData.artistname) = N_Artist And LCase(objSongData.title) = N_Title Then _
ActiveCell.Offset(i, 0) = objSongData.artistname: _
ActiveCell.Offset(i, 1) = objSongData.title: _
ActiveCell.Offset(i, 2) = objSongData.Path: _
ActiveCell.Offset(i, 3) = i & " of " & n: i = i + 1
objSongListiterator.Next
n = n + 1
Wend
Set objSongListiterator = Nothing

I was able to retrieve the requested information, but the macro needs to search the whole database.
There must be a better way – please help.

by onkel_enno » Wed Jul 06, 2005 3:09 am

Anubis wrote: If I have any more questions, I know where to come!
You're welcome :D

by Anubis » Wed Jul 06, 2005 3:04 am

onkel_enno wrote:Sorry, not artist but artistname. Artist is the Artist-Object!
Your a LEGEND!
I feel so embarrassed that I didn't work this out myself.
I think I'm on track now.
If I have any more questions, I know where to come!
Thanks

by onkel_enno » Tue Jul 05, 2005 8:14 am

Sorry, not artist but artistname. Artist is the Artist-Object!

Re: SDB.Database.QuerySongs

by Anubis » Tue Jul 05, 2005 7:02 am

onkel_enno wrote:

Code: Select all

Msgbox(iter.item.artist)
Not tested!
When I use this, I get the following error...

Code: Select all

Error #438 - Microsoft VBScript runtime error
Object doesn't support this property or method
There must be a different way to refer to the artist and album information.

Any other suggestions?

Re: SDB.Database.QuerySongs

by onkel_enno » Tue Jul 05, 2005 2:34 am

Code: Select all

    MsgBox(itm.Title)
    Set iter = SDB.Database.QuerySongs("AND SongTitle='" & itm.Title & "'")
    if iter.EOF then
       MsgBox("No title found")
    else
       while not iter.eof
              Msgbox(iter.item.artist)
              iter.next
       wend
    end if
Not tested!

SDB.Database.QuerySongs

by Anubis » Tue Jul 05, 2005 2:07 am

I am starting to learn VBScripting and MM. Bare with me, I really don't know VBScript, but I do know non-object based programming, I just need a little helping hand...

I don't understand how to access the results of a SDB.Database.QuerySongs command.

Here is a code segment...

Code: Select all

    MsgBox(itm.Title)
    Set iter = SDB.Database.QuerySongs("AND SongTitle='" & itm.Title & "'")
    if iter.EOF then
       MsgBox("No title found")
    else
       MsgBox("Found at least one...")
    end if
I get the "Found" msg when I run my code, what I don't know is how to access the results of the QuerySongs command. As a starting point I'd like to do MsgBox(iter.Artist) or some such command to see the artist (and album) of the song I have found.

Can anybody help out here?

Thanks

Top