def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # Just get the dev server URL for now
    url = config.get('server', 'dev')

    # Get a server object to perform queries
    server = TacticServerStub(server=url, project=project, user=user, password=password)

    # Set up a list of frame rates to insert
    machines = ('VTR221', 'VTR222', 'VTR223', 'VTR224', 'VTR225', 'VTR231', 'VTR232', 'VTR233', 'VTR234', 'VTR235',
                   'VTR251', 'VTR252', 'VTR253', 'VTR254', 'VTR255', 'VTR261', 'VTR262', 'VTR263', 'VTR264', 'VTR265',
                   'VTR281', 'VTR282', 'VTR283', 'VTR284', 'VTR285', 'FCP01', 'FCP02', 'FCP03', 'FCP04', 'FCP05',
                   'FCP06', 'FCP07', 'FCP08', 'FCP09', 'FCP10', 'FCP11', 'FCP12', 'Amberfin', 'Clipster', 'Stradis')

    # Get a list of already existing frame rates
    existing_machines = server.eval('@SOBJECT(twog/machine)')
    existing_machines = [existing_machine.get('name') for existing_machine in existing_machines]

    # Filter out the frame rates that are already in the database
    machines_to_insert = [machine for machine in machines if machine not in existing_machines]

    for machine in machines_to_insert:
        # Insert the frame rate
        server.insert('twog/machine', {'name': machine})
def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # Just get the dev server URL for now
    url = config.get('server', 'dev')

    # Get a server object to perform queries
    server = TacticServerStub(server=url, project=project, user=user, password=password)

    # Set up a list of frame rates to insert
    frame_rates = ['23.98fps', '59.94i', '50i', '29.97fps', '24p', '25p', '59.94p', 'DFTC', 'NDFTC', 'PAL/EBU']

    # Get a list of already existing frame rates
    existing_frame_rates = server.eval('@SOBJECT(twog/frame_rate)')
    existing_frame_rates = [existing_frame_rate.get('name') for existing_frame_rate in existing_frame_rates]

    # Filter out the frame rates that are already in the database
    frame_rates_to_insert = [frame_rate for frame_rate in frame_rates if frame_rate not in existing_frame_rates]

    for frame_rate in frame_rates_to_insert:
        # Insert the frame rate
        server.insert('twog/frame_rate', {'name': frame_rate})
def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # Just get the dev server URL for now
    url = config.get('server', 'dev')

    # Get a server object to perform queries
    server = TacticServerStub(server=url, project=project, user=user, password=password)

    # Set up a list of languages to insert
    languages = ["Afar", "Abkhazian", "Afrikaans", "Akan", "Albanian", "Amharic", "Arabic", "Aragonese", "Armenian",
                 "Assamese", "Avaric", "Avestan", "Aymara", "Azerbaijani", "Bashkir", "Bambara", "Basque", "Belarusian",
                 "Bengali", "Bihari languages", "Bislama", "Tibetan", "Bosnian", "Breton", "Bulgarian", "Burmese",
                 "Catalan; Valencian", "Czech", "Chamorro", "Chechen", "Chinese",
                 "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic", "Chuvash",
                 "Cornish", "Corsican", "Cree", "Welsh", "Danish", "German", "Divehi; Dhivehi; Maldivian",
                 "Dutch; Flemish", "Dzongkha", "Greek, Modern (1453-)", "English", "Esperanto", "Estonian", "Ewe",
                 "Faroese", "Persian", "Fijian", "Finnish", "French", "Western Frisian", "Fulah", "Georgian",
                 "Gaelic; Scottish Gaelic", "Irish", "Galician", "Manx", "Guarani", "Gujarati",
                 "Haitian; Haitian Creole", "Hausa", "Hebrew", "Herero", "Hindi", "Hiri Motu", "Croatian", "Hungarian",
                 "Igbo", "Icelandic", "Ido", "Sichuan Yi; Nuosu", "Inuktitut", "Interlingue; Occidental",
                 "Interlingua (International Auxiliary Language Association)", "Indonesian", "Inupiaq", "Italian",
                 "Javanese", "Japanese", "Kalaallisut; Greenlandic", "Kannada", "Kashmiri", "Kanuri", "Kazakh",
                 "Central Khmer", "Kikuyu; Gikuyu", "Kinyarwanda", "Kirghiz; Kyrgyz", "Komi", "Kongo", "Korean",
                 "Kuanyama; Kwanyama", "Kurdish", "Lao", "Latin", "Latvian", "Limburgan; Limburger; Limburgish",
                 "Lingala", "Lithuanian", "Luxembourgish; Letzeburgesch", "Luba-Katanga", "Ganda", "Macedonian",
                 "Marshallese", "Malayalam", "Maori", "Marathi", "Malay", "Malagasy", "Maltese", "Mongolian", "Nauru",
                 "Navajo; Navaho", "Ndebele, South; South Ndebele", "Ndebele, North; North Ndebele", "Ndonga", "Nepali",
                 "Norwegian Nynorsk; Nynorsk, Norwegian", "Bokmal, Norwegian; Norwegian Bokmal", "Norwegian",
                 "Chichewa; Chewa; Nyanja", "Occitan (post 1500)", "Ojibwa", "Oriya", "Oromo", "Ossetian; Ossetic",
                 "Panjabi; Punjabi", "Pali", "Polish", "Portuguese", "Pushto; Pashto", "Quechua", "Romansh",
                 "Romanian; Moldavian; Moldovan", "Rundi", "Russian", "Sango", "Sanskrit", "Sinhala; Sinhalese",
                 "Slovak", "Slovenian", "Northern Sami", "Samoan", "Shona", "Sindhi", "Somali", "Sotho, Southern",
                 "Spanish; Latin", "Spanish; Castilian", "Sardinian", "Serbian", "Swati", "Sundanese", "Swahili",
                 "Swedish", "Tahitian", "Tamil", "Tatar", "Telugu", "Tajik", "Tagalog", "Thai", "Tigrinya",
                 "Tonga (Tonga Islands)", "Tswana", "Tsonga", "Turkmen", "Turkish", "Twi", "Uighur; Uyghur",
                 "Ukrainian", "Urdu", "Uzbek", "Venda", "Vietnamese", "Volapuk", "Walloon", "Wolof", "Xhosa", "Yiddish",
                 "Yoruba", "Zhuang; Chuang", "Zulu", "MLF", "Cantonese", "French Canadien", "Various",
                 "Mandarin Simplified", "French Parisian Dubbed", "Portuguese; Brazilian"]

    # Get a list of already existing languages
    existing_languages = server.eval('@SOBJECT(twog/language)')
    existing_languages = [existing_language.get('name') for existing_language in existing_languages]

    # Filter out the languages that are already in the database
    languages_to_insert = [language for language in languages if language not in existing_languages]

    for language in languages_to_insert:
        # Insert the language
        server.insert('twog/language', {'name': language})
Beispiel #4
0
 def get_display(my):
     import re
     from client.tactic_client_lib import TacticServerStub
     from tactic.ui.panel import FastTableLayoutWdg
     server = TacticServerStub.get()
     sk = str(my.kwargs.get('sk'))
     splits = sk.split('code=')
     search_type = splits[0].split('?')[0];
     code = splits[1];
     search_id = re.findall(r'\d+', code)
     search_id = int(search_id[0])
     widget = DivWdg()
     table = Table()
     table.add_attr('class','snapshot_viewer_wdg')
     table.add_attr('sk',sk)
     #ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='table', element_names='preview,process,description,web_path,timestamp,login', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, width='100%s' % '%', show_column_manager=False, expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))", temp=True)
     if search_type == 'sthpw/note':
         expression = "@SOBJECT(sthpw/snapshot)"
     else:
         expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))"
     ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='snapshot_by_process', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, height='300px', width='100%s' % '%', show_column_manager=False, expression=expression, temp=True)
     table.add_row()
     table.add_cell(ftl) 
     widget.add(table)
     return widget
    def init(my):
        from client.tactic_client_lib import TacticServerStub

        my.server = TacticServerStub.get()
        my.login = Environment.get_login()
        my.user = my.login.get_login()
        my.work_order_code = ""
 def init(my):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     my.server = TacticServerStub.get()
     my.sk = ''
     my.login = '' 
     my.order_code = ''
Beispiel #7
0
 def init(my):
     from client.tactic_client_lib import TacticServerStub
     my.login_obj = Environment.get_login()
     my.login = my.login_obj.get_login()
     my.server = TacticServerStub.get()
     my.login_obj = my.server.eval("@SOBJECT(sthpw/login['login','%s'])" % my.login)[0]
     my.key_dict = {'highlight_notes': 'Highlight Notes - Record What I Have Seen (Slower)]:', 'show_note_counts': 'Show Top Section of Notes, Showing Count Breakdown:'}
