The nice thing about this code is that you can auto sync refreshes and know exactly when a song starts and ends, based on the timestamp of when the current song is playing and what time you currently grab. This means better and more accurate refreshes.
BTW, does anyone have the code to find out when the current song playing started or how long it has left or even when the next song supposedly should start playing? Dunno which would be the best. :P Chris On Fri, Mar 13, 2009 at 5:05 PM, Kipp Gremillion <[email protected]>wrote: > Nice, thanks, I will see if I can get this implemented. I am a novice at > this so this is a big help. > > Thanks again > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > FM5280 > Sent: Friday, March 13, 2009 3:11 PM > To: [email protected] > Subject: Re: [General-discussion] Displaying SAM server time on PHP > website. > > Try this: > //Get SAM's Time > $SAMdb->open("SELECT UNIX_TIMESTAMP() as timeonsam"); > $samtime = $SAMdb->row(); > $curtime = $samtime['timeonsam']; > > if $SAMdb is not your connector change it to $db > > then echo $curtime in the proper format you want. > > > ----- Original Message ----- > From: "Kipp Gremillion" <[email protected]> > To: <[email protected]> > Sent: Friday, March 13, 2009 2:08 PM > Subject: RE: [General-discussion] Displaying SAM server time on PHP > website. > > > > Excellent, that's what I need then. Thanks! > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf > Of > > James Henline > > Sent: Friday, March 13, 2009 3:02 PM > > To: [email protected] > > Subject: Re: [General-discussion] Displaying SAM server time on PHP > > website. > > > > MySQL can query the server time, which should be the time the computer > has > > and return that. > > > > James Henline. > > Help Desk Manager > > Development Manager > > Spacial Audio Solutions LLC. > > 972-739-6420 ext: 110 > > www.audiorealm.com > > www.spacialnet.com > > www.spacialaudio.com > > > > CONFIDENTIALITY NOTICE: This email, including any attachments, contains > > information from SpacialAudio Solutions LLC., which may be confidential > or > > privileged. The information is intended to be for the use of the > > individual > > or entity named above. If you are not the intended recipient, be aware > > that > > any disclosure, copying, distribution or use of the contents of this > > information is prohibited. If you have received this email in error, > > please > > notify the sender immediately by "reply to sender only" message and > > destroy > > all electronic and hard copies of the communication, including > > attachments. > > > > > > On Fri, Mar 13, 2009 at 3:54 PM, Kipp Gremillion > > <[email protected]>wrote: > > > >> Thanks for the reply... > >> > >> So you are saying MySQL server can provide the time itself, or I have to > >> put > >> the time into the DB constantly? I thought of putting it there but it > >> would > >> not be very accurate unless I did it constantly and that seems > intensive. > >> > >> > >> > >> -----Original Message----- > >> From: [email protected] > >> [mailto:[email protected]] On Behalf > Of > >> Chris Haslage > >> Sent: Friday, March 13, 2009 2:47 PM > >> To: [email protected] > >> Subject: Re: [General-discussion] Displaying SAM server time on PHP > >> website. > >> > >> I would think that can be grabbed from the MySQL database directly. You > >> may > >> want to google on how to get the current time from a remote MySQL > > database. > >> > >> Thanks, > >> > >> *Chris* > >> > >> On Fri, Mar 13, 2009 at 3:45 PM, Kipp Gremillion <[email protected] > >> >wrote: > >> > >> > I am looking for suggestions on how to get the SAM server time > >> > displayed > >> on > >> > a PHP web page that my DJ's will see so they will know accurately what > >> time > >> > the SAM server has and in turn, when to start streaming to my server > >> > for > >> > relaying. > >> > > >> > Thanks, > >> > Kipp > >> > _______________________________________________ > >> > General-discussion mailing list > >> > [email protected] > >> > http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > >> > > >> > TO unsubscribe to this list, simply send a blank email to > >> > [email protected] > >> > > >> > with the subject > >> > 'unsubscribe' > >> > > >> _______________________________________________ > >> General-discussion mailing list > >> [email protected] > >> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > >> > >> TO unsubscribe to this list, simply send a blank email to > >> [email protected] > >> > >> with the subject > >> 'unsubscribe' > >> > >> > >> _______________________________________________ > >> General-discussion mailing list > >> [email protected] > >> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > >> > >> TO unsubscribe to this list, simply send a blank email to > >> [email protected] > >> > >> with the subject > >> 'unsubscribe' > >> > > _______________________________________________ > > General-discussion mailing list > > [email protected] > > http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > > > > TO unsubscribe to this list, simply send a blank email to > > [email protected] > > > > with the subject > > 'unsubscribe' > > > > > > _______________________________________________ > > General-discussion mailing list > > [email protected] > > http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > > > > TO unsubscribe to this list, simply send a blank email to > > [email protected] > > > > with the subject > > 'unsubscribe' > > > > > > _______________________________________________ > General-discussion mailing list > [email protected] > http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > > TO unsubscribe to this list, simply send a blank email to > [email protected] > > with the subject > 'unsubscribe' > > > _______________________________________________ > General-discussion mailing list > [email protected] > http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > > TO unsubscribe to this list, simply send a blank email to > [email protected] > > with the subject > 'unsubscribe' > From [email protected] Sat Mar 14 13:20:24 2009 From: [email protected] (Rob) Date: Sat Mar 14 14:53:10 2009 Subject: [General-discussion] Displaying SAM server time on PHP website. In-Reply-To: <[email protected]> References: <c4dc7ba03b1f40c9beeb44051b80d...@thedjbooth> <[email protected]> <c191d8f27ee544c4b361386557984...@thedjbooth> <[email protected]> <9943e2062edb494181dea5ca790d7...@thedjbooth> <[email protected]> <f674ba9f06a449c0be3cdb2c63fba...@thedjbooth> <[email protected]> Message-ID: <[email protected]> Assuming sam template was used and $song has been populated Using the code I posted already to get the current time where SAM is: $starttime = strtotime($song["date_played"]); $secsRemain = (round($song["duration"] / 1000)-($curtime-$starttime)); //using javascript to calculate time remaining <script language="JavaScript"> var countDownInterval = <? echo $secsRemain; ?>; var countDownTime = countDownInterval + 1; if (document.all||document.getElementById) countDown(); else window.onload = countDown; function countDown() { countDownTime--; if (countDownTime == 0) { countDownTime = countDownInterval; window.location.reload(); return; } else if (countDownTime < 0) countDownTime = 10; if (document.all) document.all.countDownText.innerText = secsToMins(countDownTime); else if (document.getElementById) document.getElementById("countDownText").innerHTML = secsToMins(countDownTime); counter = setTimeout("countDown()", 1000); } function secsToMins(theValue) { var theMin = Math.floor(theValue / 60); var theSec = (theValue % 60); if (theSec < 10) theSec = "0" + theSec; return(theMin + ":" + theSec); } </script> //display time left: Time left: (<a id="countDownText"></a>) ///done/// this is the famous countdown script developed by FesterHead I believe. -DJCassio Chris Haslage wrote: > The nice thing about this code is that you can auto sync refreshes and know > exactly when a song starts and ends, based on the timestamp of when the > current song is playing and what time you currently grab. This means better > and more accurate refreshes. > > BTW, does anyone have the code to find out when the current song playing > started or how long it has left or even when the next song supposedly should > start playing? Dunno which would be the best. :P > > Chris > > On Fri, Mar 13, 2009 at 5:05 PM, Kipp Gremillion <[email protected]>wrote: > > >> Nice, thanks, I will see if I can get this implemented. I am a novice at >> this so this is a big help. >> >> Thanks again >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of >> FM5280 >> Sent: Friday, March 13, 2009 3:11 PM >> To: [email protected] >> Subject: Re: [General-discussion] Displaying SAM server time on PHP >> website. >> >> Try this: >> //Get SAM's Time >> $SAMdb->open("SELECT UNIX_TIMESTAMP() as timeonsam"); >> $samtime = $SAMdb->row(); >> $curtime = $samtime['timeonsam']; >> >> if $SAMdb is not your connector change it to $db >> >> then echo $curtime in the proper format you want. >> >> >> ----- Original Message ----- >> From: "Kipp Gremillion" <[email protected]> >> To: <[email protected]> >> Sent: Friday, March 13, 2009 2:08 PM >> Subject: RE: [General-discussion] Displaying SAM server time on PHP >> website. >> >> >> >>> Excellent, that's what I need then. Thanks! >>> >>> -----Original Message----- >>> From: [email protected] >>> [mailto:[email protected]] On Behalf >>> >> Of >> >>> James Henline >>> Sent: Friday, March 13, 2009 3:02 PM >>> To: [email protected] >>> Subject: Re: [General-discussion] Displaying SAM server time on PHP >>> website. >>> >>> MySQL can query the server time, which should be the time the computer >>> >> has >> >>> and return that. >>> >>> James Henline. >>> Help Desk Manager >>> Development Manager >>> Spacial Audio Solutions LLC. >>> 972-739-6420 ext: 110 >>> www.audiorealm.com >>> www.spacialnet.com >>> www.spacialaudio.com >>> >>> CONFIDENTIALITY NOTICE: This email, including any attachments, contains >>> information from SpacialAudio Solutions LLC., which may be confidential >>> >> or >> >>> privileged. The information is intended to be for the use of the >>> individual >>> or entity named above. If you are not the intended recipient, be aware >>> that >>> any disclosure, copying, distribution or use of the contents of this >>> information is prohibited. If you have received this email in error, >>> please >>> notify the sender immediately by "reply to sender only" message and >>> destroy >>> all electronic and hard copies of the communication, including >>> attachments. >>> >>> >>> On Fri, Mar 13, 2009 at 3:54 PM, Kipp Gremillion >>> <[email protected]>wrote: >>> >>> >>>> Thanks for the reply... >>>> >>>> So you are saying MySQL server can provide the time itself, or I have to >>>> put >>>> the time into the DB constantly? I thought of putting it there but it >>>> would >>>> not be very accurate unless I did it constantly and that seems >>>> >> intensive. >> >>>> >>>> -----Original Message----- >>>> From: [email protected] >>>> [mailto:[email protected]] On Behalf >>>> >> Of >> >>>> Chris Haslage >>>> Sent: Friday, March 13, 2009 2:47 PM >>>> To: [email protected] >>>> Subject: Re: [General-discussion] Displaying SAM server time on PHP >>>> website. >>>> >>>> I would think that can be grabbed from the MySQL database directly. You >>>> may >>>> want to google on how to get the current time from a remote MySQL >>>> >>> database. >>> >>>> Thanks, >>>> >>>> *Chris* >>>> >>>> On Fri, Mar 13, 2009 at 3:45 PM, Kipp Gremillion <[email protected] >>>> >>>>> wrote: >>>>> >>>>> I am looking for suggestions on how to get the SAM server time >>>>> displayed >>>>> >>>> on >>>> >>>>> a PHP web page that my DJ's will see so they will know accurately what >>>>> >>>> time >>>> >>>>> the SAM server has and in turn, when to start streaming to my server >>>>> for >>>>> relaying. >>>>> >>>>> Thanks, >>>>> Kipp >>>>> _______________________________________________ >>>>> General-discussion mailing list >>>>> [email protected] >>>>> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion >>>>> >>>>> TO unsubscribe to this list, simply send a blank email to >>>>> [email protected] >>>>> >>>>> with the subject >>>>> 'unsubscribe' >>>>> >>>>> >>>> _______________________________________________ >>>> General-discussion mailing list >>>> [email protected] >>>> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion >>>> >>>> TO unsubscribe to this list, simply send a blank email to >>>> [email protected] >>>> >>>> with the subject >>>> 'unsubscribe' >>>> >>>> >>>> _______________________________________________ >>>> General-discussion mailing list >>>> [email protected] >>>> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion >>>> >>>> TO unsubscribe to this list, simply send a blank email to >>>> [email protected] >>>> >>>> with the subject >>>> 'unsubscribe' >>>> >>>> >>> _______________________________________________ >>> General-discussion mailing list >>> [email protected] >>> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion >>> >>> TO unsubscribe to this list, simply send a blank email to >>> [email protected] >>> >>> with the subject >>> 'unsubscribe' >>> >>> >>> _______________________________________________ >>> General-discussion mailing list >>> [email protected] >>> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion >>> >>> TO unsubscribe to this list, simply send a blank email to >>> [email protected] >>> >>> with the subject >>> 'unsubscribe' >>> >>> >>> >> _______________________________________________ >> General-discussion mailing list >> [email protected] >> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion >> >> TO unsubscribe to this list, simply send a blank email to >> [email protected] >> >> with the subject >> 'unsubscribe' >> >> >> _______________________________________________ >> General-discussion mailing list >> [email protected] >> http://mailman.spacialaudio.com/mailman/listinfo/general-discussion >> >> TO unsubscribe to this list, simply send a blank email to >> [email protected] >> >> with the subject >> 'unsubscribe' >> >> > _______________________________________________ > General-discussion mailing list > [email protected] > http://mailman.spacialaudio.com/mailman/listinfo/general-discussion > > TO unsubscribe to this list, simply send a blank email to > [email protected] > > with the subject > 'unsubscribe' > > >
