Old 21st March 2005, 21:21   #1
krckoorascic
Senior Member
 
krckoorascic's Avatar
 
Join Date: May 2004
Location: Serbia
Posts: 351
Send a message via ICQ to krckoorascic Send a message via AIM to krckoorascic Send a message via Yahoo to krckoorascic
problem with songticker

ok, i'm coding one skin and i whant to have songticker that will change between song title and song artist (changing them, first display title and after 2 seconds display artist...)
here what i wrote (code is little long, sorry )
PHP Code:
/*
    Triad :: songticker.m
    -----------------------------------
    songticker functions
    -----------------------------------
    written by krckoorascic
    last update: 3/21/05
*/

#include <lib/std.mi>
#include "attribs.m"

Function setTickerMode(int mode);

Global 
Text mainTickermainTriadmainHinterbypassHintershadeTickershadeTriadshadeHinter;
Global 
Timer TickerTimerrestoreTimer;
Global 
Int state;
Global 
String sArtistsTitle;

System.onScriptLoaded()
{
    
initAttribs();

    
mainTicker System.getContainer("main").getLayout("normal").findObject("songticker");
    
mainTriad System.getContainer("main").getLayout("normal").findObject("triadticker");
    
mainHinter System.getContainer("main").getLayout("normal").findObject("hinter");
    
bypassHinter System.getContainer("main").getLayout("normal").getObject("bypass.hint");
    
shadeTicker System.getContainer("main").getLayout("shade").findObject("shade.songticker");
    
shadeTriad System.getContainer("main").getLayout("shade").findObject("shade.triadticker");
    
shadeHinter System.getContainer("main").getLayout("shade").findObject("shade.hinter");

    
TickerTimer = new Timer;
    
TickerTimer.setDelay(2222);

    
restoreTimer = new Timer;
    
restoreTimer.setDelay(950);
    
    
setTickerMode(getPrivateInt(getSkinName(), "Songticker Mode"0));
    
    
System.onTitleChange("");
}

System.onScriptUnloading()
{
    
TickerTimer.stop();
    
delete TickerTimer;
    
restoreTimer.stop();
    
delete restoreTimer;
    
setPrivateInt(getSkinName(), "Songticker Mode"state);
}

System.onTitleChange(string newTitle)
{
    if (
strUpper(StrLeft(newTitle7)) == "[BUFFER" || strUpper(StrLeft(newTitle4)) == "[ICY") return;

    
sArtist ""sTitle "";
    
sArtist getPlayItemMetaDataString("artist");
    
sTitle getPlayItemMetaDataString("title");
    
string tmp getPlayItemDisplayTitle();
    
    if (
sArtist == "")
        {
            if (
sTitle == "")
                {
                    
int pos strSearch(tmp"-");
                    if (
pos >= 0)
                        {
                            
sArtist strLeft(tmppos 1);
                            
sTitle strMid(tmpposstrLen(tmp) - pos);
                        }
                    else
                        {
                            
sArtist tmp;
                            
sTitle tmp;
                        }
                }
            else
                
sArtist sTitle;
        }

        if (
state == 2)
            {
                
TickerTimer.stop();
                
TickerTimer.onTimer();
                
TickerTimer.start();
            }

}

TickerTimer.onTimer()
{
    if (
mainTriad.getText() == sTitle)
        {
            
mainTriad.setText(sArtist);
            
shadeTriad.setText(sArtist);
        }
    else
        {
            
mainTriad.setText(sTitle);
            
shadeTriad.setText(sTitle);
        }
}

setTickerMode(int mode)
{
    if (
mode || mode 2) return;
    
    
state mode;
    
myChange true;
    
mainHinter.hide();
    
shadeHinter.hide();
    if (
mode == 0)
        {
            
TickerTimer.stop();
            
attSongtickerScroll.setData("1");
            
attSongtickerNoScroll.setData("0");
            
attSongtickerTriad.setData("0");
            
mainTicker.setXMLParam("ticker""1");
            
shadeTicker.setXMLParam("ticker""1");
            
mainTicker.show();
            
mainTriad.hide();
            
shadeTicker.show();
            
shadeTriad.hide();
        }
    else
        if (
mode == 1)
            {
                
TickerTimer.stop();
                
attSongtickerScroll.setData("0");
                
attSongtickerNoScroll.setData("1");
                
attSongtickerTriad.setData("0");
                
mainTicker.setXMLParam("ticker""0");
                
shadeTicker.setXMLParam("ticker""0");
                
mainTicker.show();
                
mainTriad.hide();
                
shadeTicker.show();
                
shadeTriad.hide();
            }
        else
            {
                
attSongtickerScroll.setData("0");
                
attSongtickerNoScroll.setData("0");
                
attSongtickerTriad.setData("1");
                
mainTicker.hide();
                
mainTriad.show();
                
shadeTicker.hide();
                
shadeTriad.show();
                
TickerTimer.start();
                
System.onTitleChange("");    //update display
            
}
    
myChange false;
}