Beispiel #8
0
 def init(my):
     my.server = TacticServerStub.get()
     my.title = "Project"
     my.sk = ''
     my.code = ''
     my.search_id = ''
     my.parent_sk = ''
     my.parent_sid = ''
     my.order_sk = ''
     my.x_butt = "<img src='/context/icons/common/BtnKill.gif' title='Delete' name='Delete'/>"
     my.scratch_pipe = "<table border=0 cellspacing=0 cellpadding=2 style='font-size: 60%s; border-color: #FFFFFF; border-style: solid; border-width: 1px; cursor: pointer;'><tr><td align='center'><font color='#FFFFFF'>Pipeline</font></td></tr></table>" % '%'
     my.width = '1000px'
     my.height = '300px'
     my.small = False
     my.disp_mode = 'Small'
     my.groups_str = ''
     my.user = ''
     my.is_master = False
     my.is_master_str = 'false'
     my.on_color = '#ff0000'
     my.off_color = '#d9ed8b'
     my.stat_colors = {
         'Assignment': '#fcaf88',
         'Pending': '#d7d7d7',
         'In Progress': '#f5f3a4',
         'In_Progress': '#f5f3a4',
         'In Production': '#f5f3a4',
         'In_Production': '#f5f3a4',
         'In production': '#f5f3a4',
         'In_production': '#f5f3a4',
         'Waiting': '#ffd97f',
         'Need Assistance': '#fc88fb',
         'Need_Assistance': '#fc88fb',
         'Review': '#888bfc',
         'Approved': '#d4b5e7',
         'On Hold': '#e8b2b8',
         'On_Hold': '#e8b2b8',
         'Client Response': '#ddd5b8',
         'Completed': '#b7e0a5',
         'Ready': '#b2cee8',
         'Internal Rejection': '#ff0000',
         'External Rejection': '#ff0000',
         'Rejected': '#ff0000',
         'Failed QC': '#ff0000',
         'Fix Needed': '#c466a1',
         'Need Buddy Check': '#e3701a',
         'DR In_Progress': '#d6e0a4',
         'DR In Progress': '#d6e0a4',
         'Amberfin01_In_Progress':'#D8F1A8',
         'Amberfin01 In Progress':'#D8F1A8',
         'Amberfin02_In_Progress':'#F3D291',
         'Amberfin02 In Progress':'#F3D291',
         'BATON In_Progress': '#c6e0a4',
         'BATON In Progress': '#c6e0a4',
         'Export In_Progress': '#796999',
         'Export In Progress': '#796999',
         'Buddy Check In_Progress': '#1aade3',
         'Buddy Check In Progress': '#1aade3'
     }
 def init(my):
     from client.tactic_client_lib import TacticServerStub
     my.server = TacticServerStub.get()
     my.login = Environment.get_login()
     my.user = my.login.get_login()
     my.task_code = ''
     my.task_codes = ''
     my.code = ''
Beispiel #10
0
 def __init__(my, **kwargs):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     super(ClipboardMovementMakerCmd, my).__init__(**kwargs)
     my.login = Environment.get_login()
     my.user_name = my.login.get_login() 
     my.server = TacticServerStub.get()
     my.movement_code = str(kwargs.get('movement_code'))
Beispiel #11
0
 def __init__(my, **kwargs):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     super(ClipboardEmptySearchTypeCmd, my).__init__(**kwargs)
     my.login = Environment.get_login()
     my.user_name = my.login.get_login() 
     my.server = TacticServerStub.get()
     my.search_type = str(kwargs.get('search_type'))
Beispiel #12
0
    def _test_csv_export(self):
        from tactic.ui.widget import CsvExportWdg
        view = 'table'
        search_type ='sthpw/task'
        search_view = 'auto_search:table'
        #search_view = ''
        simple_search_view = 'simple_search'
        search_class =''
        mode = 'export_matched'
        element_name=  'project_tasks'
        filter =  [{"prefix":"main_body","main_body_enabled":"on","main_body_column":"project_code","main_body_relation":"is","main_body_value":"{$PROJECT}"}, {"prefix":"main_body","main_body_enabled":"on","main_body_column":"search_type","main_body_relation":"is not","main_body_value":"sthpw/project"}]
        
        from pyasm.common import jsondumps, jsonloads
        values  = {'json': jsondumps(filter)}
        element_names = ['code','id','description']
        server = TacticServerStub(protocol='xmlrpc')
        current_project = 'vfx'
        server.set_project(current_project)

        rtn = server.get_widget('tactic.ui.widget.CsvExportWdg', args={'search_type':search_type, 'view':view,\
            'filter': filter, 'element_name': element_name, 'show_search_limit':'false', 'search_limit':-1, 'search_view':search_view, \
            'element_names': element_names, 'mode':mode, 'search_class':search_class, 'simple_search_view':simple_search_view,\
            'init_load_num':-1, 'test':True}, values=values )
        expected_columns = ['code','id','description']
        expected_sql = '''SELECT "sthpw"."public"."task".* FROM "sthpw"."public"."task" WHERE ( "task"."project_code" = \'%s\' AND ( "task"."search_type" != \'sthpw/project\' OR "task"."search_type" is NULL ) ) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) ORDER BY "task"."search_type", "task"."search_code"'''%current_project

        expr = "@COUNT(sthpw/task['project_code','%s']['search_type','!=','sthpw/project])"%current_project
        expected_count = Search.eval(expr, single=True)
        
        rtn = jsonloads(rtn)
        self.assertEquals(expected_columns, rtn.get('columns'))
        self.assertEquals(expected_sql, rtn.get('sql'))
        self.assertEquals(expected_count, rtn.get('count'))


        mode = 'export_displayed'
        selected_search_keys = ['sthpw/task?id=4385','sthpw/task?id=4386','sthpw/task?id=4387']
        rtn = server.get_widget('tactic.ui.widget.CsvExportWdg', args={'search_type':search_type, 'view':view,\
            'filter': filter, 'element_name': element_name, 'show_search_limit':'false', 'search_limit':-1, 'search_view':search_view, \
            'element_names': element_names, 'mode':mode, 'search_class':search_class, 'simple_search_view':simple_search_view,\
            'init_load_num':-1, 'test':True, 'selected_search_keys': selected_search_keys}, values=values )
        
        expected_count = 3
        rtn = jsonloads(rtn)
        self.assertEquals(expected_columns, rtn.get('columns'))
        self.assertEquals(expected_count, rtn.get('count'))
Beispiel #13
0
 def __init__(my, **kwargs):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     super(ClipboardAddCmd, my).__init__(**kwargs)
     my.code = str(kwargs.get('code'))
     my.st = str(kwargs.get('st')).split('?')[0]
     my.login = Environment.get_login()
     my.user_name = my.login.get_login() 
     my.server = TacticServerStub.get()
Beispiel #14
0
 def init(my):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     my.server = TacticServerStub.get()
     my.number = 0
     my.code = ''
     my.login = Environment.get_login()
     my.user = my.login.get_login()
     my.width = '1000px'
     my.height = '300px'
Beispiel #15
0
 def __init__(my, **kwargs):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     super(NormalPipeToHackPipeCmd, my).__init__(**kwargs)
     my.login = Environment.get_login()
     my.user_name = my.login.get_login() 
     my.server = TacticServerStub.get()
     my.sob_sk = kwargs.get('sob_sk')
     my.new_pipe = kwargs.get('new_pipe')
     my.sob_code = my.sob_sk.split('code=')[1]
Beispiel #16
0
 def __init__(my, **kwargs):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     super(CreateTitlesCmd, my).__init__(**kwargs)
     my.login = Environment.get_login()
     my.user_name = my.login.get_login() 
     my.server = TacticServerStub.get()
     my.data = kwargs.get('data')
     # There has to be at least one episode for some reason, even if it's empty
     my.episodes = kwargs.get('episodes', [''])
Beispiel #17
0
 def init(my):
     my.server = TacticServerStub.get()
     my.sk = ''
     my.search_id = ''
     my.code = ''
     my.user = ''
     my.groups_str = ''
     my.parent_sk = ''
     my.parent_sid = ''
     my.order_sk = ''
     my.disp_mode = 'Small'
     my.small = False
     my.is_master = False
     my.is_master_str = 'false'
     my.on_color = '#ff0000'
     my.off_color = '#c6eda0'
     my.stat_colors = {
         'Assignment': '#fcaf88',
         'Pending': '#d7d7d7',
         'In Progress': '#f5f3a4',
         'In_Progress': '#f5f3a4',
         'In Production': '#f5f3a4',
         'In_Production': '#f5f3a4',
         'In production': '#f5f3a4',
         'In_production': '#f5f3a4',
         'Waiting': '#ffd97f',
         'Need Assistance': '#fc88fb',
         'Need_Assistance': '#fc88fb',
         'Review': '#888bfc',
         'Approved': '#d4b5e7',
         'On Hold': '#e8b2b8',
         'On_Hold': '#e8b2b8',
         'Client Response': '#ddd5b8',
         'Completed': '#b7e0a5',
         'Ready': '#b2cee8',
         'Internal Rejection': '#ff0000',
         'External Rejection': '#ff0000',
         'Rejected': '#ff0000',
         'Failed QC': '#ff0000',
         'Fix Needed': '#c466a1',
         'Need Buddy Check': '#e3701a',
         'DR In_Progress': '#d6e0a4',
         'DR In Progress': '#d6e0a4',
         'Amberfin01_In_Progress':'#D8F1A8',
         'Amberfin01 In Progress':'#D8F1A8',
         'Amberfin02_In_Progress':'#F3D291',
         'Amberfin02 In Progress':'#F3D291',
         'BATON In_Progress': '#c6e0a4',
         'BATON In Progress': '#c6e0a4',
         'Export In_Progress': '#796999',
         'Export In Progress': '#796999',
         'Buddy Check In_Progress': '#1aade3',
         'Buddy Check In Progress': '#1aade3'
     }
