Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 1 : import / export script Import file created from baselight ( Baselight _ export.txt ) Import xytech work order ( Xytech . txt

Project 1: import/export script
Import file created from baselight (Baselight_export.txt)
Import xytech work order (Xytech.txt)
Script will parse data
Computation done to match shareholder request, to replace file system from local baselight to facility storage (remember color correcter's prefer local storage for bandwidth issues)
Remember we are dealing with 3rd party data, so some errors in the data might occur and you have to deal with it (i.e )
Export CSV file ('/' indicates columns):
Line 1: Producer / Operator / job /notes
Line 4: show location / frames to fix
Frames and frame ranges processed in consecutive/numerical order shown (from baselight_export.txt) as either:
ranges (i.e /filesystem/Dune2/PartA/1920x108032-35)
individually (i.e /filesystem/Dune2/PartA/1920x108041)
Frames shown need to reflect their proper location and not mix with ranges from another location
import csv
import re
print("Current files: ")
print('------------------------------------------------------------')
# parsing two files, computationally two things frame ranges and folder fix and exporting cvs files
# method import and read baselight file
with open('Baselight_export.txt','r') as file:
baselight_data =[]
Baselight_data = file.read()
print(Baselight_data)
# method to import and read xytech file
with open('Xytech.txt','r') as file:
xytech_data =[]
Xytech_data = file.read()
print(Xytech_data)
print('------------------------------------------------------------
')
# Function to parse Baselight.txt
def parse_baselight_data():
data ={}
with open("Baselight_export.txt",'r') as file:
lines = file.readline()
current_location = None
for line in lines:
line = line.strip()
if line.startswith("/baselightfilesystem1"):
current_location = line
data[current_location]=[]
else:
frames = re.findall(r'\d+', line)
data[current_location]=[]
return data
# Function to parse Xytech.txt
def parse_xytech_data(data):
parsed_data =[]
for line in data:
parsed_line = line.split(',')
# parsed_line = line.split[0]
show_location = parsed_line[0]
frames_fix = parsed_line[1]
parsed_data.append({'Show Location': show_location, 'Frames to Fix': frames_fix})
return parsed_data
# Function to compute frame ranges
def compute_frames(data):
for line in data:
frames_fix = line.get('Frames to fix')
if frames_fix:
ranges = re.findall(r'/d+-\d+-',''.join(frames_fix))
if ranges:
line['Frames Ranges']= ranges
# Combine data and compute frame ranges
combined_data = baselight_data + xytech_data
print('Combined data: ', combined_data)
compute_frames(combined_data)
print('Computed data: ', combined_data)
# Parse Baselight data
parse_baselight_data = parse_baselight_data()
print('Parsed Baselight data: ', parse_baselight_data)
# Parse Xytech data
parse_xytech_data = parse_xytech_data(xytech_data)
print('Parsed Xytech data: ', parse_xytech_data)
# Export to csv
with open("baselight_and_xytech.csv",'w', newline='') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(['Producer', 'Operator', 'Job', 'Notes'])
writer.writerow([''])
writer.writerow([''])
writer.writerow(['Show Location', 'Frame to fix'])
for row in combined_data:
writer.writerow([
row.get('Producer',''),
row.get('Operator',''),
row.get('Job',''),
row.get('Notes',''),
row.get('Show Location'),
row.get('Frames Fix'),
writer.writerow(['']),
writer.writerow(['']),
writer.writerow(['']),
writer.writerow(['']),
row.get('Frames Ranges', ''),
','.join(map(str, row.get('Frames fix', []))),
','.join(map(str, row.get('Frames Ranges', [])))
])Project: example with random data
Xytech:
/ddnsan2/avengers/reel1/1920x1080
Baselight_export:
/images1/avengers/reel1/1920x108010111213192324
/ddnsan2/avengers/reel1/1920x108010-13
/ddnsan2/avengers/reel1/1920x108019
/ddnsan2/avengers/reel1/1920x108023-24
WHAT IS WRONG WITH MY CODE I CANT GET IT TO WORK
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

Explain the difference between y 21 and y 12 .

Answered: 1 week ago

Question

Personal knowledge of and contact with each appraised individual

Answered: 1 week ago