Smart Blocks - Playing the latest episode of a programme?
  • I'm trying to come up with a way to schedule the latest episode of a programme on a weekly basis automatically. My immediate thought was to do this using a dynamic Smart Block but I'm having a problem specifying a last played time that will satisfy this rule. I tried using Last Played < 1 but it needs to be in a date format and unless I update the current date each time it fails. 

    Put more simply the problem is thus: Each day a cron downloads the most recent version of Democracy Now! (democracynow.org/static) and runs airtime-import to put the file in the library. The files are named "Democracy Now, Tuesday, 30 July, 2013" A linked repeated programme is scheduled daily at 14:00. How can this programme be automatically filled with the current episode only on a daily basis?

    Ideally a criteria such as "Play Count" or "Current Date" would solve this.

    Chris

  • 13 Comments sorted by
  • Vote Up2Vote Down Albert FRAlbert FR
    Posts: 1,978Member, Airtime Moderator
    before July 2014 !

    more seriously normally before Christmas,  you can follow the evolutions on the bug tracker :

    http://dev.sourcefabric.org/
    Post edited by Albert FR at 2013-09-10 09:07:31
  • Vote Up1Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    I got the same wish.
    Feature Request already ticketed here http://dev.sourcefabric.org/browse/CC-4690
    Should be implemented with v2.5
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Is there any idea on when 2.5 might be released?  I'm in desperate need of this feature.
  • Well - it wasn't in version 2.5. 

    Will it be in version 2.6, and when will that be released?  Still in desperate need of this feature.

  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator


    Well - it wasn't in version 2.5. 

    Will it be in version 2.6, and when will that be released?  Still in desperate need of this feature.



    2.6 is expected for 17th december.
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • I cheat with democracy now. I piggy back on a another station :O as livestream.
    However - I put a 1/2 way solution in Airtime Hacks. It downloads podcasts from rss feeds. Most podcasters have an rss stream. So, if you put that in a cron, you should always have the latest episode in a watched folder.

    Post edited by John Chewter at 2013-12-12 18:57:37
    No longer using Airtime or Libretime.
  • sorry guys, there's no plan right now to do a smart block that will support that feature... no time right now...
  • Well - I think we can do it right now using my published hack. If I modified very slightly my airtime rss importer so the lastest version is saved similar to: democracy-now-latest.mp3 and have it over-write the last one in a watched folder - that would do it! Just schedule that file on a repeating linked show?
    No Use?

    No longer using Airtime or Libretime.
  • Okay - it won't be in 2.6 either. 

    Are there actually plans to include this feature at some point in the near future, because I need to know whether it will be worth paying for developer time to pay a third party to hack this in.

  • I can see 2 ways of dong this
    1. If its just playing the latest file in a named watched folder, then this does not sound very difficult, except for modifying airtime's backend interface.
    2. My importer suggestion above would also work and it is a lot easier.
    No longer using Airtime or Libretime.
  • I tried this on your suggestion, John, and this actually worked.

    For those reading this thread for the first time, here is what you do:

    1. Create a watched directory where you can drop the latest copy of whatever regular show it is.
    2. Create a scheduled show using the AirTime calendar.
    3. Put a copy of the longest show you can find in the watched folder and rename the file "latest.mp3". (The reason for making it the longest show you can find will be explained in a moment.)
    4. Use the LINUX commands to make sure your owner and file permissions on
      "latest.mp3" are compatible with what AirTime like to see ('chown' it to
      whatever user your web server runs as, and 'chmod' it so that it's
      readable by anyone, that should do the trick).
    5. Because you made the directory a watched directory, Airtime will be able to see "latest.mp3" and add it to the library. Using the AirTime calendar, search for the ID3 information in the library using terms you know that file carries and add the cut to the program. 
    6. Create an updater script that selects a new file from your archive of files and replaces the "latest.mp3" file in the watched folder with a new one (renaming the new one to "latest.mp3" as it does so, so that the watched directory always contains a file called "latest.mp3".  You have to write this yourself, but it can be in any scripting language you know that can do that sort of job.
    7. Create a cron task that calls this updater script at a prearranged time of the week.

    Now when the cron task calls your updater script, it will put a new "latest.mp3" in the directory.  And since you've created your repeating show and added that file to it, AirTime will always play a file called "latest.mp3" when it comes time to run that show.

    The reason we use the longest file we have to start with when we set up the show is that AirTime is being tricked.  It has no idea that "latest.mp3" is being swapped out from underneath while it isn't looking, and that means it has no way of knowing it's supposed to adjust the run length for that file should the run length change from one file to the next.  If the new file is longer than the one you used to set up the show, Airtime will play only the length it thinks that show is - so if your episode cuts off early, that's what's happening.

    Thanks to John Chewter for helping me figure this stuff out.  It does work, but there are a couple of gotcha's.



    Post edited by Krypton Radio at 2014-04-07 17:34:56
  • I have a much extended version of my importer in final test.
    Its now a bash/php/ mix with 2 cron jobs and it updates the show title/description/image/more and latest show title/description/image/more from the RSS item data which I store in unused mp3 metatags - automagically. It also grabs and stores RSS item images for use in the schedule - the path to those images is also stored in my metatags (I cheat). The show length seems to be updated too - through the magic of media monitor.
    Post edited by John Chewter at 2014-04-07 18:16:48
    No longer using Airtime or Libretime.
  • I have not been seeing updating of the show lengths, John.  The files are being swapped out correctly, and the programs are being updated with the new metadata for each new file, but the lengths of the files to play are not being updated correctly.  The result of this is that Airtime thinks the show is shorter than it really is and cuts it off before it's finished.  This problem is driving me crazy.

    How are you getting media monitor to update these show lengths?