Beispiel #18
0
def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # Just get the dev server URL for now
    url = config.get('server', 'dev')

    # Get a server object to perform queries
    server = TacticServerStub(server=url,
                              project=project,
                              user=user,
                              password=password)

    # Set up a list of frame rates to insert
    machines = ('VTR221', 'VTR222', 'VTR223', 'VTR224', 'VTR225', 'VTR231',
                'VTR232', 'VTR233', 'VTR234', 'VTR235', 'VTR251', 'VTR252',
                'VTR253', 'VTR254', 'VTR255', 'VTR261', 'VTR262', 'VTR263',
                'VTR264', 'VTR265', 'VTR281', 'VTR282', 'VTR283', 'VTR284',
                'VTR285', 'FCP01', 'FCP02', 'FCP03', 'FCP04', 'FCP05', 'FCP06',
                'FCP07', 'FCP08', 'FCP09', 'FCP10', 'FCP11', 'FCP12',
                'Amberfin', 'Clipster', 'Stradis')

    # Get a list of already existing frame rates
    existing_machines = server.eval('@SOBJECT(twog/machine)')
    existing_machines = [
        existing_machine.get('name') for existing_machine in existing_machines
    ]

    # Filter out the frame rates that are already in the database
    machines_to_insert = [
        machine for machine in machines if machine not in existing_machines
    ]

    for machine in machines_to_insert:
        # Insert the frame rate
        server.insert('twog/machine', {'name': machine})
def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # Just get the dev server URL for now
    url = config.get('server', 'dev')

    # Get a server object to perform queries
    server = TacticServerStub(server=url,
                              project=project,
                              user=user,
                              password=password)

    # Set up a list of frame rates to insert
    frame_rates = [
        '23.98fps', '59.94i', '50i', '29.97fps', '24p', '25p', '59.94p',
        'DFTC', 'NDFTC', 'PAL/EBU'
    ]

    # Get a list of already existing frame rates
    existing_frame_rates = server.eval('@SOBJECT(twog/frame_rate)')
    existing_frame_rates = [
        existing_frame_rate.get('name')
        for existing_frame_rate in existing_frame_rates
    ]

    # Filter out the frame rates that are already in the database
    frame_rates_to_insert = [
        frame_rate for frame_rate in frame_rates
        if frame_rate not in existing_frame_rates
    ]

    for frame_rate in frame_rates_to_insert:
        # Insert the frame rate
        server.insert('twog/frame_rate', {'name': frame_rate})
Beispiel #20
0
    def _test_csv_export(self):
        from tactic.ui.widget import CsvExportWdg
        view = 'table'
        search_type = 'sthpw/task'
        search_view = 'auto_search:table'
        #search_view = ''
        simple_search_view = 'simple_search'
        search_class = ''
        mode = 'export_matched'
        element_name = 'project_tasks'
        filter = [{
            "prefix": "main_body",
            "main_body_enabled": "on",
            "main_body_column": "project_code",
            "main_body_relation": "is",
            "main_body_value": "{$PROJECT}"
        }, {
            "prefix": "main_body",
            "main_body_enabled": "on",
            "main_body_column": "search_type",
            "main_body_relation": "is not",
            "main_body_value": "sthpw/project"
        }]

        from pyasm.common import jsondumps, jsonloads
        values = {'json': jsondumps(filter)}
        element_names = ['code', 'id', 'description']
        server = TacticServerStub(protocol='xmlrpc')
        current_project = 'vfx'
        server.set_project(current_project)

        rtn = server.get_widget('tactic.ui.widget.CsvExportWdg', args={'search_type':search_type, 'view':view,\
            'filter': filter, 'element_name': element_name, 'show_search_limit':'false', 'search_limit':-1, 'search_view':search_view, \
            'element_names': element_names, 'mode':mode, 'search_class':search_class, 'simple_search_view':simple_search_view,\
            'init_load_num':-1, 'test':True}, values=values )
        expected_columns = ['code', 'id', 'description']
        expected_sql = '''SELECT "sthpw"."public"."task".* FROM "sthpw"."public"."task" WHERE ( "task"."project_code" = \'%s\' AND ( "task"."search_type" != \'sthpw/project\' OR "task"."search_type" is NULL ) ) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) AND ("task"."s_status" != \'retired\' or "task"."s_status" is NULL) ORDER BY "task"."search_type", "task"."search_code"''' % current_project

        expr = "@COUNT(sthpw/task['project_code','%s']['search_type','!=','sthpw/project])" % current_project
        expected_count = Search.eval(expr, single=True)

        rtn = jsonloads(rtn)
        self.assertEquals(expected_columns, rtn.get('columns'))
        self.assertEquals(expected_sql, rtn.get('sql'))
        self.assertEquals(expected_count, rtn.get('count'))

        mode = 'export_displayed'
        selected_search_keys = [
            'sthpw/task?id=4385', 'sthpw/task?id=4386', 'sthpw/task?id=4387'
        ]
        rtn = server.get_widget('tactic.ui.widget.CsvExportWdg', args={'search_type':search_type, 'view':view,\
            'filter': filter, 'element_name': element_name, 'show_search_limit':'false', 'search_limit':-1, 'search_view':search_view, \
            'element_names': element_names, 'mode':mode, 'search_class':search_class, 'simple_search_view':simple_search_view,\
            'init_load_num':-1, 'test':True, 'selected_search_keys': selected_search_keys}, values=values )

        expected_count = 3
        rtn = jsonloads(rtn)
        self.assertEquals(expected_columns, rtn.get('columns'))
        self.assertEquals(expected_count, rtn.get('count'))
Beispiel #21
0
 def __init__(my, **kwargs):
     from client.tactic_client_lib import TacticServerStub
     super(TitleClonerCmd, my).__init__(**kwargs)
     my.titles_str = str(kwargs.get('titles'))
     my.order_codes = str(kwargs.get('order_code')).split(',')
     
     my.user_name = str(kwargs.get('user_name'))
     my.redo = str(kwargs.get('redo'))
     my.no_charge = str(kwargs.get('no_charge'))
     my.copy_attributes_str = str(kwargs.get('copy_attributes'))
     my.copy_attributes = False
     if my.copy_attributes_str == 'true':
         my.copy_attributes = True
     my.server = TacticServerStub.get()
Beispiel #22
0
 def init(my):
     my.group_list = Environment.get_group_names()
     login = Environment.get_login()
     my.user = login.get_login()
     my.server = TacticServerStub.get()
     my.sk = ''
     my.code = ''
     my.st = ''
     my.is_scheduler = False
     for gname in my.group_list:
         if 'scheduling' in gname:
             my.is_scheduler = True
     if my.user == 'admin':
         my.is_scheduler = True
Beispiel #23
0
 def get_display(my):
     import time, datetime
     from tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     code = ''
     fault_files = None
     rowct = 1
     server = TacticServerStub.get()
     if 'external_rejection_code' in my.kwargs.keys():
         code = my.kwargs.get('external_rejection_code')
         fault_files = server.eval("@SOBJECT(twog/external_rej_at_fault_files['external_rejection_code','%s'])" % code) 
     if 'rowct' in my.kwargs.keys():
         rowct = int(my.kwargs.get('rowct'))
     adding = False
     if 'adding' in my.kwargs.keys():
         if my.kwargs.get('adding') == 'true':
             adding = True
     table = Table()
     table.add_attr('class','fftable')
     table.add_attr('border','1')
     if rowct == 1 and not adding:
         table.add_row()
         table.add_cell("<b>List of At-Fault Files:</b>")
     if code not in [None,''] and not adding:
         for ff in fault_files:
             brow = table.add_row()
             brow.add_attr('line',rowct)
             brow.add_attr('code',ff.get('code'))
             brow.add_attr('prev',ff.get('file_path'))
             brow.add_attr('sk',ff.get('__search_key__'))
             brow.add_attr('class','fault_files')
             table.add_cell(my.txtbox('file_path-%s' % rowct, ff.get('file_path'),width='700px'))
             killer = table.add_cell('<b>X</b>')#This must delete the entry
             killer.add_style('cursor: pointer;')
             killer.add_behavior(my.get_kill_bvr(rowct, code, ff.get('code')))
             rowct = rowct + 1
     erow = table.add_row()
     erow.add_attr('line',rowct)
     erow.add_attr('code','')
     erow.add_attr('prev','')
     erow.add_attr('sk','')
     erow.add_attr('class','fault_files')
     table.add_cell(my.txtbox('file_path-%s' % rowct, '',width='700px'))
     addnew = table.add_cell('<b>+</b>')#This must add new entry
     addnew.add_style('cursor: pointer;')
     addnew.add_behavior(my.get_add_line(rowct, code, ''))
     erow2 = table.add_row()
     erow2.add_attr('class','new_ff_line')
     return table
