mherger wrote: 
> if you set up $log correctly
It's logging now, mostly. I guess LMS got a bit crazy from all of my
endless and quick restarting after every plugin code change.

I have some code for letting the MusicInfoScreen display a character
when the song is in my virtual library 'Favs'.


Code:
--------------------
    sub checkIfInVirtualLibrary
  {     my $thistrackID =           ### how do I get the track_id of the 
currently playing song (on the client)???
        
        my $LibID = { library_id => 
Slim::Music::VirtualLibraries->getRealId('FAVS') };    ### this only gets me a 
HASH(0x5bc123456789) value
  
        my $sql = "SELECT COUNT(1) FROM library_track WHERE 
library_track.library = '2a111f4b' AND library_track.track = '1234657'";     
### the sql query with these specific values works and returns 1 if  song is 
part of VL
        my $sth = Slim::Schema->dbh->prepare( $sql );
        my $result = undef;
        $sth->execute();
                my $IsPartOfVirtualLibrary;
                $sth->bind_columns( undef, \$IsPartOfVirtualLibrary );
                if($sth->fetch()) {
                        $log->warn("IsPartOfVirtualLibrary = 
".$IsPartOfVirtualLibrary);
                }else {
                        $log->warn("IsPartOfVirtualLibrary = 
".$IsPartOfVirtualLibrary);
                        #$IsPartOfVirtualLibrary = 0;
                }
  
        my $string = '';
        if ($IsPartOfVirtualLibrary == 1) {
                $string='*';
                }else {
                $string='';
                }
        $sth->finish();
        return $string;
  }
--------------------


A -test- with a specific track_id and library_id in the sql part already
works.
But I need to solve 2 problems to finish it:

1) I need to -get the trackID- of the currently playing song for the sql
query. I couldn't get this to work.

2) The getRealID returns a HASH value for the virtual library ID and I
-didn't know how to use the hash value with a sql query-. It seems that
the sql query only accepts the id in the form of "2a111f4b" instead of
"HASH(0x5bc123456789)".

I'd be glad if you could point me in the right direction. Thank you.


------------------------------------------------------------------------
afriend's Profile: http://forums.slimdevices.com/member.php?userid=39306
View this thread: http://forums.slimdevices.com/showthread.php?t=109334

_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss

Reply via email to