mainTicker.onRightButtonUp(int xint y)
{
    
PopupMenu tickerMenu = new PopupMenu;
    
tickerMenu.addCommand("Enable Scrolling"0attSongtickerScroll.getData() == "1"0);
    
tickerMenu.addCommand("Disable Scrolling"1attSongtickerNoScroll.getData() == "1"0);
    
tickerMenu.addCommand("Triad Ticker"2attSongtickerTriad.getData() == "1"0);

    
setTickerMode(tickerMenu.popAtMouse());
    
complete;

    
delete tickerMenu;
}

mainTriad.onRightButtonUp(int xint y) { mainTicker.onRightButtonUp(1010); }
mainHinter.onRightButtonUp(int xint y) { mainTicker.onRightButtonUp(1010); }
shadeTicker.onRightButtonUp(int xint y) { mainTicker.onRightButtonUp(1010); }
shadeTriad.onRightButtonUp(int xint y) { mainTicker.onRightButtonUp(1010); }
shadeHinter.onRightButtonUp(int xint y) { mainTicker.onRightButtonUp(1010); }

attSongtickerScroll.onDataChanged()
{
    if (
myChange) return;
    if (
attSongtickerScroll.getData() == "1"setTickerMode(0);
}

attSongtickerNoScroll.onDataChanged()
{
    if (
myChange) return;
    if (
attSongtickerNoScroll.getData() == "1"setTickerMode(1);
}

attSongtickerTriad.onDataChanged()
{
    if (
myChange) return;
    if (
attSongtickerTriad.getData() == "1"setTickerMode(2);
}

// hint text functions (all hints from other scripts are sent to bypassHinter)
bypassHinter.onTextChanged(string hint)
{
    
mainHinter.setText(hint);
    
shadeHinter.setText(hint);
    if (
hint != "")
        {
            
mainHinter.show();
            
mainTriad.hide();
            
mainTicker.hide();
            
shadeHinter.show();
            
shadeTriad.hide();
            
shadeTicker.hide();
            
restoreTimer.stop();
            
restoreTimer.start();
        }
    else
        {
            
restoreTimer.stop();
            
mainHinter.hide();
            
shadeHinter.hide();
            if (
state == 2)
                {
                    
mainTriad.show();
                    
shadeTriad.show();
                }
            else
                {
                    
mainTicker.show();
                    
shadeTicker.show();
                }
        }

}

restoreTimer.onTimer()
{
    
bypassHinter.onTextChanged("");        //clear hint
    
restoreTimer.stop();

problem is that when playing Internet Radio i'm getting something like '1003' in songticker (when Triad Ticker is choosen) and not id3 information????

any help?
thnx in advance

~krcko


krckoorascic is offline   Reply With Quote
Old 22nd March 2005, 13:53   #2
Michgelsen
Major Dude
 
Michgelsen's Avatar
 
Join Date: Oct 2003
Location: Netherlands
Posts: 1,416
No I'm sorry you can't get id3 information from internet radio, that's why you never see notifiers display the title and artist when using the radio.
They're set to something like this: if(filename begins with http://) {don't do anything;}
Michgelsen is offline   Reply With Quote
Old 22nd March 2005, 13:59   #3
carlosp
Major Dude
 
carlosp's Avatar
 
Join Date: Nov 2002
Location: Hamburg, Germany
Posts: 1,312
yes, thats the only way to dig it you can then show a little I-Net logo if the file name contains http:// .
carlosp is offline   Reply With Quote
Old 22nd March 2005, 16:21   #4
JW
Senior Member
 
Join Date: Nov 2004
Location: Valencia, CA
Posts: 304
What about the track info that appears in the playlist when playing a stream?
JW is offline   Reply With Quote
Old 22nd March 2005, 17:08   #5
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
The trackname differs on streaming... DI use one instance for it's streaming, and another instance in the playlist for current track...

Something like this:

1. Digitally Imported (Stream... bla bla bal) etc.
2. Pinball - Time (Super Enchanted Extended Radio Remix)..

This i s an example... but DI always shows 2 instances in the playlist while streaming.

Others use only one instance like

1. Flashrider - Sex in the clubs (NRK Mpetre) <-- radio's name after songtitle...

Prolly many ways to deal with this.

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Old 22nd March 2005, 19:58   #6
krckoorascic
Senior Member
 
krckoorascic's Avatar
 
Join Date: May 2004
Location: Serbia
Posts: 351
Send a message via ICQ to krckoorascic Send a message via AIM to krckoorascic Send a message via Yahoo to krckoorascic
ok, but how to display information which Media Library recives?
i mean, when playing Internet Radio with normal ticker ('Enable Scrolling' or 'Disable scrolling' in menu) you can see data from media library?
...


krckoorascic is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump