유희평

initial commit

Automatic video editing program
\ No newline at end of file
......@@ -445,8 +445,11 @@ class WindowClass(QMainWindow, Ui_MainWindow): # Ui_MainWindow를 받음
self.horizontalSlider.setMaximum(self.endframe - self.stframe)
self.horizontalSlider.setValue(self.stframe)
self.isdata = False
<<<<<<< HEAD
self.ax1.clear()
self.ax2.clear()
=======
>>>>>>> 34cff6b09a8d3e1117437cc9ed79eb6ae8313c1f
def updateFrame(self):
self.frameID += 1
......@@ -495,6 +498,40 @@ class WindowClass(QMainWindow, Ui_MainWindow): # Ui_MainWindow를 받음
self.statusbar.showMessage(
"Time: " + str(tmin).zfill(2) + ":" + str(ttsec).zfill(2) + ":" + str(int(ksec * 100)))
self.sliderbusy2 = False
<<<<<<< HEAD
=======
"""
def lineSliderSet(self, cnt): #그래프상 수직선 위치 업데이트
if cnt + 1 - self.stframe > self.horizontalSlider.maximum():
return
self.linebusy = True
pdraw = self.drawmin
self.drawmin -= 20
if self.drawmin < 1:
self.drawmin = 1
while (cnt + 1) / self.fps > self.data.values[self.drawmin, 1]:
self.drawmin += 1
if not self.drawmin == pdraw or pdraw == 1:
wr = ref(self.ax1.lines[5])
self.ax1.lines.remove(wr())
self.ui.bottomImage.canvas.draw()
self.ax1.plot([self.data.values[self.drawmin, 1], self.data.values[self.drawmin, 1]], [0, 3.4], 'k',
linewidth=2.0)
self.ui.bottomImage.canvas.draw()
tsec = cnt / self.fps
tmin = int(tsec / 60)
ttsec = int(tsec - 60 * tmin)
ksec = tsec - 60 * tmin - ttsec
self.ui.statusbar.showMessage(
"Frame Time: " + str(tmin).zfill(2) + ":" + str(ttsec).zfill(2) + ":" + str(int(ksec * 100)))
self.linebusy = False
"""
>>>>>>> 34cff6b09a8d3e1117437cc9ed79eb6ae8313c1f
def horizontalSliderPressed(self):
self.sliderbusy = True
......@@ -752,7 +789,11 @@ class Clip:
window_length = max_slice * sr #한 구간에 해당하는 샘플의 개수
energy = np.array([sum(abs(x[i: i + window_length] ** 2)) #windwo_length구간 안에있는 모든 샘플들의 진폭의 제곱의 합->소리의 크기
for i in range(0, len(x), window_length)]) #len(x)는 sr*영상길이인데 이것을 window_length만큼 끊음 i = 0, winlength, winlength*2, winlength*3, ...
<<<<<<< HEAD
=======
#print(energy)
>>>>>>> 34cff6b09a8d3e1117437cc9ed79eb6ae8313c1f
#energy data를 dataframe으로 만듦
df = pd.DataFrame(columns=['energy', 'start', 'end'])
row_index = 0
......@@ -763,9 +804,42 @@ class Clip:
df.loc[row_index, 'start'] = i[0] * max_slice
df.loc[row_index, 'end'] = (i[0] + 1) * max_slice
row_index = row_index + 1
<<<<<<< HEAD
#연속구간으로 나타내기
=======
#print(df)
"""
if value >= threshold:
i = np.where(energy == value)[0]
df.loc[row_index, 'energy'] = value
df.loc[row_index, 'start'] = i[0] * max_slice
df.loc[row_index, 'end'] = (i[0] + 1) * max_slice
row_index = row_index + 1
print(df) #threshold를 넘은 구간이 저장됨
"""
#연속구간으로 나타내기
"""
temp = []
i = 0
j = 0
n = len(df) - 2
m = len(df) - 1
while (i <= n):
j = i + 1
while (j <= m):
if (df['end'][i] == df['start'][j]):
df.loc[i, 'end'] = df.loc[j, 'end']
temp.append(j)
j = j + 1
else:
i = j
break
df.drop(temp, axis=0, inplace=True)
print(df)
"""
>>>>>>> 34cff6b09a8d3e1117437cc9ed79eb6ae8313c1f
return df
......@@ -912,7 +986,26 @@ def get_video_duration(service, **kwargs):
def _js_parseInt(string):
return int(''.join([x for x in string if x.isdigit()]))
<<<<<<< HEAD
=======
"""
if __name__ == '__main__':
# When running locally, disable OAuthlib's HTTPs verification. When
# running in production *do not* leave this option enabled.
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
service = get_authenticated_service()
video_id = input('Enter a video_id: ')
comments = get_video_comments(
service, part='snippet', videoId=video_id, textFormat='plainText')
video_duration = get_video_duration(
service, part='contentDetails', id=video_id)
# print(video_duration)
# print(comments)
commentdata = make_video_timeline(comments, video_duration)
print(commentdata)
"""
>>>>>>> 34cff6b09a8d3e1117437cc9ed79eb6ae8313c1f
if __name__ == "__main__":
app = QApplication(sys.argv)
......
File mode changed