Display Content from Textfile

Asked by David Hirczy

Hello!

Is it possible to display the content of a textfile and update it every 30 seconds? E.g.: there is a textfile that says "Hello World" - so i want the "Hello World" to be displayed. When i change the content of the textfile i want it to be displayed automaticly. Tried it with jquery and it works in the browser, but when I embed it to a layout it doesn't quite work :(

The thing I want to do with this is that i want to put a name in the textfile from a software thats running on an client pc, the name is displayed on the xibo display and the person whose name is displayed enters the room. Is there any other way to do that? There doesn't have to be a textfile, it should only be simple without much user activity.

Thanks

d.hirczy

Question information

Language:
English Edit question
Status:
Solved
For:
Xibo Edit question
Assignee:
No assignee Edit question
Solved by:
David Hirczy
Solved:
Last query:
Last reply:
Revision history for this message
Alex Harrington (alexharrington) said :
#1

Just have a text item on your layout then edit the text item as required.
Set the duration of the text item to 30 seconds or so and the collection
interval on the client to 30 seconds as well.

Otherwise you'll need to render out html and embed a webpage there

Revision history for this message
David Hirczy (hirczy) said :
#2

Ok. And can i update the text item with a command prompt?

Revision history for this message
Alex Harrington (alexharrington) said :
#3

You can via the API - not directly from a command prompt.

Revision history for this message
David Hirczy (hirczy) said :
#4

I got the API working and listing the Regions works fine. Found out the one i'd wish to update the text. Had a look at your guide and the wiki, but could not find out how to update the text. This is what i get from the script:

Media ID 2c9675c09198bbb7a1812cdccceff540
    Type: text
    Duration: 30

Media List Complete

Could you post how to update the with a simple text string please?

Thanks a lot!

Revision history for this message
Alex Harrington (alexharrington) said :
#5

You need to use the LayoutRegionMediaEdit method with the region and lkid
you retrieved already to edit the existing text item, or delete the
existing text item and add a new one

Revision history for this message
David Hirczy (hirczy) said :
#6

Is the LayoutGetXlf Method already implemented? It says 'Unknown Method'

Revision history for this message
Alex Harrington (alexharrington) said :
#7

You shouldn't need to get the entire layout Xlf - but no I don't think it
is

Revision history for this message
David Hirczy (hirczy) said :
#8

ok and how do i find out which part i do have to update?

Revision history for this message
Alex Harrington (alexharrington) said :
#9

You enumerate the media items in the region, and then update the
appropriate one.

The tutorial shows you how to list region contents etc

Revision history for this message
Alex Harrington (alexharrington) said :
#10
Revision history for this message
David Hirczy (hirczy) said :
#11

Thank you for the information. tried do adapt my script like this but still doenst work :(

#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Script to upload a Video to the Xibo CMS and replace
# an old copy of it in a region

# Imports
import os
from xml.dom import minidom
import XiboAPI

api = XiboAPI.XiboAPI()

#Text Update
try:

    params = [('layoutid', '5'),
        ('regionid', '53d8b21ba16d3'),
        ('mediaid', '2c9675c09198bbb7a1812cdccceff540'),
        ('xlf', '<?xml version="1.0"?><layout id="5"><region id="53d8b21ba16d3"><media id="2c9675c09198bbb7a1812cdccceff540"><text>BLABLABLA</text></media></region></layout>')]

    api.callMethod('LayoutRegionMediaEdit', params)

except Exception, e:
    print e

Revision history for this message
Alex Harrington (alexharrington) said :
#12

You only pass in the xlf for that media item, not for the entire layout.
Look at the example I linked to see what you need to pass in for text

Revision history for this message
David Hirczy (hirczy) said :
#13

Got it working. Some methods in the api don't seem to work like LayoutRegionMediaEdit and LayoutRegionMediaDelete. When i delete the whole Region and create a new one with text media in it it works.