[feature request] template to create a series of shows
  • Hi all,

    I'm part of a local radio station in Clermont-Ferrand, France, and we are starting these days to use airtime to schedule our music shows. First of all, thank you for this software, it's very close to our requirements. 

    However, we are not fully satisfied by the calendar, and more precisely by the way to create shows. In our station, all the mondays are (almost) similar (in the sense of smart blocks), and the same for the tuesdays, wednesday, etc. We have in mind to introduce in airtime a kind of template system that will be used to fill automatically a (part of a) day by a series of shows. 

    Our idea consists in describing a typical time slot with a list of shows, each one described by a name, a duration, and a list of audio entities (smart block, playlist or music). This template will be imported in the calendar to create shows, possibly with weekly repeats, for example, and fill them with the audio entities.

    Is somebody interested by such a functionality? From which branch do I have to start in order to introduce this kind of idea?
  • 10 Comments sorted by
  • Vote Up0Vote Down Albert SantoniAlbert Santoni
    Posts: 68Member, Sourcefabric Team, Airtime Moderator
    Hi Jean-Marie, 

    That sounds like a useful feature. To get started, check out the 2.5.x branch on Github:

    The show scheduling code is not too difficult to work on. A good starting point would be the Show model class:

    Try writing some code that creates a new show and saves it, and then you can try to build up some sort of template structure from there. 

    As an alternative, would implementing copy and paste for shows in the calendar solve your problem? I'm not totally certain I understand what you're trying to do.

    Thanks!
    Albert
    Airtime Developer @ Sourcefabric
  • I dont really get what you want to do, but if i understand well and you have repeating shows every week (like me) and want to add specific smart blocks quickly to multiple shows then calendar is NOT the place to do that but instead you should ALWAYS use the "NOW PLAYING" tab.
    There you can press the "add/remove content", choose smart blocks and for a specific date (or date range) choose a specific show, select all instances (through the cursors there) and add this block to all of them (if its a dynamic block then dynamic content will be created for each instance seperatedly).
    The trick ofcourse is to have weekly repeated empty shows for this to work quickly.
    With this procedure and with the changes i have done (i have the code elsewhere) i can create my weekly schedules within 2 minutes top.

    If this is not what you want to do then can you be more specific to see if we can help? :)

    Make sure you check "Airtime Hacks" section ;)
    Post edited by Stathis Simos at 2015-12-11 15:33:14
  • Thank you for your answers. The suggestion Stathis Simos made is one interesting path, but I plan to have something more automatic. The copy/past show suggested by Albert Santoni will not be very helpful to fill them with smart blocks randomly instanciated for each instance of a show. That's what I plan some modifications in airtime.

    Let me first introduce myself and my project: I'm an open source developer and computer scientist, I'm used to develop and adapt software to my needs. My strong motivation is to help my radio station (Radio Campus Clermont-Ferrand, France) to be efficient, but I'm also very motivated in contributing to the airtime software.

    Our shows are usually live between 6pm and 12pm. Except that, we want the music to be scheduled hour by hour with some specific constraints (such as no electronic music between 12am and 6pm, jingles every 15 mn, etc). Each day is a bit different (on Sunday we have specific shows to schedule, for example). To achieve that, we created one kind of playlist per hour of the day, filled by smart blocks that choose the jingles and songs. Thus, we need to fill our schedule table with shows (which are filled with a corresponding playlist) following a template specific to each day of the week. 
    Doing it automatically will help us to: update these shows in case new songs has been added to the media center, and will help to generate all the future days (we plan to fill the days month by month, except for the updates). Action 1 and 3 (below) should be very useful for that.

    One supplementary request is that we are playing jingles that are perishable (due to a specific event). It means that we have to be able to replace them from the schedule by another perishable jingle. We plan to do that using a dedicated genre ("spot"), and by creating a smart block of one media selected using this genre. Action 2 (below) corresponds to this requirement.

    My plan is thus to introduce a couple of required functionalities, corresponding to these habits, probably following this path:

    1/ clear a day
    Add a (x) button in top of each day in the calendar that will give 2 possible actions:
    •  remove the content of all the instances of the current day
    • remove all the instances of the current day

    2/ replace content 
    Add a [replace] button close to the [+show] button that will open an interface 
    to:
    • select scheduled media in all the future shows using a filter similar to the smart blocks (I'll start only by filtering using the genre)
    • choose a media to put in place of (for example a smart block)
    • possibly choose a begin and end date to apply this replacement tool
    After applying it, it will replace all the matching media in all the future shows by the selected media

    3/ create and fill shows using templates
    Add a [+shows] button that will give a way to:
    • select a day and a possible repeat rule
    • import a template (in xml or json format) that describe a day:
    • each show described by its hour, duration
    • each content show described by the name of a media (typically a playlist, assuming that it exists in the media, and with an unique name)
    • run the generation (it will create all the corresponding shows and will fill it)

    To achieve that, I have some question:
    • Do you think these improvements will have place in a public branch of airtime? 
    •  from which branch do I have to start with? We're running at our radio station airtime 2.5.1, that has been installed with the debian setup package and I'll be very motivated in using my contributions directly on our instance
    • how do I have to configure a development environment? My idea was to install another instance of airtime 2.5.1 using the same script (in a virtual machine), then replace /usr/share/airtime/ directory by a link to the airtime_mvc of my git working directory instance. Is it the correct way to configure a development environment?
    Thank you very much for your answers.
  • Well i understand that what i said is not perfect but UNTIL we are able to do what you are talking about (and i say "we" because i dont see it coming officially...) you can follow what i said just to make your life easier :)

    Automation is one of my goals too and i am working on it on my (very very limited) free time since i am also a software engineer with a CS degree, but is not a very easy task.

    Since i have worked in some of the things you talk about (like jingles every xx minutes etc) please check this: https://forum.sourcefabric.org/discussion/17792/playlists-jingles-or-spots-every-xx-items-update-and-for-dynamic-blocks



    and if as developer you can help to do things even better then you are welcome (after all everything i done was done in just a few hours since i dont have time and can be done a lot better i am sure)

    Just a question.. if "linked shows" (not empty ones) were working ok (and not like they work now), would this be the solution for many of the things you want to do? why you specifically want the number 3/to be so complicated with xml templates etc?

    number 1/ is very easy in the "now playing" section (especially with the cursors hack i am proposing in one of the links) so i dont really see the point to do it all over again in calendar BUT this shouldnt be so difficult to do it if necessary. For example two buttons, one with a loop that would call the "remove all content" for each instance in the specific date and one with a loop that would call the "delete this instance" in the specific date. If this is really needed we can see how this can be done.

    number 2/ can also be done (until a certain point) from the "now playing" section for a specific show within a specific date range with a few clicks (ofcource not replace a specific genre but delete content and add new). To do what you say, this would be much more difficult than 1/ and the main problem for me would be that something like this will be very a little "heavy", it already takes some time to just add content, imagine if you had to say "select every song that has a genre that contains "ROCK" and delete it and then update the show to recreate the new start-ends for each song and then add new content for the remaining time with genre containing "xxx" until you fill the total time again and then NO you are not finished, you have to shuffle all items in order to have a balance.. OR in an other approach do the replace for each song.. delete and insert a new song with new criteria but with other problems for the total time calculation of the show there" ... i think all that would be super heavy in the way things are done right now in Airtime :)

    To tell you the truth i dont really like Calendar thats why i work (as you will see) in the "Now playing" section that has already many of the things needer for everything we talk about.. 
  • So... to begin with...
    A quick and dirty (and not automated) temporary solution for deleting items with specific genre in a show.... there is no much point in this since it is just as quick to delete everything and add new content but as i said, just to begin..

    Here is what i have done in the "now playing" tab (that is also used in the calendar in most cases).. 

    First of all i dont care to see the column "album" in the schedule list so i changed it to "genre" like that:
    In the file application/models/Schedule.php
    i changed the line ft.file_album_title AS file_album_title, to ft.genre AS file_album_title, (used an existing column to avoid any other changes)

    In the public/js/airtime/showbuilder/builder.js file
    Just under the $menu.append("<div class='btn-group'>" + Added the two rows below:
    "<label style='vertical-align: middle;'>Genre contains:</label>" +
    "<input type='text' id='txtGenre' style='width:70px; margin-right: 5px; background-color: #dddddd; vertical-align: middle;'></input>" +

    and changed the mod.selectAll function like that:

    mod.selectAll = function () {

            if ($("#txtGenre").val() != ""){
                    $genre = $('#txtGenre').val();
                    $row = $(".sb-album:contains('" + $genre + "')").parent()
                    $row.find("input:checkbox").attr("checked", true);
                    $row.addClass(SB_SELECTED_CLASS);
            }
            else
            {
                    $inputs = $sbTable.find("input:checkbox");
                    $inputs.attr("checked", true);
                    $trs = $inputs.parents("tr");
                    $trs.addClass(SB_SELECTED_CLASS);
            }

            mod.checkToolBarIcons();
        };

    Also i changed the line
    /* album */ {"mDataProp": "album", "sTitle": $.i18n._("Album"), "sClass": "sb-album"},
    to
    /* album */ {"mDataProp": "album", "sTitle": $.i18n._("Genre"), "sClass": "sb-album"},

    Just to show the correct label...

    So now you should have a genre column in the table and also a textbox before the "select" dropdown.
    If this textbox has any value, only checkboxes inside rows with genre containing this value will be checked.

    This is not to be used for exactly what you want but just to experiment and play with.. you could use the keyword to look in every cell. After filtering like that, if textbox is not empty you could have another button to "swap" those files with something else or even better (and easier) if you add a smartblock or content from library at the right ou could have a new button there that instead of adding this content in the end of the show, you could just replace the filtered items (either loop to each checked item, delete it, take the first item from the dynamic block you are adding and put it in the same place, there is an order column for this, or update the file_id in this datarow, but either way you have to be careful with duration and ordering) 
  • Thank you for these ideas. I've been throw the source code since our posts, and step by step I understand better your motivation to hack the "now playing" part.

    However, I'm not 100% sure which version I have to modify. Do you start to work on 2.5.2.x, or are you still using 2.5.1?
     There is no migration tool between the two releases, neither deb installers, and feedback about 2.5.2 seems not very good:

  • I am using 2.5.1 and by the last time code has changed and many other things are added. The latest addition (i am about to "publish") is the "news by the hour" (if this is a correct frase) That is still not uploaded here (i am still testing this but seems OK.. i describe how it works in post about Jingles).
    So by now i have the Logo/Jingles/Spots every xx items (pretty dynamic per block with some few limitations), The news by the hour option that you can have news files play at a specific minute, you have an option to avoid repeating the same song if it is scheduled the last xx hours (counting the date of the show and not "now") and finally the changes to "now playing" with the selection/deselection of cursors, the selection of all files of a specific genre (so you can delete those files only) etc...
    Those are the changes until now to reach a little further to the goal of automation (most of the changes were requests in PM by other users)

    Full automation may be the ultimate goal but its a difficult task and i dont know if its worth it if you reach a point were things are pretty easier to be done and within a few minutes.. 

    Like a developer i would be glad to hear your thoughts on this and maybe suggestions for other things that could be done (after all i am not at all good at "things" like php, jquery etc.. i wrote php a few days ago just for Airtime for my station so most probably what i did can be done A LOT better so if you are better on this feel free to do whatever you like ;) )


    PS. I have not tested version 2.5.2 so i dont know at all the changes in code between 2.5.1 and 2.5.2 
    One user that tested my files for Jingles (the version without the latest bug fixes) told me that they work OK in 2.5.2.1 but i dont know if by using them he now misses other version bug fixes in those files.
    Post edited by Stathis Simos at 2015-12-22 08:21:53
  • My first modification was related to the live info API, and I put it on our airtime git repository:

    I'll probably follow your suggestions and modify the "now playing" to remove/replace a specific kind of content.
  • I followed the suggestions in this thread, and added

    1/ A new row corresponding to the genre, and a filter by genre

    2/ A "replace" button in the "now playing" tab:

    I tested this last modification in a couple of shows, but not with complicated configurations...

    I'll be very interested in having some feedback on these modifications.
  • This sounds similar to what I was planning on coding. See https://forum.sourcefabric.org/discussion/17687/questions-about-pypofetch-getschedule-for-automated-dynamic-smart-blocks

    But I've been using Airtime.pro and was hoping to build off of the substantial work that the dev time has put into it. Just today I noticed that the saas-dev version appears to no longer on github but perhaps this is just because it wasn't really coded with the public in mind. Regardless the podcasting and improved UI functionality are pretty awesome in my mind and I my station needs podcasting to fully automate our broadcast day.

    I'm going to look at your code and test it with my instance. I sent an e-mail to Albert and Daniel asking about the status of the SAAS branch, but it seems like more work is being done to clean up 2.5.x so maybe they are just planning on pushing the code back to a public development branch.

    I am currently in school studying CS so I haven't had as much time to work on Airtime development as I would like but I will try to test your code and provide feedback.

    Thanks for sharing.