Previous topic

stalker.models.sequence.Sequence

Next topic

stalker.models.status.Status

This Page

stalker.models.shot.Shot

Inheritance diagram of stalker.models.shot.Shot

class stalker.models.shot.Shot(code=None, project=None, sequences=None, scenes=None, cut_in=1, cut_out=None, cut_duration=None, image_format=None, **kwargs)[source]

Bases: stalker.models.task.Task, stalker.models.mixins.CodeMixin

Manages Shot related data.

Warning

Deprecated since version 0.1.2.

Because most of the shots in different projects are going to have the same name, which is a kind of a code like SH001, SH012A etc., and in Stalker you can not have two entities with the same name if their types are also matching, to guarantee all the shots are going to have different names the name attribute of the Shot instances are automatically set to a randomly generated uuid4 sequence.

Note

New in version 0.1.2.

The name of the shot can be freely set without worrying about clashing names.

Note

New in version 0.2.0.

Shot instances now can have their own image format. So you can set up different resolutions per shot.

Note

New in version 0.2.0.

Shot instances can now be created with a Project instance only, without needing a Sequence instance. Sequences are now a kind of a grouping attribute for the Shots. And Shots can have more than one Sequence.

Note

New in version 0.2.0.

Shots now have a new attribute called scenes, holding Scene instances which is another grouping attribute like sequences. Where Sequences are grouping the Shots according to their temporal position to each other, Scenes are grouping the Shots according to their view to the world, that is shots taking place in the same set configuration can be grouped together by using Scenes.

Two shots with the same code can not be assigned to the same Sequence.

The cut_out and cut_duration attributes effects each other. Setting the cut_out will change the cut_duration and setting the cut_duration will change the cut_out value. The default value of the cut_out attribute is calculated from the cut_in and cut_duration attributes. If both cut_out and cut_duration arguments are set to None, the cut_duration defaults to 100 and cut_out will be set to cut_in + cut_duration. So the priority of the attributes are as follows:

For still images (which can be also managed by shots) the cut_in and cut_out can be set to the same value so the cut_duration can be set to zero.

Because Shot is getting its relation to a Project from the passed Sequence, you can skip the project argument, and if you not the value of the project argument is not going to be used.

Parameters:
  • project (Project) – This is the Project instance that this shot belongs to. A Shot can not be created without a Project instance.
  • sequences (list of Sequence) – This is a list of Sequences that this shot is assigned to. A Shot can be created without having a Sequence instance.
  • cut_in (integer) – The in frame number that this shot starts. The default value is 1. When the cut_in is bigger then cut_out, the cut_out attribute is set to cut_in + 1.
  • cut_duration (integer) – The duration of this shot in frames. It should be zero or a positive integer value (natural number?) or . The default value is None.
  • cut_out (integer) – The out frame number that this shot ends. If it is given as a value lower then the cut_in parameter, then the cut_out will be set to the same value with cut_in and the cut_duration attribute will be set to 1. Can be skipped. The default value is None.
  • image_format (ImageFormat) – The image format of this shot. This is an optional variable to differentiate the image format per shot. The default value is the same with the Project that this Shot belongs to.
__init__(code=None, project=None, sequences=None, scenes=None, cut_in=1, cut_out=None, cut_duration=None, image_format=None, **kwargs)[source]

Methods

__init__([code, project, sequences, scenes, ...])
round_time(dt) Round a datetime object to any time laps in seconds.

Attributes

bid_timing The value of the initial bid of this Task. It is an integer or
bid_unit The unit of the initial bid of this Task. It is a string value.
children
code The code name of this object.
computed_duration it is the direct difference of computed_start and computed_end
computed_end
computed_start
computed_total_seconds returns the duration as seconds
created_by The User who has created this object.
created_by_id The id of the User who has created
cut_duration The duration of this shot in frames.
cut_in The in frame number that this shot starts.
cut_out The out frame number that this shot ends.
date_created A datetime.datetime instance showing the creation date and time of this object.
date_updated A datetime.datetime instance showing the update date and time of this object.
dependent_of
depends A list of Tasks that this one is depending on.
description Description of this object.
duration Duration of the entity.
end The overridden end property.
entity_id
entity_type
generic_data This attribute can hold any kind of data which exists in SOM.
id
image_format The ImageFormat of this shot.
image_format_id
is_complete A bool value showing if this task is completed or not.
is_container Returns True if the Task has children Tasks
is_leaf Returns True if the Task has no children Tasks
is_milestone Specifies if this Task is a milestone.
is_root Returns True if the Task has no parent
is_scheduled A predicate which returns True if this task has both a
level Returns the level of this task.
metadata A collection of Table objects and their associated schema
name Name of this object
nice_name Nice name of this object.
notes All the Notess attached to this entity.
parent
parent_id
parents Returns all of the parents of this Task starting from the root
plural_class_name the plural name of this class
priority
project The owner Project of this task.
project_id
query ORM-level SQL construction object.
references
remaining_seconds returns the remaining amount of efforts, length or duration left
resources The list of Users assigned to this Task.
scenes
schedule_constraint
schedule_model
schedule_seconds returns the total effort, length or duration in seconds, for
schedule_timing It is the value of the schedule timing.
schedule_unit It is the unit of the schedule timing.
sequences
shot_id
start The overridden start property.
status The current status of the object.
status_id
status_list
status_list_id
tags A list of tags attached to this object.
task_id
tasks
thumbnail
thumbnail_id
time_logs A list of TimeLog instances showing who and when spent how much effort on this task.
timing_resolution The timing_resolution of this object.
tjp_abs_id returns the calculated absolute id of this task
tjp_id returns TaskJuggler compatible id
to_tjp TaskJuggler representation of this task
total_logged_seconds The total effort spent for this Task. It is the sum of all the
total_seconds returns the duration as seconds
type The type of the object.
type_id The id of the Type of this entity.
updated_by The User who has updated this object.
updated_by_id The id of the User who has updated
versions A list of Version instances showing the files created for this task.
watchers The list of Users watching this Task.
image_format

