Extended Week Widget. Code that returns a lot more show info. No hacks to AT code.
  • image
    I made this to return an extended week show schedule in UTC with a lot more info. Its in UTC so I can change the schedule times on the client size to local time.
    It is completely independent of any airtime calls and so should be future proof.
    It returns: Show Title, Show Description, Show ID, URL, Genre, Show Color, Show Background Color.

    Create this folder: /usr/share/airtime/public/api2/week-info/
    and then copy this file below into it (index.php).

    Put this in the browser http://myairtimeserverdomain.com/api2/week-info/ to see the output.

    Here is mine: http://x-pedia.org/api2/week-info/


    Post edited by John Chewter at 2014-08-03 13:19:18
    No longer using Airtime or Libretime.
  • 51 Comments sorted by
  • Nice work! But how can I format the output? Guess I need an updated js and html file
  • This might get you started?

    Note this code expects the station time to be UTC and figures out the local time from client settings.
    I also do stuff with my genres in there (dont worry about that for testing) - its should work anyway.
    Post edited by John Chewter at 2014-08-04 08:06:35
    No longer using Airtime or Libretime.
  • Hello John, 

    THX for Code, but i have the Same Problem, how can I format the output? . Sorry, ah Quick example for a Noob please :)?

    THX
  • ? above is my code that formats it all. Is that not what you needed?
    No longer using Airtime or Libretime.
  • http://airtime.radio-wolke7.de/api2/week-info/

    I hav copy and paste your index.php

    ive removed
    Post edited by Andy at 2014-09-08 03:37:45
  • THX John, it Works!!


  • One Question John, I have a "Showname Example Holger" what can i do to set a Picture for Holger?

    THX 

    Post edited by Andy at 2014-09-08 12:53:25
  • I split the show url field in Edit Show like this:

    Normally its like http://www.mywonderfulradio.com

    I change it to http://www.mywonderfulradio.com|http://www.mywonderfulradio.com/images/john_doe_dj.jpg

    My code knows what to do with that ;)
    No longer using Airtime or Libretime.
  • THx a Lot, THX a Lot john :D
  • Hi John, a new question, where can I change the time format to 24 hours, and am and pm remove.

    THX. 

    here is the new shed http://webjab.de/programm
  • If you look in the javascript for DATE you will find it easlily enough. Just comment OUT the date formatting I added.
    No longer using Airtime or Libretime.
  • Hello, John, you can explain to me where exactly I must take out the data formatting? Thank you very much! Sorry for my bad English!
  • Date or Data?
    No longer using Airtime or Libretime.
  • Sorry i mean date :-)
  • function updateClock ( )
    {
      var currentTime = new Date ( );
      var currentHours = currentTime.getHours ( );
      var currentMinutes = currentTime.getMinutes ( );
      var currentSeconds = currentTime.getSeconds ( );
      currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
      currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
      # var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
      # currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
      # currentHours = ( currentHours == 0 ) ? 12 : currentHours;

      var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
      document.getElementById("clock").firstChild.nodeValue = currentTimeString;
    }

    Comment out the lines as above. I think that should do it.
    I had to do am/pm because the Americans cannot tell the time :O

    Post edited by John Chewter at 2014-12-06 11:41:21
    No longer using Airtime or Libretime.
  • I wanted to mention, by the way, that your script works beautifully on Krypton Radio. Our listeners absolutely love the fact that the schedule gives them show times in their area instead of making them translate from Pacific Standard Time or Pacific Daylight Time.

    Thank you, John. 
  • I am glad somebody finds it useful :)
    No longer using Airtime or Libretime.
  • Hello, we have a problem with your program plan. After an air time update we get no issue of the broadcasting plan more. Now we have taken temporarily the original plan. Is known to somebody whether this is a general problem or whether it lies only with us.

    Our Site The Original Plan: http://radio-wolke7.de/?page_id=73

    Your Plan: http://radio-wolke7.de/programm_original/programm.php

    Many greetings
    Björn

    Post edited by Björn End at 2014-12-28 17:55:12
  • http://www.deprogrammedradio.com/
    Here is mine working
    No longer using Airtime or Libretime.
  • Hello,

    I have copied once completely your code from above. Later I have noted, it stood still your IP in the php file. The complete program plan was indicated me. If I change this, however, in our Domain, nothing is indicated. However, the surprising one is that the other Widgets as well as also the original program plan function perfectly. See here: www.radio-wolke7.de....

    It is surprising that it has happened only after an air time update.

    It became updates: airtime:i386 (2.5.1-4, 2.5.1-6)
    OLD: 2/5/1-4
    NEW: 2/5/1-6

    Do you have this version also in use, or still the old one?

    Sorry for my bad English!

    Greeting
    Björn
    Post edited by Björn End at 2014-12-29 08:44:02
  • It doesn't surprise me - its is an extended API  - it should be compatible with the original
    No longer using Airtime or Libretime.
  • I just do not where the error is . I have now tried a lot . But nothing works . Then we have to take the normal schedule . Thank you for your help.
    Post edited by Björn End at 2014-12-29 09:04:17
  • Others have got it working.
    Switch on php error logging and look for errors in the Javascript error console.

    You are probably missing a trailing semicolon or similar.
    No longer using Airtime or Libretime.
  • Can you please if it is possible for you even test our schedule . I once uploaded the files. Our URL is there already entered. Unfortunately, I find no error in the code. I would be very grateful !

    http://radio-wolke7.de/programm_original/shedule.zip

    Thank You!

  • I have now discovered an error. I suspect that the api path has changed. In your code you used api2 , I changed to this api . So I have a success.

    http://radio-wolke7.de/programm_original/programm.php

    My next problem is, the descriptions are no longer displayed. Why is that ? Furthermore, the times no longer simmen . This is offset by 1 hour.
    I 'm going to continue to look for problems.


  • I have solved the problem. After the update of the airtime /api2/week-info/index.php file was deleted . Now it works again! Thank You!
  • When it was written, there was only one API. I guess that caused the confusion :)
    No longer using Airtime or Libretime.
  • Hello,

    this script is excellent...

    here is my model: Air Gay Radio Shedule

    I would like to know how to do to put the pictures by sho at the right... 

    I don't understand how to do... 

    thank you very much

    Regards

    Patrick
    Post edited by Patrick Edouard at 2015-07-12 23:59:32
  • Thanks - you have used it very well :)

    Pasted from above:

    I split the Show Url field with a pipe character '|' in Edit Show like this:

    Normally its like http://www.mywonderfulradio.com

    I change it to http://www.mywonderfulradio.com|http://www.mywonderfulradio.com/images/john_doe_dj.jpg

    My code knows what to do with that.
    If there is no image url supplied - it substitutes the default pic.
    Post edited by John Chewter at 2015-01-19 11:13:14
    No longer using Airtime or Libretime.
  • Thank you for this wonderful extended widget. I am already tweaking it to fit my own needs. 

    I do have one question so far... Have you had any issues with it NOT showing schedule data in Internet Explorer? It seems to work in every other browser I have tested, but not IE. Any thoughts?

    EDIT: I am also wondering if it is supposed to automatically switch the "Currently Playing" when the next track starts. I notice that it takes a refresh for that to happen for me.
    Post edited by Reverend Kyle at 2015-02-03 22:40:07
  • Yes, mine works in IE and auto refreshes.

    Sounds like there is a Javascript typo or two. What does the Javascript error console say?

    No longer using Airtime or Libretime.
  • Thank you John, good work!

    I have modified your script including some new features:

    1. Get the color from Airtime calendar.
    2. Possibility to change default texts in the script.
    3. Possibility to change default background and text colors in the script.
    3. Better CSS for rotation and truncate strings with ellipse in case genre is too long.

    In the website script you can change the following miscText variables to fit your needs:
    defaultGenre: Default text to show if there is no genre.
    nowPlaying: Default text for :"Current show. Now playing.." text

    miscText:{... readMore:"Leer más", defaultGenre:"Radio", nowPlaying:"Sonando ahora..."}


    Also you can define background and text colors as new variables like this:

    miscText: {....},

    backgroundColor: "#d52a33",


    textColor: "#fff",


    Include this css in your widget.css:



    #widget_logobox {width:80px; float:right; margin-left:12px; margin-top:6px;}
    #widget_logobox img {border:0px; width:80px; height:80px;}
    #jbcShowname {font-size:14px; color: #000000; text-decoration: none;}
    #jbcShowdesc {font-weight:normal; color: #444444; font-size: 11px;}
    #jbcReadmore { color:#d52a33;}
    .box a {text-decoration: none;}
    td a:link {text-decoration: none;}
    p.rotate {
    float: left;
    background: transparent;
    text-align: center;
    font-size: 1.2em;
    white-space: nowrap;
    position: relative;
    padding: 0;
    margin: 0;
    width: 16px;
    height: 113px;
    left:2px;
    text-transform: uppercase;
    }
    p.rotate span {
    -moz-transform: rotate(270deg);
    -moz-transform-origin: 50% 50%;
    -webkit-transform: rotate(270deg);
    -webkit-transform-origin: 50% 50%;
    transform: rotate(270deg);
    -o-transform: rotate(270deg);
    transform: rotate(270deg);
    -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=6.123233995736766e-17, M12=1, M21=-1, M22=6.123233995736766e-17, SizingMethod='auto expand')";
    position: relative;
    left: -44px;
    height: 24px;
    width: 100px;
    top: 43px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 0.9em;
    letter-spacing: 1px;
    text-decoration: none;
    text-align: center;
    visibility: visible;
    display: block;
    text-decoration: none;
    }

    You can check the working week-info widget here: http://97irratia.info/es/programazioa/


    Important notice:Use the second file, the first one's sourcedomain points to the wrong url, I could not remove it

    Post edited by Bashatee Radio at 2015-03-14 17:34:38
  • Could someone guide me through this ? I am a bit confused what goes where. I want to embed the schedule widget on a Wordpress page.
    Post edited by slavi at 2015-03-25 09:52:29
  • I'm still having difficulties with this. In fact, working on this for months reading posts and whatnot but I just don't know what's going on.

    The station time is set to UTC.
    There are shows scheduled to play 4 times on Tue, Thur, Fri and Sun (AEDST).

    I've used both these in the jquery.showinfo.js file:
    api/week-info: http://airtime.offthecuffradio.net/api/week-info/
    api2/week-info: http://airtime.offthecuffradio.net/api2/week-info/

    My schedule.php is here: http://offthecuffradio.net/bkup-otc-schedule.php

    Right now it shows the correct times for the shows but on Mon, Tue, Wed and Thur; no idea why?

    I would SO love for someone to be able to help. I used your updated files John but still no luck.

    If more info is needed just let me know.

    Thanks,
    jolly
    Post edited by Chris Jolly at 2015-03-28 21:45:20
  • I would like to Hire john to do this for me
  • No thank you Holly. I remember last year. I will see if I have time to look at this again, for everyone, later in the the week as I am busy rolling out a station this week and a big website.
    Post edited by John Chewter at 2015-04-06 17:07:19
    No longer using Airtime or Libretime.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    thx John, this tool works fine and I will implement this in our radio station next week.

    For now I'm testing and customizing and the only issue I have is AM/PM.
    Commenting the 3 rows out you mentioned above doesnt last for me.
    But hopefully Björn End or anyone else can help me out with this.

    Thanks anyways, this saves us a lot of time!
    Cheers!
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Shoutout to Holly Hall's little radio project getting a shoutout in Radio World this week...  =))
  • Does not last? What does that mean?
    Have you a caching problem?
    No longer using Airtime or Libretime.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator

    Does not last? What does that mean?
    Have you a caching problem?

    means it does not work with just commenting lines.
    evene deleting lines doesn't change anything.
    don't know of a caching problem...
    but even don't know how to check ;-)
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    got it working now without AM:PM and with 24hrs!

    I also had to comment out a few lines in the js-file (jquery.showinfomsocial-test.js or whatever you named it.

    In the first block comment out lines 8 to 13 (here font color green) and delete ' + ext (here font color red) in line 14.

    function formatTimeAMPM(date) {
        function pad(n) { return (n < 10) ? '0' + n : n; }
           var time = new Date(date);
        var hours = time.getHours();
        var minutes = time.getMinutes();
        /*var ext ='am';
        if (hours >= 12) {
            hours -= 12;
            ext ='pm';
        }
        if(hours === 0) { hours = 12; }*/

        return hours + ':' + pad(minutes) + ext;
    }

    thx John for this tool, it helps a lot...
    Post edited by hoerich at 2015-04-14 07:18:58
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • OOPS My bad :(
    Sorry
    No longer using Airtime or Libretime.
  • Vote Up0Vote Down bbcrtvbbcrtv
    Posts: 2Member
    Can this be used for now playing too? Would it be possible to use it for the Now Playing widget to show an image?
    Post edited by bbcrtv at 2015-05-07 04:48:35
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    I'd prefer to see an image-including version of the Original OnAirToday-Widget.
    http://sourcefabric.booktype.pro/airtime-25-for-broadcasters/exporting-the-schedule/

    To repeat myself... me, our team and our website users love your Extended Week Widget!
    The only open wish would be, that it jumps automatically to the current show...
    But an extended OnAirNow Widget would fulfill our website-needs completely.

    What ya think, John?
    Ain't you interested for yourself? ;-)

    Or would I be able to customize it by myself (with a little guidance)
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Of course, I have an on-air solution built into my player and a js web ticker for it. I am rather busy working on a non airtime solution at the moment to make a generic one. I will have a look when I have time.
    Some of the LOUDER people in here slam my proposed solution for that - but I notice they did not make one at all.
    Post edited by John Chewter at 2015-05-10 13:27:42
    No longer using Airtime or Libretime.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    everyone has his own priorities... thx anyways, John!

    I'll see what the next weeks bring, maybe I'll try for myself...

    John, it looks like your provided js-file still contains the (original?) widget infos for "OnAirToday".
    Do you know if the OnAirToday-Script is working with your files? Did you test this?

    I am wondering which js-file I'd start to customize for a try, the original jquery.showinfo.js or your edited one?
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • hello, excuse my English, thank you for your code, but it does not work for me, I followed the procedure, I have a page with orange top clock right, no info on the inside of the page . can you give me a walking suivre.j'ai well the 3 files:
    index.php at-widget.zip I unzip, jqueryshowinfomsocial.zip I unzip. thank you for your help.
  • The maintainer has unsubscribed.
    You might can contact him via skype

    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • Vote Up0Vote Down HollyHolly
    Posts: 30Member
    could I pay someone to do this for me? Id like it built into a theme we created for radio
  • Vote Up0Vote Down HollyHolly
    Posts: 30Member
    anyone?