· 8 years ago · Jan 15, 2018, 02:18 PM
1<?php
2
3//Working with takes - sound files from talents and assotiate them with
4//unique session in unique_session.php
5//store information about takes
6//input parameters:
7//us_id : id of unique session, given from unique_session
8//take_id : id of take, given from takes
9//take_num : take number in a session
10//file_type : file type of take, given from audiofileformats
11//srate : sample rate of take
12//bdepth : bit depth of take
13//rec_start_ts : recording start timestamp
14//take_dur : duration of take
15//start_pos : start (in-mark) position
16//stop_pos : stop (out-mark) position
17//assoc_video_id : id of associated video file, given from videofiles
18//assoc_script_id : id of associated script file, given from scripts
19//transfer : tranferring yes/no flag
20//hres_path : high-res take path on the server
21//hres_size : high-res take file size
22//action : description of action []
23//
24//CREATE TABLE IF NOT EXISTS `takes_log` (
25// `tl_id` int(6) NOT NULL AUTO_INCREMENT,
26// `us_id` int(6) NOT NULL,
27// `take_id` int(6) NOT NULL,
28// `take_num` int(6) NOT NULL,
29// `file_type` int(6) NOT NULL,
30// `srate` int(6) NOT NULL,
31// `bdepth` int(6) NOT NULL,
32// `rec_start_ts` datetime NOT NULL,
33// `take_dur` int(6) NOT NULL,
34// `start_pos` int(6) NOT NULL,
35// `stop_pos` int(6) NOT NULL,
36// `assoc_video_id` int(6) NOT NULL,
37// `assoc_script_id` int(6) NOT NULL,
38// `transfer` int(1) NOT NULL,
39// `hres_path` varchar(255) NOT NULL,
40// `hres_size` int(11) NOT NULL,
41// PRIMARY KEY (`tl_id`)
42//) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
43
44require_once ("slashes.php");
45require_once ('header.php');
46require_once ($config['ROOT_PATH'] . '/lib/common/functions.php');
47
48$errorMessage = '';
49$resultMessage = '';
50$tableName = 'takes_log';
51
52if (isset($_REQUEST['action']))
53{
54 $action = $_REQUEST['action'];
55 if ($action == 'store')
56 {
57 if (
58 isset($_REQUEST['us_id']) &&
59 isset($_REQUEST['take_id']) &&
60 isset($_REQUEST['take_num']) &&
61 isset($_REQUEST['file_type']) &&
62 isset($_REQUEST['bdepth']) &&
63 isset($_REQUEST['rec_start_ts']) &&
64 isset($_REQUEST['take_dur']) &&
65 isset($_REQUEST['start_pos']) &&
66 isset($_REQUEST['stop_pos']) &&
67 isset($_REQUEST['assoc_video_id']) &&
68 isset($_REQUEST['assoc_script_id']) &&
69 isset($_REQUEST['transfer']) &&
70 isset($_REQUEST['hres_path']) &&
71 isset($_REQUEST['hres_size'])
72 )
73 {
74 $insert_array = array(
75 'us_id' => mysql_real_escape_string($_REQUEST['us_id']),
76 'take_id' => mysql_real_escape_string($_REQUEST['take_id']),
77 'take_num' => mysql_real_escape_string($_REQUEST['take_num']),
78 'file_type' => mysql_real_escape_string($_REQUEST['file_type']),
79 'bdepth' => mysql_real_escape_string($_REQUEST['bdepth']),
80 'rec_start_ts' => mysql_real_escape_string($_REQUEST['rec_start_ts']),
81 'take_dur' => mysql_real_escape_string($_REQUEST['take_dur']),
82 'start_pos' => mysql_real_escape_string($_REQUEST['start_pos']),
83 'stop_pos' => mysql_real_escape_string($_REQUEST['stop_pos']),
84 'assoc_video_id' => mysql_real_escape_string($_REQUEST['assoc_video_id']),
85 'assoc_script_id' => mysql_real_escape_string($_REQUEST['assoc_script_id']),
86 'transfer' => mysql_real_escape_string($_REQUEST['transfer']),
87 'hres_path' => mysql_real_escape_string($_REQUEST['hres_path']),
88 'hres_size' => mysql_real_escape_string($_REQUEST['hres_size'])
89 );
90 if ($db->db_insert($tableName, $insert_array, false))
91 {
92 //ok, row inserted
93 $new_takes_log_id = mysql_insert_id();
94 $resultMessage .= '<Record>';
95 $resultMessage .= ''. .'';
96 $resultMessage .= ''. .'';
97 $resultMessage .= ''. .'';
98 $resultMessage .= ''. .'';
99 $resultMessage .= ''. .'';
100 $resultMessage .= ''. .'';
101 $resultMessage .= ''. .'';
102 $resultMessage .= ''. .'';
103 $resultMessage .= ''. .'';
104 $resultMessage .= ''. .'';
105 $resultMessage .= ''. .'';
106 $resultMessage .= ''. .'';
107 $resultMessage .= ''. .'';
108 $resultMessage .= ''. .'';
109 $resultMessage .= '</Record>';
110 } else
111 {
112 $errorMessage = 'Unable to insert new unique session';
113 }
114 } else
115 {
116 $errorMessage = 'Not enough parameters';
117 }
118 } else if ($action == 'get')
119 {
120 if (isset($_REQUEST['tl_id']))
121 {
122 //there we return 1 unique session from db
123 $columns = '*';
124 $where = 'tl_id = ' . mysql_real_escape_string($_REQUEST['tl_id']);
125 $takes_log = $db->db_get_one_record($tableName, $columns, $where);
126 if (count($takes_log))
127 {
128 //ok, row get
129
130 }
131 } else
132 {
133 $errorMessage = 'Unique session ID is not set!';
134 }
135 } else
136 {
137 $errorMessage = 'Unknow action: ' . $action;
138 }
139}
140?>