Beispiel #24
0
    def checkin(my, tactic_node, search_key, context):
        '''Standard checkin mechanism.  This is a sample checkin mechanism
        that is full featured enough to handle many situations.

        @params:
          tactic_node: the tactic node to be checkedin
          search_key: the search key to check into
          context: the context to check into

        @return
          snapshot: a dictionary representing the final snapshot
          
        
        '''
        server = TacticServerStub.get()

        # verify that this is not a reference!!!

        # create a snapshot
        snapshot = server.create_snapshot(search_key, context)

        # find all of the dependencies
        dependent_nodes = my.get_dependent_nodes(tactic_node)
        for node in dependent_nodes:
            # find out if there is a node there is a file associated with
            # this tactic node
            files = my.get_dependent_references(node)
            print files

        # update the tactic node with the latest snapshot data.  Also, update
        # the tactic node name as it likely has changed
        node_data = my.set_introspect_data(tactic_node, snapshot)
        tactic_node = node_data.get_app_node_name()

        # add the files to the snapshot
        handler = BaseFileExtractionHandler(tactic_node)
        paths = handler.execute()
        #paths = my.extract_to_files(top_node)
        for path in paths:
            print "path: ", path
            server.add_file(snapshot.get("code"), path, mode='upload')

        return snapshot
Beispiel #25
0
    def load(my,
             search_key,
             context,
             version=-1,
             file_type='main',
             mode='reference',
             namespace=''):
        '''Generic loading function used by TACTIC interface by default

        @params:
        search_key: the search key of the sobject to be loaded
        context: the context of the snapshot to be loaded
        version: the version of the snapshot to be loaded
        file_type: the specific file in the snapshot to be loaded

        mode: reference|import|open: the mode in which to bring the file in
        
        
        '''
        server = TacticServerStub.get()

        # FIXME: do we really need to make 2 calls?
        snapshot = server.get_snapshot(search_key,
                                       context=context,
                                       version=version)
        if not snapshot:
            raise CGAppException("No snapshot found for [%s]" % search_key)

        paths = server.get_paths(search_key, context, version, file_type)
        web_paths = paths.get("web_paths")

        for path in web_paths:
            to_path = my.download(path)
            my.load_file(to_path, namespace=namespace, mode=mode)

        # FIXME: if the instance already exists, it will be auto renmaed by
        # the application ... this gets tricky to discover
        snapshot_code = snapshot.get('code')
        if namespace:
            tactic_node = "%s:tactic_%s" % (namespace, snapshot_code)
        else:
            tactic_node = "tactic_%s" % snapshot_code
        return tactic_node
Beispiel #26
0
 def init(my):
     from client.tactic_client_lib import TacticServerStub
     from pyasm.common import Environment
     my.server = TacticServerStub.get()
     my.sk = ''
     my.code = ''
     my.video_reasons = {'Cropping': 'video_cropping_reason','Digital Hits / Macroblocking': 'video_digihits_reason', 'Dropped Frames': 'video_dropped_frames_reason', 'Dropout': 'video_dropout_reason', 'Duplicate Frames': 'video_duplicate_frames_reason', 'Interlacing on a progressive file': 'video_interlacing_progressive_reason', 'Motion/Image Lag': 'video_motion_lag_reason', 'Missing elements': 'video_missing_elements_reason', 'Corrupt file': 'video_corrupt_file_reason', 'Incorrect aspect ratio': 'video_bad_aspect_ratio_reason', 'Incorrect resolution': 'video_bad_resolution_reason', 'Incorrect pixel aspect ratio': 'video_bad_pixel_aspect_ratio_reason', 'Incorrect specifications': 'video_bad_specifications_reason', ' Incorrect head/tail format': 'video_bad_head_tail_reason', 'Other issue': 'video_other_reason'}
     my.video_reasons_arr = ['Cropping','Digital Hits / Macroblocking', 'Dropped Frames', 'Dropout', 'Duplicate Frames', 'Interlacing on a progressive file', 'Motion/Image Lag', 'Missing elements', 'Corrupt file', 'Incorrect aspect ratio', 'Incorrect resolution', 'Incorrect pixel aspect ratio', 'Incorrect specifications', ' Incorrect head/tail format', 'Other issue']
     my.audio_reasons = {'Incorrect Audio Mapping': 'audio_bad_mapping_reason', 'Missing Audio Channel': 'audio_missing_audio_channel_reason', 'Crackle/Hiss/Pop/Static/Ticks': 'audio_crackle_reason', 'Distortion': 'audio_distortion_reason', 'Dropouts': 'audio_dropouts_reason', 'Sync issue': 'audio_sync_reason', 'Missing elements': 'audio_missing_elements_reason', 'Corrupt file / missing file': 'audio_corrupt_missing_file_reason', 'Incorrect specifications': 'audio_bad_specifications_reason', 'Other Issue': 'audio_other_reason'}
     my.audio_reasons_arr = ['Incorrect Audio Mapping', 'Missing Audio Channel', 'Crackle/Hiss/Pop/Static/Ticks', 'Distortion', 'Dropouts', 'Sync issue', 'Missing elements', 'Corrupt file / missing file', 'Incorrect specifications', 'Other Issue']
     my.metadata_reasons = {'Missing information': 'metadata_missing_info_reason', 'Incorrect information': 'metadata_bad_info_reason', 'Incorrect formatting': 'metadata_bad_formatting_reason', 'Other Issue': 'metadata_other_reason'}
     my.metadata_reasons_arr = ['Missing information', 'Incorrect information', 'Incorrect formatting', 'Other Issue']
     my.subtitle_reasons = {'Interlacing on subtitles': 'subtitle_interlacing_reason', 'Incorrect subtitles': 'subtitle_bad_subtitles_reason', 'Sync issue': 'subtitle_sync_issue_reason', 'Overlapping other text': 'subtitle_overlapping_reason', 'Other issue': 'subtitle_other_reason'}
     my.subtitle_reasons_arr = ['Interlacing on subtitles', 'Incorrect subtitles', 'Sync issue', 'Overlapping other text', 'Other issue']
     my.cc_reasons = {'Sync issue': 'cc_sync_issue_reason','Incorrect CC': 'cc_bad_cc_reason', 'Overlapping other text': 'cc_overlapping_reason','Other issue': 'cc_other_reason'}
     my.cc_reasons_arr = ['Sync issue','Incorrect CC', 'Overlapping other text','Other issue']
     my.rejection_causes = ['Client Error','Machine Error','Manager Error','Operator Error','Process Error','Scheduler Error']
     my.root_cause_types = ['Machine Error','Operator Error','Incorrect Instructions','Source Issue','No Issue Found']
     my.statuses = ['Open','Investigating','Waiting for Source','Needs Corrective Action','Closed']
Beispiel #27
0
    def get_display(my):
        name = ''
        if 'code' in my.kwargs.keys():
            code = str(my.kwargs.get('code'))
            if 'name' in my.kwargs.keys():
                name = str(my.kwargs.get('name'))
        else:
            sobject = my.get_current_sobject()
            code = sobject.get_code()
            if 'WORK_ORDER' in code or 'PROJ' in code:
                name = sobject.get_value('process')
            elif 'TITLE' in code:
                name = sobject.get_value('title')
                if sobject.get_value('episode') not in [None,'']:
                    name = '%s: %s' % (name, sobject.get_value('episode'))
            elif 'ORDER' in code:
                name = sobject.get_value('name')
            if sobject.has_value('lookup_code'):
                if 'STATUS_LOG' in code:
                    my.server = TacticServerStub.get()
                    name = my.server.eval("@GET(sthpw/task['lookup_code','%s'].process)" % sobject.get_value('lookup_code')) 
                    if name:
                        name = name[0]
                    else:
                        name = 'Deleted Work Order'
                else:
                    name = sobject.get_value('process')
                code = sobject.get_value('lookup_code')

        widget = DivWdg()
        table = Table()

        table.add_row()
        cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="Inspect" name="Inspect" src="/context/icons/silk/information.png">')
        cell1.add_attr('code', code)
        cell1.add_attr('name',name)
        launch_behavior = my.get_launch_behavior()
        cell1.add_style('cursor: pointer;')
        cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Beispiel #28
