File indexing completed on 2025-01-19 04:25:19

0001 Importer.loadQtBinding( "qt.core" );
0002 //Importer.include( "debug/debug.js" );
0003 
0004 //test engine:
0005 
0006 var version = Amarok.Info.version();
0007 Amarok.debug( "Amarok Version: " + version );
0008 
0009 /*
0010 var Engine;
0011 Engine = Amarok.Engine;
0012 Engine.Stop( true );
0013 Engine.Play();
0014 Engine.Seek ( 60*1000 );
0015 */
0016 
0017 //test WindowAction
0018 
0019 function Menu1Clicked()
0020 {
0021     Amarok.debug("hey, menu1!");
0022 }
0023 
0024 function Menu2Clicked()
0025 {
0026     Amarok.debug("hey, menu2!");
0027 }
0028 
0029 Amarok.Window.addToolsSeparator();
0030 
0031 if ( Amarok.Window.addToolsMenu( "id1", "test Menu1" ) )
0032     Amarok.Window.ToolsMenu.id1.triggered.connect(Menu1Clicked);
0033 else
0034     Amarok.debug( "Menu1 already exists!" );
0035 
0036 if ( Amarok.Window.addToolsMenu( "id2", "test Menu2" ) )
0037     Amarok.Window.ToolsMenu.id2.triggered.connect(Menu2Clicked);
0038 else
0039     Amarok.debug( "Menu2 already exists!" );
0040 
0041 
0042 var TrackInfo = Amarok.Engine.currentTrack();
0043 var OSD = Amarok.Window.OSD;
0044 var StatusBar = Amarok.Window.Statusbar;
0045 
0046 if ( TrackInfo.isValid )
0047 {
0048     OSD.setText( "Hey, this is " + TrackInfo.artist );
0049     OSD.show();
0050 
0051     StatusBar.longMessage( "You are listening to album: " + TrackInfo.album );
0052 }
0053 else
0054 {
0055     Amarok.debug(" Track is not valid! ");
0056 }
0057 
0058 function onConfigure()
0059 {
0060     Amarok.alert( "This script does not require any configuration." );
0061 }
0062 
0063 function TrackChanged()
0064 {
0065     Amarok.debug( "Track Changed!" );
0066 }
0067 
0068 function TrackSeeked()
0069 {
0070     Amarok.debug( "Track Seeked!" );
0071 }
0072 
0073 function TrackFinished()
0074 {
0075     Amarok.debug( "Track Finished!" );
0076 }
0077 
0078 function PlaylistCountChanged( count )
0079 {
0080     Amarok.debug( "Playlist Count Changed!" );
0081 }
0082 
0083 function VolumeChanged( volume )
0084 {
0085     Amarok.debug( "Volume changed to: " + volume );
0086 }
0087 
0088 Amarok.configured.connect( onConfigure );
0089 Amarok.Engine.trackChanged.connect( TrackChanged );
0090 Amarok.Engine.trackSeeked.connect( TrackSeeked );
0091 Amarok.Engine.trackFinished.connect( TrackFinished );
0092 Amarok.Playlist.CountChanged.connect( PlaylistCountChanged );
0093 Amarok.Engine.volumeChanged.connect( VolumeChanged );
0094 
0095 location = Amarok.Collection.collectionLocation();
0096 for ( var x in location )
0097 {
0098     Amarok.debug ( location[x] );
0099 }
0100 Amarok.debug( Amarok.Collection.isDirInCollection( "/home/eagle/Music" ) );