Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e252563

Browse files
committed
Switch to Python 3 using 2to3
1 parent 064aa52 commit e252563

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

pygource.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,22 @@ def choose_background_song(self):
7070

7171
def process_project(self, path: str, name: str):
7272

73-
print "=" * 42
74-
print "Processing project '%s'" % name
75-
print "=" * 42
73+
print("=" * 42)
74+
print("Processing project '%s'" % name)
75+
print("=" * 42)
7676

7777
video_file = self.create_video(path, self.output_path, name)
7878
if not video_file:
79-
print "ERROR: video could not be created"
79+
print("ERROR: video could not be created")
8080
return False
8181

8282
mi = MediaInfo(video_file)
8383
if 'video' in mi.get_streams():
84-
print "INFO: Video: ", video_file
85-
print "INFO: Duration: ", mi.duration
84+
print("INFO: Video: ", video_file)
85+
print("INFO: Duration: ", mi.duration)
8686

8787
else:
88-
print "ERROR: video '%s' could not be recorded" % video_file
88+
print("ERROR: video '%s' could not be recorded" % video_file)
8989
os.unlink(video_file)
9090
video_file = None
9191
return False
@@ -96,20 +96,20 @@ def create_video(self, project_path, video_path, video_filename):
9696

9797
vr = VideoRecorder(video_path, video_filename)
9898
if vr.exists() and not self.overwrite:
99-
print "INFO: Video exists and --overwrite is not given, will skip further processing."
99+
print("INFO: Video exists and --overwrite is not given, will skip further processing.")
100100
return vr.get_video_file()
101101

102102
background_song = self.choose_background_song()
103103
if background_song:
104104
audio_source = self.loop_audio(background_song, self.audio_loops)
105105

106-
print "-" * 42
107-
print "Creating video '%s'" % vr.get_video_file()
106+
print("-" * 42)
107+
print("Creating video '%s'" % vr.get_video_file())
108108
cd_cmd = 'cd "%s"' % project_path
109109
run_cmd = self.get_gource_command(title = video_filename) + ' | ' + vr.get_command()
110110
cmd = cd_cmd + '; ' + run_cmd
111-
print "command:", cmd
112-
print "-" * 42
111+
print("command:", cmd)
112+
print("-" * 42)
113113

114114
if self.run_command(cmd):
115115
video_file = vr.get_video_file()
@@ -125,7 +125,7 @@ def run_command(self, command):
125125
if returncode == 0:
126126
return True
127127
else:
128-
print "ERROR while executing command '%s'" % command
128+
print("ERROR while executing command '%s'" % command)
129129
return False
130130

131131
def loop_audio(self, audio_source, times = 2):
@@ -167,7 +167,7 @@ def __init__(self, mediafile):
167167

168168
def read_info(self):
169169
cmd = "ffprobe -i '%s'" % self.mediafile
170-
print "MediaInfo ffmpeg command:", cmd
170+
print("MediaInfo ffmpeg command:", cmd)
171171
output = subprocess.check_output(shlex.split(cmd), stderr=subprocess.STDOUT)
172172
#print "MediaInfo output:", output
173173
self.raw = output
@@ -231,7 +231,7 @@ def run(self):
231231
extension = os.path.splitext(self.video_file)[1]
232232
tmpfile = self.video_file + '.tmp' + extension
233233
cmd = "ffmpeg -y -i '%s' -i '%s' -vcodec copy -acodec copy -async 1 -shortest '%s'" % (self.video_file, self.audio_file, tmpfile)
234-
print "VideoAudioMixer ffmpeg command:", cmd
234+
print("VideoAudioMixer ffmpeg command:", cmd)
235235
output = subprocess.check_output(shlex.split(cmd), stderr=subprocess.STDOUT)
236236
#print "VideoAudioMixer ffmpeg output:", output
237237
shutil.move(tmpfile, self.video_file)
@@ -240,7 +240,7 @@ def run(self):
240240
def render_all():
241241
"""Renders all projects' vcs repositories"""
242242

243-
print "Rendering project history of all projects using 'gource'"
243+
print("Rendering project history of all projects using 'gource'")
244244
source_path = sys.argv[1]
245245
target_path = sys.argv[2]
246246

@@ -274,18 +274,18 @@ def render_single():
274274
(options, args) = parser.parse_args()
275275

276276
if not options.path:
277-
print "ERROR: Option '--path' is mandatory!"
277+
print("ERROR: Option '--path' is mandatory!")
278278
sys.exit(1)
279279

280280
options.path = os.path.abspath(options.path)
281281
if not os.path.isdir(options.path):
282-
print "ERROR: Directory '%s' does not exist" % options.path
282+
print("ERROR: Directory '%s' does not exist" % options.path)
283283
sys.exit(1)
284284

285285
if not options.name:
286286
options.name = os.path.basename(options.path)
287287

288-
print "Rendering project history of single project '%s <%s>' using 'gource'" % (options.name, options.path)
288+
print("Rendering project history of single project '%s <%s>' using 'gource'" % (options.name, options.path))
289289
source_path = sys.argv[1]
290290
target_path = sys.argv[2]
291291
gr = GourceRenderer(source_path, target_path, overwrite = options.overwrite, audio_source = options.audio_source, audio_loops = options.audio_loops, time_lapse = options.time_lapse)

0 commit comments

Comments
 (0)