GithubHelp home page GithubHelp logo

alienhoboken / scala-tests Goto Github PK

View Code? Open in Web Editor NEW

This project forked from artsalliancemedia/scala-tests

0.0 1.0 0.0 254 KB

Some code used to test the python api for scala.

Python 99.14% Batchfile 0.69% HTML 0.18%

scala-tests's Introduction

Scala tests

Scala Tools

Creates a new playlist in Scala consisting of an item "test_image.png", puts the playlist into a schedule and updates the player to sync the new changes.

Scala Monitor

Provides a class for use in monitoring a player. It will connect to a content manager, and for a chosen player report back a variety of information on that player such as files it uses and screen layouts.

Installation

Python 2.6.x is required Just clone the repo, all requirements are included (see below)

Next Steps

Take a copy of settings-template.json, name it settings.json and fill out the fields.

By default, the application will use this settings.json file.

To start the scala test app run: python scala_tools.py

To start the monitoring app run: python scala_monitor.py

Included libraries

This includes the following libraries from Scala. They are not provided via pip, which is why they are directly in the repo.

Scalalib

A set of modules with tools and utilities for common needs at playback time, communication, synchronization, publishing, Player provisioning, etc. It is not currently used by any of the files here, but is kept for reference.

Scws

Webservice modules for communicating with Content Manager 5 in a simple manner. Example command-line upload to CM included.

Creating your own python code for interacting with Scala

Initial steps

The easiest way to start is to grab the webservices subfolder of this repository. scws is not available on pip or easy_install, so just leave it as a subfolder of your directory.

from webservices.scws import scws

For example

baseurl: "http://aam-scalaplayer-test:8080/ContentManager/",
authstring: "CMWeb:liggunna",
network: "CADIENLOBBY", #used for uploading
api: "v1.2"
baseurl = "http://my-scala-box:8080/ContentManager/"
authstr = "username:password"
api = "v1.2"
content_manager = scws.ConManager(baseurl, authstr, api_vers=api)

Simple use cases

Now the Content Manager is connected, you can usue the content_manager object to access a variety of functions. For example, to list the names of all players:

players = content_manager.PlayerRS.list()
for player in players:
    print player.name

The Content Manager API can be found at the Scala developer wiki, although take care not to try to call functions from version 1.3.

The API calls typically take in an ID of an object to find, and typically return an array of relevant objects. More complex search functions can often take a SearchCritera object. For example, to search for all channels with names containing "test":

channel_filter = scws.TObj()
channel_filter.column       = u'name'
channel_filter.restriction  = u'LIKE'
channel_filter.value        = u'%test%'
test_channels = content_manager.ChannelRS.list(searchCriteria=channel_filter)

A quick tutorial is available here.

Class Layout

The basic structure of a Scala player is as follows. The Content Manager will have links to a variety of Players. A Player contains a number of Displays, which each contains a single Channel. A Channel has a list of Timeslots and a Frameset. The Frameset contains multiple Frames, and dictates how the frames are laid out, any bezel sizes, the ordering of frames from front to back, and so on. The Schedule dictates at what times a Playlist is shown, and on which Frames. A Playlist can contain Media, Audio, or Data, and specifies ordering, transitions, lengths images are displayed for, and so on and so forth.

                            /-> Timeslot -> Playlist -> Media
Player -> Display -> Channel
                            \-> Frameset -> Frame

MetaValues

Players, Messages and Media items can contain meta-values, which are accessed differently to the main objects, using MediaRS.getMetaValues(mediaId=id) for example.

Some thoughts on the Scala API

The Scala API is perfectly functional, and relatively full featured. While somewhat confusing to use and not hugely "pythonic", it does do its job reasonably thoroughly and effictively. A bit of care has to be taken with a few quirks of it though. For example I could not get it to return transmission or data size from PlanGeneratorRS.getPlanStatus(). For some bizarre reason ChannelRS.getTimeslots(channelId=chan, frameId=frame) does not work, instead you must call ChannelRS.getTimeslots({'channelId':chan}, frameId=frame) instead.

It does not appear possible to in any way easily directly interact with a Scala Player, instead, all interaction should be done through the Content Manager. There is a scripting language called ScalaScript that may potentially be used to interact with the player directly.

scala-tests's People

Contributors

alexlatchford avatar leohemsted avatar tobiasaam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.