User Tools

Site Tools


forum:inews:multiple-video-ids

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

forum:inews:multiple-video-ids [2008/03/20 08:54]
andreas
forum:inews:multiple-video-ids [2023/11/19 22:46] (current)
Line 1: Line 1:
 <- [[:​forum:​inews]] <- [[:​forum:​inews]]
 +
 +
 +
 +
 +
 +
  
  
Line 9: Line 15:
 Can we create video ids also different for different shows? Can we create video ids also different for different shows?
 ==Answer== ==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 ). You need a combination of a Linux shell script and a macro inside iNEWS. +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 [[forum:​inews:​video-ids]]). 
-  - 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 hidden ​place of the iNEWS database+ 
-  - 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.+:!: 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. 
 +  * Name((Strictly spoken the last part of a queue name - i.e. show.1800.**rundown**)) 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. 
 +  - 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
 +  - 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: So this solution take care about:
   - 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.   - 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.
   - 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)   - 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)
 +  - 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.
 +  - 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 == == Setup ==
-  - Video-id queue - inside iNEWS Client +  - Management story - inside iNEWS Client as superuser 
-    * Create a new folder ''​hidden''​ in iNEWS database.+    * 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<​code>​ 
 +<​rundown>​ <show string> <date format></​code>​ 
 +      * 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:<​code>​ 
 +; 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</​code>​ 
 +  - 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''​.     * Inside create a new queue ''​video-ids''​.
     * Set readgroup for the folder to ''​nobody''​.     * 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 readgroup **and** writegroup for the queue to ''​!none''​ or the group which is allowed to assign video-ids.
     * Set the queue to inverted.     * Set the queue to inverted.
 +
   - Script - Linux shell as user root (su) on **both** machines - inews-a and inews-b, respectively.   - 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''​
Line 30: Line 68:
     * Inside ''/​site/​scripts/​video-ids''​ create a file ''​video-ids.sh''​ with following content:<​code bash>     * Inside ''/​site/​scripts/​video-ids''​ create a file ''​video-ids.sh''​ with following content:<​code bash>
 #! /bin/bash #! /bin/bash
 +#
 +# Author: Andreas Hartmann
 +# andreas@hmedia.de
 # #
 # creates video-ids # creates video-ids
 # runs every morning at (via crontab) # 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 if /exc/ifis master
 then then
-    LOGFILE=/var/log/messages + doc -gu $LISTQUEUE | sed --quiet -e 's/;.*//;s/[ \t][ \t]*/ /g;/^[^ \.][^ \.]*\.[^ ][^ ]* [A-Za-z0-9][A-Za-z0-9]* %/p' > "​$DATADIR/​list"​ 
-    ​LOGDATE=$(date | cut -c5-19) + for SHOW in $(cat "​$DATADIR/​list" ​| cut -f1 -d" " | rev | cut -f2 -d"​."​ | rev
-    DATE=$(date +%Y-%m-%d) + do 
-    ID=1 + ID=1 
-    DIGIT=00+ DIGIT=00 
 + echo ""​ > $DATADIR/​ids
  
-    ​/exc/dbpurge ​hidden.video-ids ​0 < /site/scripts/​yes2 ​> /dev/null + RUNDOWN="​$(cat "​$DATADIR/​list"​ | grep $SHOW | cut -f1 -d" "​)"​ 
-    rm /​site/​scripts/​video-ids/​data/​ids+ 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
  
-    while test $ID -le 300 + CHANNELTAG="​$(cat "​$DATADIR/​list"​ | grep $SHOW | cut -f2 -d" "​)"​ 
-    do + SHOWTAG="$(cat "$DATADIR/​list"​ | grep $SHOW | cut -f3 -d" ​")
-        if test $ID -ge 10 + DATE="​$(date +$(cat "$DATADIR/list" | grep $SHOW | cut -f4 -d" "))"
-        ​then +
-            DIGIT="0" +
-        fi +
-        if test $ID -ge 100 +
-        then +
-            DIGIT=""​ +
-        fi +
-        echo "​$(date +%d%m)-$DIGIT$ID" >> /​site/​scripts/video-ids/​data/​ids +
-        ID=$(expr $ID + 1) +
-    done+
  
-    ​/exc/doc -pu hidden.video-ids ​/​site/​scripts/​video-ids/data/ids + /exc/dbpurge $IDQUEUE 0 < /​site/​scripts/​yes2 > /dev/null 
-    echo "​$LOGDATE localhost $(basename $0): creating video IDs for $DATE" >> $LOGFILE+  
 + 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</​code>​ fi</​code>​
     * Set permissions for video-ids.sh with<​code bash>     * Set permissions for video-ids.sh with<​code bash>
 chmod 744 /​site/​scripts/​video-ids/​video-ids.sh</​code>​ chmod 744 /​site/​scripts/​video-ids/​video-ids.sh</​code>​
-    * Test the script. If you get no error messages at the terminal but a story with video-ids inside the ''​hidden.video-ids'' ​queue, your script works properly. To run the script type:<​code bash>+    * 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:<​code bash>
 /​site/​scripts/​video-ids/​video-ids.sh</​code>​ /​site/​scripts/​video-ids/​video-ids.sh</​code>​
     * Add an entry to roots crontab like<​code>​     * Add an entry to roots crontab like<​code>​
Line 73: Line 145:
   - Macro - inside iNEWS Client as superuser   - 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:<​code>​     * In a keyboard story of your choice (normally the producer keyboard) assign the following macro to a key.\\ English version:<​code>​
-{alt wo}hidden.video-ids{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}</​code>​\\ German version:<​code>​ +{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}</​code>​\\ German version:<​code>​ 
-{alt fa}hidden.video-ids{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}</​code>​\\ French version:<​code>​ +{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}</​code>​\\ French version:<​code>​ 
-{alt no}hidden.video-ids{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}</​code>​+{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}</​code>​
     * 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.     * 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 == == Comments ==
-  * The script above creates video-ids in the format ''​ddmm-xxx''​whereas ''​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. 
  
 ~~DISCUSSION~~ ~~DISCUSSION~~
forum/inews/multiple-video-ids.1206003287.txt.gz · Last modified: 2023/11/19 22:45 (external edit)