The ImageFormat of this shot.

This value defines the output image format of this shot, should be an instance of ImageFormat.

cut_duration

The duration of this shot in frames.

It should be a positive integer value. If updated also updates the cut_duration attribute. The default value is 100.

bid_timing

The value of the initial bid of this Task. It is an integer or a float.

bid_unit

The unit of the initial bid of this Task. It is a string value. And should be one of ‘min’, ‘h’, ‘d’, ‘w’, ‘m’, ‘y’.

code

The code name of this object.

It accepts strings. Can not be None.

computed_duration

it is the direct difference of computed_start and computed_end

computed_total_seconds

returns the duration as seconds

created_by

The User who has created this object.

created_by_id

The id of the User who has created this entity.

date_created

A datetime.datetime instance showing the creation date and time of this object.

date_updated

A datetime.datetime instance showing the update date and time of this object.

depends

A list of Tasks that this one is depending on.

A CircularDependencyError will be raised when the task dependency creates a circular dependency which means it is not allowed to create a dependency for this Task which is depending on another one which in some way depends to this one again.

description

Description of this object.

duration

Duration of the entity.

It is a datetime.timedelta instance. Showing the difference of the start and the end. If edited it changes the end attribute value.

end

The overridden end property.

The end of the Task can not be changed if it is a container task. Works normally in other cases.

generic_data

This attribute can hold any kind of data which exists in SOM.

is_complete

A bool value showing if this task is completed or not.

There is a good article about why not to use an attribute called percent_complete to measure how much the task is completed.

is_container

Returns True if the Task has children Tasks

is_leaf

Returns True if the Task has no children Tasks

is_milestone

Specifies if this Task is a milestone.

Milestones doesn’t need any duration, any effort and any resources. It is used to create meaningful dependencies between the critical stages of the project.

is_root

Returns True if the Task has no parent

is_scheduled

A predicate which returns True if this task has both a computed_start and computed_end values

level

Returns the level of this task. It is a temporary property and will be useless when Stalker has its own implementation of a proper Gantt Chart. Write now it is used by the jQueryGantt.

name

Name of this object

nice_name

Nice name of this object.

It has the same value with the name (contextually) but with a different format like, all the white spaces replaced by underscores (“_”), all the CamelCase form will be expanded by underscore (_) characters and it is always lower case.

notes

All the Notess attached to this entity.

It is a list of Note instances or an empty list, setting it None will raise a TypeError.

parents

Returns all of the parents of this Task starting from the root

plural_class_name

the plural name of this class

project

The owner Project of this task.

It is a read-only attribute. It is not possible to change the owner Project of a Task it is defined when the Task is created.

remaining_seconds

returns the remaining amount of efforts, length or duration left in this Task as seconds.

resources

The list of Users assigned to this Task.

round_time(dt)

Round a datetime object to any time laps in seconds.

Uses class property timing_resolution as the closest number of seconds to round to, defaults 1 hour.

Parameters:dt – datetime.datetime object, defaults now.

Based on Thierry Husson’s answer in Stackoverflow

Stackoverflow : http://stackoverflow.com/a/10854034/1431079

schedule_seconds

returns the total effort, length or duration in seconds, for completeness calculation

schedule_timing

It is the value of the schedule timing. It is a float value.

schedule_unit

It is the unit of the schedule timing. It is a string value. And should be one of ‘min’, ‘h’, ‘d’, ‘w’, ‘m’, ‘y’.

start

The overridden start property.

The start of the Task can not be changed if it is a container task. Works normally in other case.

status

The current status of the object.

It is a Status instance which is one of the Statuses stored in the status_list attribute of this object.

tags

A list of tags attached to this object.

It is a list of Tag instances which shows the tags of this object

time_logs

A list of TimeLog instances showing who and when spent how much effort on this task.

timing_resolution

The timing_resolution of this object.

Can be set to any value that is representable with datetime.timedelta. The default value is 1 hour. Whenever it is changed the start, end and duration values will be updated.

tjp_abs_id

returns the calculated absolute id of this task

tjp_id

returns TaskJuggler compatible id

to_tjp

TaskJuggler representation of this task

total_logged_seconds

The total effort spent for this Task. It is the sum of all the TimeLogs recorded for this task as seconds.

Returns int:An integer showing the total seconds spent.
total_seconds

returns the duration as seconds

type

The type of the object.

It is an instance of Type with a proper target_entity_type.

type_id

The id of the Type of this entity. Mainly used by SQLAlchemy to create a Many-to-One relates between SimpleEntities and Types.

updated_by

The User who has updated this object.

updated_by_id

The id of the User who has updated this entity.

versions

A list of Version instances showing the files created for this task.

watchers

The list of Users watching this Task.

cut_in

The in frame number that this shot starts.

The default value is 1. When the cut_in is bigger then cut_out, the cut_out value is update to cut_in + 1.

cut_out

The out frame number that this shot ends.

When the cut_out is set to a value lower than cut_in, cut_out will be updated to cut_in + 1. The default value is cut_in + cut_duration.