Arrrggghh! Smart blocks not so smart!
  • Hey guys,

    Loving Airtime but I have a niggling issue that I know, from reading, has been kinda resolved, but it's way too over featured for what I need.

    I'm talking about John Chewter's RSS import script - http://forum.sourcefabric.org/discussion/16113/hack-added-cron-jobable-bulk-mp3-importer-from-multi-rss-feeds-into-appropriate-watched-folders

    Here is how I have things set up...

    - incoming media folder (web accessible outside of airtime root) that my DJ's upload their 1 hour show mp3 files into
    - files are then re-tagged (with eyeD3) and moved into the relevant watched airtime folders via a bash script run via a cron job at regular intervals

    This all works great!

    Now, the idea was to use smart blocks to retrieve specific show files dynamically and assign them to the relevant show using the ID3 tags that were created earlier. This works but, as you all know, smart blocks only generate their playlist when adding them to a show.

    I am trying to set this up so it's all done automatically.

    1) DJ Uploads show
    2) Cron job does the bizzo
    3) Airtime imports from the watched folders
    4) Set up a smart block for each different show to grab the relevant audio files using the meta tag

    and the most important (Holy Grail) bit...

    5) Drop the smart block in to every instance of the relevant show for say at least 3 months in the calender, and have it dynamically update the audio file when the dj uploads a new mp3 (select by newest date seems the most sensible choice), instead of only using the one file assigned at the time of dropping in the smart block.

    I understand that this feature doesn't currently exist and it certainly can't be achieved with smart blocks yet..

    But....

    John's script is using a clever method where he is renaming all of the newly downloaded content the same thing "latest.mp3", whereby tricking airtime into thinking it's playing the same file, predefined in a static playlist block, when it's actually playing a brand new file!

    This is brilliant but I can't figure out how he is making this work.

    As far as I can see the playlist blocks are created using Meta Data and not filenames. There isn't an option to use the filename as criteria!
    Also, airtime import puts each new file into a separate folder! So I don't understand how airtime is being tricked by this method at all.

    Does anybody know how he is doing this, and more importantly could they share the wisdom?

    I know it's a bit scrappy but I could live with this workaround until something better comes along if somebody can point me in the right direction?

    Cheers :)
    Post edited by Ade Hill at 2014-06-15 18:15:09
  • 12 Comments sorted by
  • Oh....

    I think I may have just found my own answer and I feel a bit silly (only a bit) ;)

    It turns out that airtime doesn't create new folders from the files in the watched folders at all! That's brilliant.

    So, I should in theory be able to strip all ID3 info with eyeD3 on the incoming file, then just rewrite the Title tag as say "Latest Show From DJ X", rename the .mp3 file to "latest.mp3" then move it into the airtime watched folder.

    Then set up a static smart block with the track "Latest Show From DJ X" in it, drop it into the calender and then every time DJ X uploads his latest show it should rewrite the original file and airtime will still think it's the same one.

    Does that sound like it will work to you?

  • Yes I have been doing similar for nearly a year in my RSS MP3 importer

    IMPORTANT NOTES
    Airtime only imports the tags ONCE, so the tags need to be changed BEFORE putting them in the watched folder.
    It can be a regular show. Doesn't need a smart block.

    This is what I do server-side. Upload to a non-watched folder and use eyeD3 (probably have to install it) to change your tags. It can bulk tag the whole folder. Then move them to the final watched folder.

    I have had issues if the shows are not the same length exactly. So add some bumper music at the end of the show that will overrun the end of show and you will be fine.

    Post edited by John Chewter at 2014-06-15 19:13:23
    No longer using Airtime or Libretime.
  • You're a legend John!

    Gonna try that right now ;)
  • Haha, ok I've reached the limit of my very limited shell scripting knowledge..

    I'm having trouble with just the renaming part of this script..

    Can anybody tell me what I'm doing wrong here?

    find /usr/incoming/ -name '*.mp3' -exec eyeD3 --remove-all -t 'Name Of Show' '{}' \; -exec mv -f '*.mp3' latest.mp3 /usr/complete \;

    The following works fine but obviously isn't renaming the file. That's the part i'm stuck on.

    find /usr/incoming/ -name '*.mp3' -exec eyeD3 --remove-all -t 'Name Of Show' '{}' \; -exec mv '{}' /usr/complete \;
    Post edited by Ade Hill at 2014-06-15 21:02:33
  • It's ok I sussed it with the help of the incredible Stack Overflow peeps.

    If anybody else wants to know how to do this I'll get a little step by step guide together.

    John this works beautifully bro :)
    Post edited by Ade Hill at 2014-06-15 23:01:37
  • I have code working here that will parse RSS feeds and fill in the mp3 tags from that and also will build the show from it - even repeating shows - with show title and description. All from cron jobs. When 2.5.2 comes out, I will fix it for the new version and release it. An earlier version is in the Airtime hacks section. You may find useful code to rob in there. It seems pointless releasing it for just a few fews in 251.

    The new one is a cgi php/bash combo - I may make it all cgi php and make a 'smarter block' functionality for it
    Post edited by John Chewter at 2014-06-16 02:28:57
    No longer using Airtime or Libretime.
  • That sounds amazing!

    A lot of prayers will be answered with that update ;)
  • Sorry double post...
    Post edited by Ade Hill at 2014-06-17 10:03:15
  • We use John Chewter's method, and here's the gotcha:  

    Airtime will use the length of whatever file you set up the recurring playlist from.  If you swap out the file used with another file having the same filename, it will replace the file in the schedule all right - however, it will not recalculate the show length.  

    The way around this is to use a slug file with the correct ID3 tags that's as long as possible.  Any subsequent loads will be shorter than the original slug file, so you're guaranteed that the whole clip will play. However, we also use an auto DJ add-in in our Liquidsoap script so that if a show runs short, we don't get dead air.

    The inability of Airtime to recompute the length of the new included song file is a problem, and we're lucky we made this work, but it's really a hack.  I'm looking forward to seeing the next version of Airtime which, I'm hoping, will make this bit of trickery unnecessary.
  • I am now changing the play length in the show content tableso I dont need a slug
    No longer using Airtime or Libretime.
  • Yeah same here.

    When the new length mp3 file replaces the old one, Airtime is correctly reading the new length just fine.

    The show times are set in stone, so as long as there is padding to cover any shorter than expected shows lined up in the playlist after the replaced file all should be good!
  • I find what krypton says to be the case.
    Aiirtime imports the file ok and reports the correct  length, shortens the file to remove silence etc. But its new duration is not updated in the show content tables.

    So i have been playing with using a trick to find if silan has been run and if it has and if its called latest.mp3 and has a genre Latest - copy the track length from the file metadata into the show content table. Problem is ALL THE INSTANCES . :(


    Post edited by John Chewter at 2014-06-17 17:34:49
    No longer using Airtime or Libretime.