0
 def get_display(my):
     from client.tactic_client_lib import TacticServerStub
     from tactic.ui.input import UploadButtonWdg
     server = TacticServerStub.get()
     ticket = server.generate_ticket()
     sk = str(my.kwargs.get('sk'))
     processes = str(my.kwargs.get('processes'))
     code = sk.split('code=')[1];
     #sobject = server.get_by_search_key(sk)
     widget = DivWdg()
     table = Table()
     table.add_attr('class','html5_uploader_wdg')
     table.add_attr('sk',sk)
     table.add_attr('processes',processes)
     table.add_attr('ticket',ticket)
     table.add_row()
     snaps = SnapshotViewerWdg(sk=sk)
     longcell1 = table.add_cell(snaps)
     longcell1.add_attr('colspan','2')
     table.add_row()
     context = 'PO'
     upload_button = UploadButtonWdg(context=context, ticket=ticket, on_complete=my.on_complete_js, search_key=sk, title="Select a File for %s" % code, stupid_button=True) 
     table.add_cell(upload_button)
     files_tbl = Table()
     files_tbl.add_attr('id','html5_files_tbl')
     table.add_row()
     files = table.add_cell(files_tbl)
     files.add_attr('colspan','2')
     table.add_row()
     uno = table.add_cell(' ')
     uno.add_attr('width','100%s' % '%')
     butt = table.add_cell('<input type="button" value="Assign Context & Finish"/>') 
     butt.add_behavior(my.get_finish())
     tres = table.add_cell(' ')
     tres.add_attr('width','100%s' % '%')
    
     #table.add_cell(sk)
     widget.add(table)
     return widget
Beispiel #29
0
    def init(my):
        my.server = TacticServerStub.get()
        my.types = ['HDCAM_Old', 'HDCAM_TV_FOX_Old', 'HDCAM_FILM_FOX_Old', 'HDCAM DIGIBETA_Old', 'DVD_Old', 'D5_Old']

        current_directory = os.path.dirname(__file__)
        my.template_files = {
            'HDCAM_Old': os.path.join(current_directory, 'templates/HDCAM_label_old.html'),
            'HDCAM_FILM_FOX_Old': os.path.join(current_directory, 'templates/HDCAM_FILM_FOX_label_old.html'),
            'HDCAM_TV_FOX_Old': os.path.join(current_directory, 'templates/HDCAM_TV_FOX_label_old.html'),
            'HDCAM DIGIBETA_Old': os.path.join(current_directory, 'templates/HDCAM_Digibeta_label_old.html'),
            'DVD_Old': os.path.join(current_directory, 'templates/DVD_Label_old.html'),
            'D5_Old': os.path.join(current_directory, 'templates/D5_label_old.html'),
            'HDCAM': os.path.join(current_directory, 'templates/HDCAM_label.html'),
            'HDCAM_FILM_FOX': os.path.join(current_directory, 'templates/HDCAM_FILM_FOX_label.html'),
            'HDCAM_TV_FOX': os.path.join(current_directory, 'templates/HDCAM_TV_FOX_label.html'),
            'HDCAM DIGIBETA': os.path.join(current_directory, 'templates/HDCAM_Digibeta_label.html'),
            'DVD': os.path.join(current_directory, 'templates/DVD_Label.html'),
            'D5': os.path.join(current_directory, 'templates/D5_label.html'),
            'LTO': os.path.join(current_directory, 'templates/LTO_label.html')
        }

        # This is needed to present the keys in template_files in order
        # Since the platform is using Python 2.6, Ordered dictionaries are not available by default
        my.template_file_types = ('HDCAM', 'HDCAM_FILM_FOX', 'HDCAM_TV_FOX', 'HDCAM DIGIBETA', 'DVD', 'D5', 'LTO')
Beispiel #30
0
    def get_display(my):
        my.title_code = str(my.kwargs.get('title_code'))
        my.title_sk = str(my.kwargs.get('title_sk'))
        my.order_sk = str(my.kwargs.get('order_sk'))

        origin_search = Search("twog/title_origin")
        origin_search.add_filter('title_code',my.title_code)
        origins = origin_search.get_sobjects()

        groups_str = ''
        user_group_names = Environment.get_group_names()
        for mg in user_group_names:
            if groups_str == '':
                groups_str = mg
            else:
                groups_str = '%s,%s' % (groups_str, mg)
        user_is_scheduler = False
        if 'scheduling' in groups_str:
            user_is_scheduler = True

        table = Table()
        table.add_attr('width','100%s' % '%')
        table.add_attr('bgcolor','#cbe49e')
        table.add_style('border-bottom-right-radius', '10px')
        table.add_style('border-bottom-left-radius', '10px')
        table.add_style('border-top-right-radius', '10px')
        table.add_style('border-top-left-radius', '10px')
        table.add_row()
        source_limit = 7
        count = 0
        if len(origins) > 0:
            table.add_row()
            mr_title = table.add_cell('<b><u><i>Sources</i></u></b>')
            mr_title.add_style('font-size: 90%s;' % '%')
        seen = []
        for origin in origins:
            source_code = origin.get_value('source_code')
            if source_code not in seen:
                seen.append(source_code)
                source_search = Search("twog/source")
                source_search.add_filter('code',source_code)
                source = source_search.get_sobject()
                if count % source_limit == 0:
                    table.add_row()
                celly = None
                if not source.get_value('high_security'):
                    celly = table.add_cell('<font color="#3e3e3e"><b><u>(%s): %s</u></b></font>' % (source.get_value('barcode'),source.get_value('title')))
                else:
                    celly = table.add_cell('<font color="#ff0000"><b><u>!!!(%s): %s!!!</u></b></font>' % (source.get_value('barcode'),source.get_value('title')))
                celly.add_attr('nowrap','nowrap')
                celly.add_style('cursor: pointer;')
                celly.add_style('font-size: 80%s;' % '%')
                celly.add_behavior(get_launch_source_behavior(my.title_code, my.title_sk, source.get_value('code'), source.get_search_key(), my.order_sk))

                table.add_cell(' &nbsp;&nbsp; ')
                count += 1
            else:

                my.server = TacticServerStub.get()
                my.server.retire_sobject(origin.get_search_key())
        table2 = Table()
        if user_is_scheduler:
            table2.add_row()
            barcode_text_wdg = TextWdg('barcode_insert')
            barcode_text_wdg.add_behavior(my.get_barcode_insert_behavior(my.title_code, my.title_sk, my.order_sk))
            bct = table2.add_cell(barcode_text_wdg)
            bct.add_attr('align','right')
            bct.add_attr('width','100%s' % '%')
        two_gether = Table()
        two_gether.add_row()
        srcs = two_gether.add_cell(table)
        srcs.add_attr('width','100%s' % '%')
        srcs.add_attr('valign','top')
        if user_is_scheduler:
            bcentry = two_gether.add_cell(table2)
            bcentry.add_attr('valign','top')

        return two_gether
