Announcement

Collapse
No announcement yet.

Twittercast: Shoutcast / Icecast Song Title To Twitter Status PHP Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Twittercast: Shoutcast / Icecast Song Title To Twitter Status PHP Script

    Shoutcast song title to twitter php script.

    This will query a shoutcast server for the currently playing song and set it as your twitter status.
    Only updates when the song changes.

    Download Here

    Instructions:

    1. Download required files
    2. Edit twitterAPI.php username and password
    3. Edit twittercast.php server info
    6. Upload all files in the same web directory
    7. Access twittercast.php using your browser or set up a cron job to hit it every 10 mins
    8. Check your twitter for results

  • #2
    Attachment deleted at poster's request

    ~dotme

    Comment


    • #3
      Good work.

      Am i ok to post this here with the other collectoin of scripts? http://www.streamsolutions.co.uk/resources/scripts
      www.streamsolutions.co.uk
      SHOUTcast | Flash Media | Windows Media | Icecast 2 | Content Delivery |

      Comment


      • #4
        Yes you may distribute freely =]

        updated file attached
        Attached Files

        Comment


        • #5
          Not working

          Well, I've done my best to set this up. I know the Twitter API is working fine because it does post, however all I get in a post is "Now Playing: " I have to delete the title.txt to get it to do it again. I have set IP and port in the .php

          Am I missing something?

          Comment


          • #6
            The way this works is. the script will check the shoutcast server for the currently playing song. It then checks the title.txt for the same title info... if the title.txt file is empty, or it has different title info, it will send that data to twitter, and it will also write that to the title.txt file.

            This script will ONLY update the title info if its different from the last time it checked, thus not posting the same title every min. (or however long you set your cron job for)

            here is an example of a cron job that could be used:

            */10 * * * * wget -O /dev/null http://www.domain.com/twittercast.php >> /dev/null 2>&1

            things to keep in mind:

            make sure the title.txt file is writable by your webserver (chmod 777 title.txt) and in the same directory as everything else.

            make sure there actually IS title info on your shoutcast server..

            just visit your shoutcast server in your browser to check that.


            I am also posting a new version.

            Changes:

            Support for multiple servers
            Added listener count to twitter output
            Added page refresh for automatic in-browser updates


            see working examples at www twitter com / dubstepfm
            Attached Files
            Last edited by dopelabs; 18 February 2009, 03:04.

            Comment


            • #7
              I know the server has titles and they do change. Is there a difference from hitting it with a browser or using a cronjob?

              Comment


              • #8
                no difference.. it will work either way

                Comment


                • #9
                  I did a chmod of the .txt to 777 , no help.

                  the two .php's should be at 644, correct?

                  Comment


                  • #10
                    also, can you tell me if the script puts any output on the page when executed via web browser. All I get is


                    // Twittercast Shoutcast Twitter Status Script By DopeLabs - http://www.dubstep.fm // Twittercast Shoutcast Twitter Status Script By DopeLabs - http://www.dubstep.fm

                    Comment


                    • #11
                      the new version displays exactly what will show up in your twitter status

                      Comment


                      • #12
                        downloaded new version, edited high bitrate server ip and port, didnt touch anything else.


                        Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/wdosfm/public_html/twitterstuff/twittercast_multi.php on line 113 Parse error: syntax error, unexpected ')' in /home/wdosfm/public_html/twitterstuff/twittercast_multi.php on line 113
                        any idea?

                        Comment


                        • #13
                          im not sure what to tell you...

                          this is what line 113 looks like on mine:

                          $twitter_status=postToTwitter($twitter_username, $twitter_psw, 'Now Playing: '.$song[1] .' - ' .$total_listeners .' Listeners');

                          note that the username and password IS NOT entered here but in the API page

                          This is my Twitter status

                          Now Playing: [ARCHIVE] 2008-12-12 The Supernormous Smoke Sessions With Tminus Shambles Jviz KidLogic And Guests - 357 Listeners

                          This is my browser output

                          Now Playing: [ARCHIVE] 2008-12-12 The Supernormous Smoke Sessions With Tminus Shambles Jviz KidLogic And Guests - 357 Listeners



                          My station has 4 servers... so my ip and port block looks like this ( i changed my actual IPs )

                          $ip[1] = "123.123.123.123";
                          $port[1] = "80";

                          $ip[2] = "123.123.123.124";
                          $port[2] = "8000";

                          $ip[3] = "123.123.123.125";
                          $port[3] = "8030";

                          $ip[4] = "123.123.123.126";
                          $port[4] = "8050";

                          if you only have 1 server.. erase blocks 2, 3, and 4... if you need more add 5, 6, and so on

                          Comment


                          • #14
                            Originally posted by crankygeek
                            downloaded new version, edited high bitrate server ip and port, didnt touch anything else.




                            any idea?
                            Maybe something you were trying to send had an apostrophe ( ' ) in it?

                            Also, if you send a duplicate to your previous twitter post...I don't think that it actually posts it again. I am pretty sure that it just ignores it.

                            Twitter has been nice to archive playlists though.
                            the detour network - detour MUSIC, detour TALK

                            Purple Zebra Consulting-http://purplezebra.us
                            Supporting independent internet radio stations since 2001!

                            Comment


                            • #15
                              thats why it writes the title info to title.txt it checks that for differences and will only post to twitter if there is a 'new' song.

                              yea maybe the song title has a ' in it...

                              Comment

                              Working...
                              X