User Tools

Site Tools


forum:inews:multiple-video-ids

inews

Multiple Video IDs

Andreas Hartmann, 20.03.2008 09:49:

Question

Can we create video ids also different for different shows?

Answer

Yes, but again not with built-in components of iNEWS. The idea behind this solution is the same as for the single video id script (see video-ids).

:!: There are two strict limitations so far:

  • You have to create stories for different rundowns in separate folders. It is not possible to choose the relevant show during the video id assignment.
  • Name1) of queues where video ids are assigned in must have exactly a given length. Otherwise the macro will fail. The given macros below assume a queue name with seven characters like rundown.

At all 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 multiple lists of new video-ids (for that day) in hidden places inside the show directories.
  2. The macro moves the next entry out of the relating 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)
  3. The video id contains a show-specific string

The specification which shows will get what video ids in what format with what special string is to setup inside the iNEWS system directory.

  1. The video id has finally the format <show string><date>-<sequence number>. The show string and date format are configurable. The sequence number runs from 001 up to 999.
Setup
  1. Management story - inside iNEWS Client as superuser
    • Create a queue inside the system directory, usually SYSTEM.RUNDOWNS
    • Place one story inside this queue which contains the description of each rundown or folder where video ids for a given show have to be assigned. If there are more than one story in this queue all stories are processed.
    • All empty lines and strings after semicolon (;) are ignored. Also the program proofs the format of the remaining lines and only valid ones are taken.
    • The format of each line is
      <rundown> <show string> <date format>
      • The <rundown> is the queue where video ids are assigned. Its parent folder must contain a hidden folder with a video-id queue inside. See next point how to create it.
      • The <show string> is a string containing only characters A-Z, a-z and 0-9 and especially it must contain no spaces.
      • The <date format> refers to the linux strftime format. Call man strftime on the iNEWS server console to get more help.
      • Here is a sample story for description of some rundowns:
        ; This story must contain the list of all rundown queues.
        ; It is used by the linux script /site/scripts/video-ids/video-ids.sh.
        ; All rundowns must be named "RUNDOWN".
        ; There must be a HIDDEN.VIDEO-IDS queue in each show directory.
        ; Format of the entries is:
        ; <rundown>			<show string>	<date format>
        
        news.1800.rundown	 	N18		%d%m%y
        
        news.2130.rundown		N21		%d%m%y
        
        features.business.rundown	FB		%d%m%y
  2. Video-id queues - inside iNEWS Client
    • Create a new folder hidden in each show directory (see previous point) inside 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.
  1. 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:
      y
      y
    • Inside /site/scripts/video-ids create a file video-ids.sh with following content:
      #! /bin/bash
      #
      # Author: Andreas Hartmann
      # andreas@hmedia.de
      #
      # creates video-ids
      # runs every morning at (via crontab)
      # produces separate video id lists for different rundowns
      # takes the rundowns from a list inside iNEWS
      #
      # check www.hmedia.de/wiki for more information
      #
      #
       
      LISTQUEUE="system.rundowns"
      PROGRAMDIR="/site/scripts/video-ids"
      DATADIR="$PROGRAMDIR/data"
      LOGFILE=/var/log/messages
      LOGDATE=$(date | cut -c5-19)
       
      if /exc/ifis master
      then
      	doc -gu $LISTQUEUE | sed --quiet -e 's/;.*//;s/[ \t][ \t]*/ /g;/^[^ \.][^ \.]*\.[^ ][^ ]* [A-Za-z0-9][A-Za-z0-9]* %/p' > "$DATADIR/list"
      	for SHOW in $(cat "$DATADIR/list" | cut -f1 -d" " | rev | cut -f2 -d"." | rev)
      	do
      		ID=1
      		DIGIT=00
      		echo "" > $DATADIR/ids
       
      		RUNDOWN="$(cat "$DATADIR/list" | grep $SHOW | cut -f1 -d" ")"
      		if /exc/list q $RUNDOWN 2>&1 | grep "No directories or queues match" > /dev/null
      		then
      			echo "$LOGDATE localhost $(basename $0): ERROR: Can't create video IDs for $SHOW! $RUNDOWN is not a queue." >> $LOGFILE
      			continue
      		fi
       
      		IDQUEUE="$(cat "$DATADIR/list" | grep $SHOW | cut -f1 -d" " | rev | cut -f2- -d"." | rev).hidden.video-ids"
      		if /exc/list q $IDQUEUE 2>&1 | grep "No directories or queues match" > /dev/null
      		then
      			echo "$LOGDATE localhost $(basename $0): ERROR: Can't create video IDs for $SHOW! $IDQUEUE is not a queue." >> $LOGFILE
      			continue
      		fi
       
      		CHANNELTAG="$(cat "$DATADIR/list" | grep $SHOW | cut -f2 -d" ")"
      		SHOWTAG="$(cat "$DATADIR/list" | grep $SHOW | cut -f3 -d" ")"
      		DATE="$(date +$(cat "$DATADIR/list" | grep $SHOW | cut -f4 -d" "))"
       
      		/exc/dbpurge $IDQUEUE 0 < /site/scripts/yes2 > /dev/null
       
      		while test $ID -le 999
      		do
      		    if test $ID -ge 10
      		    then
      		        DIGIT="0"
      		    fi
      		    if test $ID -ge 100
      		    then
      		        DIGIT=""
      		    fi
      		    echo "$CHANNELTAG$SHOWTAG$DATE-$DIGIT$ID" >> $DATADIR/ids
      		    ID=$(expr $ID + 1)
      		done
       
      		/exc/doc -pu $IDQUEUE $DATADIR/ids
      		echo "$LOGDATE localhost $(basename $0): creating video IDs for $SHOW" >> $LOGFILE
      	done
      fi
    • Set permissions for video-ids.sh with
      chmod 744 /site/scripts/video-ids/video-ids.sh
    • Test the script. If you get no error messages at the terminal but stories with video-ids inside the hidden.video-ids queues, your script works properly. Also you should check the /var/log/messages file for some errors. To run the script type:
      /site/scripts/video-ids/video-ids.sh
    • Add an entry to roots crontab like
      35 5 * * * /site/scripts/video-ids/video-ids.sh > /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 video-ids.sh in the crontab of each iNEWS server.

  2. Type forms story - inside iNEWS Client as superuser2)
    • 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…
  3. 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 {right}{right}{left}}{alt wo}{end}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}hidden.video-ids{enter} {alt {right}{right}}{ctrl {home}}{shift {end}{left}}{ctrl x}{delete}{ctrl se}{alt wc}{alt vuf}type-q{enter}{home}{tab}{f2}{home}{ctrl v}{shift {end}}{ctrl x}{shift {home}}{ctrl v}{f2}{shift {tab}}{alt vun}{home}{tab}{tab}{tab}


      German version:

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


      French version:

      {alt {right}{right}{left}}{alt no}{end}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}hidden.video-ids{enter} {alt {right}{right}}{ctrl {home}}{shift {end}{left}}{ctrl x}{delete}{ctrl se}{alt nf}{alt hum}type-q{enter}{home}{tab}{f2}{home}{ctrl v}{shift {end}}{ctrl x}{shift {home}}{ctrl v}{f2}{shift {tab}}{alt hun}{home}{tab}{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.
Comments
1) Strictly spoken the last part of a queue name - i.e. show.1800.rundown
2) 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

Discussion

Enter your comment. Wiki syntax is allowed:
X M E B K
 
forum/inews/multiple-video-ids.txt · Last modified: 2023/11/19 22:46 (external edit)