Beispiel #31
0
def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # Just get the dev server URL for now
    url = config.get('server', 'dev')

    # Get a server object to perform queries
    server = TacticServerStub(server=url,
                              project=project,
                              user=user,
                              password=password)

    # Set up a list of languages to insert
    languages = [
        "Afar", "Abkhazian", "Afrikaans", "Akan", "Albanian", "Amharic",
        "Arabic", "Aragonese", "Armenian", "Assamese", "Avaric", "Avestan",
        "Aymara", "Azerbaijani", "Bashkir", "Bambara", "Basque", "Belarusian",
        "Bengali", "Bihari languages", "Bislama", "Tibetan", "Bosnian",
        "Breton", "Bulgarian", "Burmese", "Catalan; Valencian", "Czech",
        "Chamorro", "Chechen", "Chinese",
        "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic",
        "Chuvash", "Cornish", "Corsican", "Cree", "Welsh", "Danish", "German",
        "Divehi; Dhivehi; Maldivian", "Dutch; Flemish", "Dzongkha",
        "Greek, Modern (1453-)", "English", "Esperanto", "Estonian", "Ewe",
        "Faroese", "Persian", "Fijian", "Finnish", "French", "Western Frisian",
        "Fulah", "Georgian", "Gaelic; Scottish Gaelic", "Irish", "Galician",
        "Manx", "Guarani", "Gujarati", "Haitian; Haitian Creole", "Hausa",
        "Hebrew", "Herero", "Hindi", "Hiri Motu", "Croatian", "Hungarian",
        "Igbo", "Icelandic", "Ido", "Sichuan Yi; Nuosu", "Inuktitut",
        "Interlingue; Occidental",
        "Interlingua (International Auxiliary Language Association)",
        "Indonesian", "Inupiaq", "Italian", "Javanese", "Japanese",
        "Kalaallisut; Greenlandic", "Kannada", "Kashmiri", "Kanuri", "Kazakh",
        "Central Khmer", "Kikuyu; Gikuyu", "Kinyarwanda", "Kirghiz; Kyrgyz",
        "Komi", "Kongo", "Korean", "Kuanyama; Kwanyama", "Kurdish", "Lao",
        "Latin", "Latvian", "Limburgan; Limburger; Limburgish", "Lingala",
        "Lithuanian", "Luxembourgish; Letzeburgesch", "Luba-Katanga", "Ganda",
        "Macedonian", "Marshallese", "Malayalam", "Maori", "Marathi", "Malay",
        "Malagasy", "Maltese", "Mongolian", "Nauru", "Navajo; Navaho",
        "Ndebele, South; South Ndebele", "Ndebele, North; North Ndebele",
        "Ndonga", "Nepali", "Norwegian Nynorsk; Nynorsk, Norwegian",
        "Bokmal, Norwegian; Norwegian Bokmal", "Norwegian",
        "Chichewa; Chewa; Nyanja", "Occitan (post 1500)", "Ojibwa", "Oriya",
        "Oromo", "Ossetian; Ossetic", "Panjabi; Punjabi", "Pali", "Polish",
        "Portuguese", "Pushto; Pashto", "Quechua", "Romansh",
        "Romanian; Moldavian; Moldovan", "Rundi", "Russian", "Sango",
        "Sanskrit", "Sinhala; Sinhalese", "Slovak", "Slovenian",
        "Northern Sami", "Samoan", "Shona", "Sindhi", "Somali",
        "Sotho, Southern", "Spanish; Latin", "Spanish; Castilian", "Sardinian",
        "Serbian", "Swati", "Sundanese", "Swahili", "Swedish", "Tahitian",
        "Tamil", "Tatar", "Telugu", "Tajik", "Tagalog", "Thai", "Tigrinya",
        "Tonga (Tonga Islands)", "Tswana", "Tsonga", "Turkmen", "Turkish",
        "Twi", "Uighur; Uyghur", "Ukrainian", "Urdu", "Uzbek", "Venda",
        "Vietnamese", "Volapuk", "Walloon", "Wolof", "Xhosa", "Yiddish",
        "Yoruba", "Zhuang; Chuang", "Zulu", "MLF", "Cantonese",
        "French Canadien", "Various", "Mandarin Simplified",
        "French Parisian Dubbed", "Portuguese; Brazilian"
    ]

    # Get a list of already existing languages
    existing_languages = server.eval('@SOBJECT(twog/language)')
    existing_languages = [
        existing_language.get('name')
        for existing_language in existing_languages
    ]

    # Filter out the languages that are already in the database
    languages_to_insert = [
        language for language in languages
        if language not in existing_languages
    ]

    for language in languages_to_insert:
        # Insert the language
        server.insert('twog/language', {'name': language})
Beispiel #32
0
    def _test_file_naming(my):
        process = 'model'
        type = 'main'
        context = 'modeling'
        version = 10
        file_name = 'testing_image.jpg'
        code = name = 'vehicle001'
        asset_library = 'vehicle'

        asset = SearchType.create( Asset.SEARCH_TYPE )
        asset.set_value("code",code)
        asset.set_value("name",name)
        asset.set_value("asset_library",asset_library)
        asset.set_value("asset_type","asset")

        virtual_snapshot = Snapshot.create_new()
        virtual_snapshot_xml = '<snapshot process=\'%s\'><file type=\'%s\'/></snapshot>' % (process, type)
        virtual_snapshot.set_value("snapshot", virtual_snapshot_xml)
        virtual_snapshot.set_value("context", context)
        virtual_snapshot.set_value("version", version)

        virtual_snapshot.set_sobject(asset)


        file_obj = File(File.SEARCH_TYPE)
        file_obj.set_value("file_name", file_name)
        

        file_naming = Project.get_file_naming()

        file_naming.set_sobject(asset)
        file_naming.set_snapshot(virtual_snapshot)
        file_naming.set_file_object(file_obj)

        expected_file_name = 'vehicle001_%s_v%0.3d.jpg' %(context,version)
        file_name = file_naming.get_file_name()
        my.assertEquals(expected_file_name, file_name)


        # try a default directory name

        file_obj.set_value("file_name", "test_dir")
        file_obj.set_value("base_type", "directory")
        file_naming.set_file_object(file_obj)
        
        # this should adopt the original dir name in the prefix
        expected_file_name = 'test_dir_%s_v%0.3d' %(context,version)
        file_name = file_naming.get_default()
        my.assertEquals(expected_file_name, file_name)

        #2 try a different search_type unittest/person
        version = 9
        
        
        file_obj.set_value("base_type", "file")
        # change a different input file name
        file_obj.set_value('file_name','some_maya_model.ma') 
        
        # use a real snapshot
        virtual_snapshot.set_sobject(my.person)
        virtual_snapshot.set_value("version", version)
        
        # change to the test file naming class
        my.sobj.set_value('file_naming_cls', 'pyasm.biz.naming_test.TestFileNaming')
        my.sobj.commit()
        Project.set_project('unittest')
        file_naming = Project.get_file_naming()
        file_naming.set_sobject(my.person)
        file_naming.set_snapshot(virtual_snapshot)
        file_naming.set_file_object(file_obj)
        file_name = file_naming.get_file_name()

        expected_file_name = 'phil_main_v009.ma'
        my.assertEquals(expected_file_name, file_name)

        # get_preallocated_path
        type = 'ma'
        #file_obj.set_value('type', type)
        #file_naming.set_file_object(file_obj)

        preallocated = my.snapshot.get_preallocated_path(file_type='maya', file_name='what.ma',ext='ma')
        preallocated_file_name = os.path.basename(preallocated)
        my.assertEquals("phil_main_v001.ma", preallocated_file_name)

        preallocated = my.snapshot.get_preallocated_path(file_type='houdini', file_name='what.otl',ext='otl')
        preallocated_file_name = os.path.basename(preallocated)
        my.assertEquals("phil_main_v001.otl", preallocated_file_name)

        preallocated = my.snapshot.get_preallocated_path(file_type='houdini', file_name='what_is.otl', ext='hipnc')
        preallocated_file_name = os.path.basename(preallocated)
        my.assertEquals("phil_main_v001.hipnc", preallocated_file_name)


        # try an empty file naming
        # change to the test file naming class
        my.sobj.set_value('file_naming_cls', 'pyasm.biz.naming_test.TestFileNaming2')
        my.sobj.commit()

        Project.set_project('unittest')
        file_naming = Project.get_file_naming()
        file_naming.set_sobject(my.person)
        file_naming.set_snapshot(virtual_snapshot)
        file_naming.set_file_object(file_obj)
        file_name = file_naming.get_file_name()
       
        preallocated = my.snapshot.get_preallocated_path(file_type='houdini', file_name='what_is.otl', ext='hipnc')

        if not os.path.exists(preallocated):
            os.makedirs(preallocated)
         
        from client.tactic_client_lib import TacticServerStub
        client = TacticServerStub.get()
        
        if os.path.isdir(preallocated):
            rtn = client.add_directory(my.snapshot.get_code(), preallocated, 'houdini', mode='preallocate')
        else:
            rtn = client.add_file(my.snapshot.get_code(), preallocated, 'houdini', mode='preallocate')
        rtn = client.get_snapshot(SearchKey.get_by_sobject(my.snapshot.get_parent()), context = 'naming_test', version = 1, include_files=True)
        files =  rtn.get('__files__')
        
        # assuming the file is ordered by code
        # the 1st file obj is a file and 2nd file obj is a directory
        for idx, file in enumerate(files):
            if idx ==0:
                my.assertEquals(file.get('type'), 'main')
                my.assertEquals(file.get('base_type'), 'file')
                my.assertEquals(file.get('file_name'), 'naming_test_naming_test_v001.txt')
                
            elif idx ==1:
                my.assertEquals(file.get('type'), 'houdini')
                my.assertEquals(file.get('base_type'), 'directory')
                my.assertEquals(file.get('md5'), '')
                my.assertEquals(file.get('file_name'), '')
