User Tools

Site Tools



Video IDs

Andreas Hartmann, 25.05.2007 11:48:


Can we create video-ids automatically?


Yes, but not with built-in components of iNEWS. You need a combination of a Linux shell script and a macro inside iNEWS.

  1. The shell script is started via crontab once a day very early morning. It generates a list of new video-ids (for that day) in a hidden place of the iNEWS database.
  2. The macro moves the next entry out of this list and paste it into the video-id field of the current story. An already assigned video id will not be overwritten by the macro.

So this solution take care about:

  1. The video id is unique. Whenever a user picks up a video id out of the list this id is immediately removed from the list. No chance to take the same id twice.
  2. The video id for a given story is fix. The macro keeps an already assigned id in the target story. It's not possible to change the id after working with (at least not with our macro)
  1. Video-id queue - inside iNEWS Client
    • Create a new folder hidden in iNEWS database.
    • Inside create a new queue video-ids.
    • Set readgroup for the folder to nobody.
    • Set readgroup and writegroup for the queue to !none or the group which is allowed to assign video-ids.
    • Set the queue to inverted.
  2. Script - Linux shell as user root (su) on both machines - inews-a and inews-b, respectively.
    • Create a directory /site/scripts/video-ids
    • Create a directory /site/scripts/video-ids/data
    • Inside /site/scripts create a file yes2 with following content:
    • Inside /site/scripts/video-ids create a file with following content:
      #! /bin/bash
      # creates video-ids
      # runs every morning at (via crontab)
      if /exc/ifis master
          LOGDATE=$(date | cut -c5-19)
          DATE=$(date +%Y-%m-%d)
          /exc/dbpurge 0 < /site/scripts/yes2 > /dev/null
          rm /site/scripts/video-ids/data/ids
          while test $ID -le 300
              if test $ID -ge 10
              if test $ID -ge 100
              echo "$(date +%d%m)-$DIGIT$ID" >> /site/scripts/video-ids/data/ids
              ID=$(expr $ID + 1)
          /exc/doc -pu /site/scripts/video-ids/data/ids
          echo "$LOGDATE localhost $(basename $0): creating video IDs for $DATE" >> $LOGFILE
    • Set permissions for with
      chmod 744 /site/scripts/video-ids/
    • Test the script. If you get no error messages at the terminal but a story with video-ids inside the queue, your script works properly. To run the script type:
    • Add an entry to roots crontab like
      35 5 * * * /site/scripts/video-ids/ > /dev/null 2&>1

      The leading two parameters specify the time when the script has to run (in our case 05:35). See the man-page for more information. Type man crontab to read this man-page. The last parameters after > prevent some error messages to get printed. You should have an entry for in the crontab of each iNEWS server.

  3. Type forms story - inside iNEWS Client as superuser1)
    • Create a queue system.forms.t.type-q
    • Insert a new story and change the fields for that story. For our macro it is necessary to have the video-id field at second position. Other fields don't matter for our macro - maybe for others…
  4. Macro - inside iNEWS Client as superuser
    • In a keyboard story of your choice (normally the producer keyboard) assign the following macro to a key.
      English version:
      {alt wo}{enter} {alt {right}{right}} {ctrl {home}} {shift {end}{left}} {ctrl x} {delete} {ctrl se} {alt wc} {alt {right}{right}{left}} {alt vuf}type-q{enter} {home} {tab} {f2} {space}{backspace} {home} {ctrl v} {shift {end}} {ctrl x} {shift {home}} {ctrl v} {ctrl se} {alt vun} {home} {tab}{tab}

      German version:

      {alt fa}{enter} {alt {right}{right}} {ctrl {home}} {shift {end}{left}} {ctrl x} {delete} {ctrl se} {alt fs} {alt {right}{right}{left}} {alt abf}type-q{enter} {home} {tab} {f2} {space}{backspace} {home} {ctrl v} {shift {end}} {ctrl x} {shift {home}} {ctrl v} {ctrl se} {alt abn} {home} {tab}{tab}

      French version:

      {alt no}{enter} {alt {right}{right}} {ctrl {home}} {shift {end}{left}} {ctrl x} {delete} {ctrl se} {alt nf} {alt {right}{right}{left}} {alt hum}type-q{enter} {home} {tab} {f2} {space}{backspace} {home} {ctrl v} {shift {end}} {ctrl x} {shift {home}} {ctrl v} {ctrl se} {alt hun} {home} {tab}{tab}
    • Test the macro. Save the keyboard story. Choose this keyboard in your preferences. Then go to a rundown story and press the related shortcut. If the story have had no video-id, now it should have the next one out of your list (and this number should be removed from the list). If the story have had a video-id before, this video-id should be there even if you run the macro. In that case nevertheless a number is removed from the list.
  • The script above creates video-ids in the format ddmm-xxxwhereas xxx is a sequential number. This format can be easily changed or extended.
  • Actually the script produces 300 ids. Of course you can increase this value by adjusting the loop border.
1) The macro can address the video-id-field just with tabs. To avoid a disruption of its functionality by changing the rundown queue forms the macro works with its own queue view


yanmaneee, 2019/04/22 19:17 yanmaneee

yanmaneee, 2019/07/10 08:29 yanmaneee

Enter your comment. Wiki syntax is allowed:
forum/inews/video-ids.txt · Last modified: 2022/06/20 23:36 (external edit)