Beispiel #33
0
    def execute(my):

        file_path = my.kwargs.get("path")
        project_code = my.kwargs.get("project_code")
        base_dir = my.kwargs.get("base_dir")
        search_type = my.kwargs.get("search_type")
        process = my.kwargs.get("process")
        watch_script_path =  my.kwargs.get("script_path")
        if not process:
            process = "publish"

        basename = os.path.basename(file_path)

        context = my.kwargs.get("context")
        if not context:
            context = '%s/%s'  % (process, basename)


        # find the relative_dir and relative_path
        relative_path = file_path.replace("%s/" % base_dir, "")
        relative_dir = os.path.dirname(relative_path)

        file_name = os.path.basename(file_path)
        log_path = '%s/TACTIC_log.txt' %(base_dir)
        my.create_checkin_log()

        # Define asset type of the file
        asset_type = my.get_asset_type(file_path)
        description = "drop folder check-in of %s" %file_name

        from client.tactic_client_lib import TacticServerStub
        server = TacticServerStub.get(protocol='local')
        server.set_project(project_code)

        transaction = Transaction.get(create=True)
        server.start(title='Check-in of media', description='Check-in of media')

        server_return_value = {}

        try:
            filters = [
                    [ 'name', '=', file_name ],
                    #[ 'relative_dir', '=', relative_dir ]
                ]
            sobj = server.query(search_type, filters=filters, single=True)

            if not sobj:
                # create sobject if it does not yet exist
                sobj = SearchType.create(search_type)
                if SearchType.column_exists(search_type, "name"):
                    sobj.set_value("name", basename)
                if SearchType.column_exists(search_type, "media_type"):
                    sobj.set_value("media_type", asset_type)


                if SearchType.column_exists(search_type, "relative_dir"):
                    sobj.set_value("relative_dir", relative_dir)

                if SearchType.column_exists(search_type, "keywords"):
                    relative_path = relative_path
                    keywords = Common.get_keywords_from_path(relative_path)
                    keywords = " ".join( keywords )
                    sobj.set_value("keywords", keywords)

                sobj.commit()
                search_key = sobj.get_search_key()
            else:
                search_key = sobj.get("__search_key__")


            #task = server.create_task(sobj.get('__search_key__'),process='publish')
            #server.update(task, {'status': 'New'})


            server_return_value = server.simple_checkin(search_key,  context, file_path, description=description, mode='move')

            if watch_script_path:
                cmd = PythonCmd(script_path=watch_script_path,search_type=search_type,drop_path=file_path,search_key=search_key)
                cmd.execute()




            
        except Exception, e:
            print "Error occurred", e
            error_message=str(e)

            import traceback
            tb = sys.exc_info()[2]
            stacktrace = traceback.format_tb(tb)
            stacktrace_str = "".join(stacktrace)
            print "-"*50
            print stacktrace_str


            version_num='Error:'
            system_time=strftime("%Y/%m/%d %H:%M", gmtime())
            pre_log=file_name+(50-len(file_name))*' '+system_time+(33-len(system_time))*' '+version_num+(15-len(version_num))*' ' +error_message+'\n'\
                    + stacktrace_str + '\n' + watch_script_path
            # Write data into TACTIC_log file under /tmp/drop
            f = open(log_path, 'a')
            f.write(pre_log)
            f.close()

            #server.abort()
            transaction.rollback()
            raise
Beispiel #34
0
    if len(args) == 0:
        print "Must supply a project code. Usually it's the name of the file before the version number."
        print "python create_template.py -m create -t template <project_code>"
        print "python create_template.py -m install -f /tmp/some_template-1.0.0.zip <project_code>"
        print "python create_template.py -m install -t <template_project_code> <project_code>"
        sys.exit(0)


    project_code = args[0]


    try:
        if options.mode == 'create':
            create(project_code)
        elif options.mode == 'install':
            path = options.file_path
            if path:
                server = TacticServerStub.get()
                server.upload_file(path)
            template_code = options.template
            install(project_code, path=path, template_code=template_code)
        else :
            print "Mode [%s] not support.  Must be either create or install" % options.get("mode")
            sys.exit(0)
    except TacticException, e:
        print
        print e.__str__()
        sys.exit(2)


import tacticenv, time
from client.tactic_client_lib import TacticServerStub
doing = open('what_have_i_done', 'w')
server = TacticServerStub.get(protocol="xmlrpc")
#server.start('CALCULATING COSTS')
orders = server.eval("@SOBJECT(twog/order['@ORDER_BY','code desc']['id','<','%s'])" % 12044)
#print "orders = %s" % orders
for order in orders:
    id = int(order.get('code').split('ORDER')[1].lstrip('0'))
    sk = ''
    order_code = order.get('code')
    #print "ORDER CODE = %s" % order_code
    doing.write('\t\t\t\t\tORDER CODE: %s\n' % order_code)
    order = server.eval("@SOBJECT(twog/order['code','%s'])" % order_code)[0]
    order_dict = {'actual_cost': 0, 'expected_cost': 0, 'titles':{}}
    #time.sleep(1)
    titles = server.eval("@SOBJECT(twog/title['order_code','%s'])" % order_code)
    for title in titles:
	title_code = title.get('code')
	order_dict['titles'][title_code] = {'actual_cost': 0, 'expected_cost': 0, 'projs': {}}
        #time.sleep(1)
	projs = server.eval("@SOBJECT(twog/proj['title_code','%s'])" % title_code)
	for proj in projs:
	    proj_code = proj.get('code')
	    order_dict['titles'][title_code]['projs'][proj_code] = {'actual_cost': 0, 'expected_cost': 0, 'wos': {}}
            #time.sleep(1)
	    wos = server.eval("@SOBJECT(twog/work_order['proj_code','%s'])" % proj_code)
	    for wo in wos:
		wo_code = wo.get('code')
		estimated_work_hours = wo.get('estimated_work_hours')
		work_group = wo.get('work_group')
Beispiel #36
0
    def execute(my):

        file_path = my.kwargs.get("path")
        project_code = my.kwargs.get("project_code")
        base_dir = my.kwargs.get("base_dir")
        search_type = my.kwargs.get("search_type")
        process = my.kwargs.get("process")
        watch_script_path = my.kwargs.get("script_path")
        if not process:
            process = "publish"

        basename = os.path.basename(file_path)

        context = my.kwargs.get("context")
        if not context:
            context = '%s/%s' % (process, basename)

        # find the relative_dir and relative_path
        relative_path = file_path.replace("%s/" % base_dir, "")
        relative_dir = os.path.dirname(relative_path)

        file_name = os.path.basename(file_path)
        log_path = '%s/TACTIC_log.txt' % (base_dir)
        my.create_checkin_log()

        # Define asset type of the file
        asset_type = my.get_asset_type(file_path)
        description = "drop folder check-in of %s" % file_name

        from client.tactic_client_lib import TacticServerStub
        server = TacticServerStub.get(protocol='local')
        server.set_project(project_code)

        transaction = Transaction.get(create=True)
        server.start(title='Check-in of media',
                     description='Check-in of media')

        server_return_value = {}

        try:
            filters = [
                ['name', '=', file_name],
                #[ 'relative_dir', '=', relative_dir ]
            ]
            sobj = server.query(search_type, filters=filters, single=True)

            if not sobj:
                # create sobject if it does not yet exist
                sobj = SearchType.create(search_type)
                if SearchType.column_exists(search_type, "name"):
                    sobj.set_value("name", basename)
                if SearchType.column_exists(search_type, "media_type"):
                    sobj.set_value("media_type", asset_type)

                if SearchType.column_exists(search_type, "relative_dir"):
                    sobj.set_value("relative_dir", relative_dir)

                if SearchType.column_exists(search_type, "keywords"):
                    relative_path = relative_path
                    keywords = Common.get_keywords_from_path(relative_path)
                    keywords = " ".join(keywords)
                    sobj.set_value("keywords", keywords)

                sobj.commit()
                search_key = sobj.get_search_key()
            else:
                search_key = sobj.get("__search_key__")

            #task = server.create_task(sobj.get('__search_key__'),process='publish')
            #server.update(task, {'status': 'New'})

            server_return_value = server.simple_checkin(
                search_key,
                context,
                file_path,
                description=description,
                mode='move')

            if watch_script_path:
                cmd = PythonCmd(script_path=watch_script_path,
                                search_type=search_type,
                                drop_path=file_path,
                                search_key=search_key)
                cmd.execute()

        except Exception, e:
            print "Error occurred", e
            error_message = str(e)

            import traceback
            tb = sys.exc_info()[2]
            stacktrace = traceback.format_tb(tb)
            stacktrace_str = "".join(stacktrace)
            print "-" * 50
            print stacktrace_str

            version_num = 'Error:'
            system_time = strftime("%Y/%m/%d %H:%M", gmtime())
            pre_log=file_name+(50-len(file_name))*' '+system_time+(33-len(system_time))*' '+version_num+(15-len(version_num))*' ' +error_message+'\n'\
                    + stacktrace_str + '\n' + watch_script_path
            # Write data into TACTIC_log file under /tmp/drop
            f = open(log_path, 'a')
            f.write(pre_log)
            f.close()

            #server.abort()
            transaction.rollback()
            raise
def main():
    config = ConfigParser.ConfigParser()
    config.read('config.ini')

    # Get credentials from config file
    user = config.get('credentials', 'user')
    password = config.get('credentials', 'password')
    project = config.get('credentials', 'project')

    # Just get the dev server URL for now
    url = config.get('server', 'dev')

    # Get a server object to perform queries
    server = TacticServerStub(server=url,
                              project=project,
                              user=user,
                              password=password)

    # Get the file holding the old element evaluation data
    element_evaluations_file = open('element_evals.txt', 'r')

    audio_lines = []
    audio_lines_file = open('audio_lines.txt', 'r')

    for line in audio_lines_file:
        audio_lines.append(eval(line))

    eval_lines = []
    eval_lines_file = open('eval_lines.txt', 'r')

    for line in eval_lines_file:
        eval_lines.append(eval(line))

    # Now iterate through the list of reports, and put together a dictionary with the converted data for each one
    for line in element_evaluations_file:
        print(line)
        element_evaluation = eval(line)

        # Initialize the dictionary to store the values
        new_element_evaluation = {}

        # First, grab the values that are a 1:1 conversion (that is, they don't need any special processing)
        data_points = ('active_video_begins', 'active_video_ends', 'bars_tone',
                       'bay', 'black_silence_1', 'black_silence_2',
                       'cc_subtitles', 'chroma_peak', 'end_of_program',
                       'episode', 'file_name', 'format', 'head_logo',
                       'horizontal_blanking', 'label', 'login', 'notices',
                       'operator', 'po_number', 'record_date', 'season',
                       'slate_silence', 'standard', 'start_of_program',
                       'style', 'tail_logo', 'total_runtime',
                       'tv_feature_trailer', 'version', 'video_aspect_ratio',
                       'vitc')

        for data_point in data_points:
            new_element_evaluation[data_point] = element_evaluation.get(
                data_point)

        # Next, get the values that are named differently in the new server. No special processing required other than
        # to change the name
        new_element_evaluation['client'] = element_evaluation.get(
            'client_code')
        new_element_evaluation['date'] = element_evaluation.get('timecode')
        new_element_evaluation['general_comments'] = element_evaluation.get(
            'description')
        new_element_evaluation['luminance_peak'] = element_evaluation.get(
            'video_peak')
        new_element_evaluation['status'] = element_evaluation.get('conclusion')
        new_element_evaluation['roll_up_blank'] = element_evaluation.get(
            'roll_up')
        new_element_evaluation['source_barcode'] = element_evaluation.get(
            'record_vendor')
        new_element_evaluation['textless_tail'] = element_evaluation.get(
            'textless_at_tail')

        # Now comes the fun part. Some of the values stored as varchars in the old server are now using Foreign Key
        # relations. They probably should have been stored as Foreign Keys in the first place, but they weren't. To do
        # this, get the value from the old server, and using one of the reversed key-value dictionaries, look up its
        # code in the new server.
        new_element_evaluation['frame_rate'] = get_frame_rate_code_from_name(
            element_evaluation.get('frame_rate'))
        new_element_evaluation['language'] = get_language_code_from_name(
            element_evaluation.get('language'))
        new_element_evaluation['machine'] = get_machine_code_from_name(
            element_evaluation.get('machine_number'))

        # Give the report a name. Use the Title and code
        new_element_evaluation['name'] = element_evaluation.get(
            'code') + ' in ' + element_evaluation.get('title', '')

        # Now insert the report. We'll need the search key of the inserted report, so get that from the server.insert()
        # function
        inserted_element_evaluation = server.insert('twog/element_evaluation',
                                                    new_element_evaluation)

        # Convert and insert the audio evaluation lines
        audio_eval_lines = get_audio_eval_lines(audio_lines,
                                                element_evaluation.get('code'))
        server.insert_multiple('twog/audio_evaluation_lines', audio_eval_lines)

        # Convert and insert the element evaluation lines
        element_eval_lines = get_element_eval_lines(
            eval_lines, element_evaluation.get('code'))
        server.insert_multiple('twog/element_evaluation_lines',
                               element_eval_lines)

    element_evaluations_file.close()
Beispiel #38
0
 def __init__(self, **kwargs):
     super(IMDBImageAssociatorCmd, self).__init__(**kwargs)
     self.orders = str(kwargs.get('orders_to_associate')).split(',')
     self.server = TacticServerStub.get()
Beispiel #39
0
    def execute(self):

        file_path = self.kwargs.get("path")
        site = self.kwargs.get("site")
        project_code = self.kwargs.get("project_code")
        base_dir = self.kwargs.get("base_dir")
        search_type = self.kwargs.get("search_type")
        process = self.kwargs.get("process")
        watch_script_path = self.kwargs.get("script_path")
        if not process:
            process = "publish"

        basename = os.path.basename(file_path)

        context = self.kwargs.get("context")
        if not context:
            context = '%s/%s' % (process, basename)

        # find the relative_dir and relative_path
        relative_path = file_path.replace("%s/" % base_dir, "")
        relative_dir = os.path.dirname(relative_path)

        file_name = os.path.basename(file_path)
        log_path = '%s/TACTIC_log.txt' % (base_dir)
        self.create_checkin_log()

        # Define asset type of the file
        asset_type = self.get_asset_type(file_path)
        description = "drop folder check-in of %s" % file_name

        from client.tactic_client_lib import TacticServerStub
        server = TacticServerStub.get(protocol='local')
        server.set_project(project_code)

        transaction = Transaction.get(create=True)
        server.start(title='Check-in of media',
                     description='Check-in of media')

        server_return_value = {}

        try:
            filters = [
                ['name', '=', file_name],
                #[ 'relative_dir', '=', relative_dir ]
            ]
            sobj = server.query(search_type, filters=filters, single=True)

            if not sobj:
                # create sobject if it does not yet exist
                sobj = SearchType.create(search_type)
                if SearchType.column_exists(search_type, "name"):
                    sobj.set_value("name", basename)
                if SearchType.column_exists(search_type, "media_type"):
                    sobj.set_value("media_type", asset_type)

                if SearchType.column_exists(search_type, "relative_dir"):
                    sobj.set_value("relative_dir", relative_dir)

                if SearchType.column_exists(search_type, "keywords"):
                    relative_path = relative_path
                    keywords = Common.extract_keywords_from_path(relative_path)
                    keywords = " ".join(keywords)
                    sobj.set_value("keywords", keywords)

                sobj.commit()
                search_key = sobj.get_search_key()
            else:
                search_key = sobj.get("__search_key__")

            #task = server.create_task(sobj.get('__search_key__'),process='publish')
            #server.update(task, {'status': 'New'})
            """
            #TEST: simulate different check-in duration
            from random import randint
            sec = randint(1, 5)
            print "checking in for ", sec, "sec"
            server.eval("@SOBJECT(sthpw/login)")
            import shutil
            dir_name,base_name = os.path.split(file_path)
            dest_dir = 'C:/ProgramData/Southpaw/watch_temp'
            if not os.path.exists(dest_dir):
                os.makedirs(dest_dir)
            shutil.move(file_path, '%s/%s'%(dest_dir, base_name))
            time.sleep(sec)
            # move back the file in a few seconds 
            shutil.move('%s/%s'%(dest_dir, base_name), file_path)
            """
            server_return_value = server.simple_checkin(
                search_key,
                context,
                file_path,
                description=description,
                mode='move')

            if watch_script_path:
                cmd = PythonCmd(script_path=watch_script_path,
                                search_type=search_type,
                                drop_path=file_path,
                                search_key=search_key)
                cmd.execute()

        except Exception as e:
            print "Error occurred", e
            error_message = str(e)

            import traceback
            tb = sys.exc_info()[2]
            stacktrace = traceback.format_tb(tb)
            stacktrace_str = "".join(stacktrace)
            print "-" * 50
            print stacktrace_str

            version_num = 'Error:'
            system_time = strftime("%Y/%m/%d %H:%M", gmtime())
            pre_log=file_name+(50-len(file_name))*' '+system_time+(33-len(system_time))*' '+version_num+(15-len(version_num))*' ' +error_message+'\n'\
                    + stacktrace_str + '\n' + watch_script_path
            # Write data into TACTIC_log file under /tmp/drop
            f = open(log_path, 'a')
            f.write(pre_log)
            f.close()

            #server.abort()
            transaction.rollback()
            raise

        else:
            transaction.commit()

        #server.finish()

        if server_return_value:
            # Create the TACTIC_log file to record every check-in.
            # Search for all required data
            checkin_time = server_return_value.get('timestamp')
            version_nu = server_return_value.get('version')
            version_num = str(version_nu)
            try:
                value = parser.parse(checkin_time)
                value = value.strftime("%Y/%m/%d %H:%M")
            except:
                value = checkin_time

            pre_log = file_name + (50 - len(file_name)) * ' ' + value + (
                33 - len(value)) * ' ' + version_num + (
                    15 - len(version_num)) * ' ' + 'ok\n'
            # Write data into TACTIC_log file under /tmp/drop
            f = open(log_path, 'a')
            f.write(pre_log)
            f.close()

            # Invoke Trigger:called_triggers
            from pyasm.command import Trigger
            Trigger.call_all_triggers()

            # Delete the source file after check-in step.
            print "File handled."
            if os.path.exists(file_path):
                if os.path.isdir(file_path):
                    os.rmdirs(file_path)
                else:
                    os.unlink(file_path)
                print "Source file [%s] deleted: " % file_name
Beispiel #40
0
 def init(my):
     from client.tactic_client_lib import TacticServerStub
     my.order_code = None
     my.order_name = None
     my.server = TacticServerStub.get()