Added support for preview the conversion
Now allows to choose how many cores to use during conversion
This commit is contained in:
parent
70fadeef22
commit
cba0352d33
14 changed files with 334 additions and 92 deletions
|
|
@ -5,7 +5,6 @@
|
|||
<object class="GtkTextBuffer" id="debug_buffer"/>
|
||||
<object class="GtkDialog" id="dialog_error">
|
||||
<property name="width_request">640</property>
|
||||
<property name="height_request">240</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center</property>
|
||||
|
|
@ -53,8 +52,9 @@
|
|||
<property name="label" translatable="yes">There was an error while creating the disc.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">31</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="height_request">200</property>
|
||||
<property name="height_request">240</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
|
|
|
|||
|
|
@ -174,22 +174,6 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Original video rate (Kbits/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -217,48 +201,6 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Original audio rate (Kbits/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="original_videorate">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="original_audiorate">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -344,6 +286,64 @@
|
|||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="original_audiorate">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="original_videorate">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Original audio rate (Kbits/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="margin_left">8</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Original video rate (Kbits/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -1025,7 +1025,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="size_720x480_ntsc">
|
||||
<object class="GtkRadioButton" id="size_720x480">
|
||||
<property name="label" translatable="yes">720x480</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1042,7 +1042,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="size_704x480_ntsc">
|
||||
<object class="GtkRadioButton" id="size_704x480">
|
||||
<property name="label" translatable="yes">704x480</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1059,7 +1059,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="size_480x480_ntsc">
|
||||
<object class="GtkRadioButton" id="size_480x480">
|
||||
<property name="label" translatable="yes">480x480</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1076,7 +1076,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="size_352x480_ntsc">
|
||||
<object class="GtkRadioButton" id="size_352x480">
|
||||
<property name="label" translatable="yes">352x480</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
@ -1093,7 +1093,7 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="size_352x240_ntsc">
|
||||
<object class="GtkRadioButton" id="size_352x240">
|
||||
<property name="label" translatable="yes">352x240</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
|
|
|
|||
|
|
@ -357,6 +357,7 @@
|
|||
<property name="receives_default">True</property>
|
||||
<property name="yalign">0.4699999988079071</property>
|
||||
<property name="image_position">top</property>
|
||||
<signal name="clicked" handler="on_preview_file_clicked" swapped="no"/>
|
||||
<child>
|
||||
<object class="GtkBox" id="box11">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
|||
131
data/interface/wpreview.ui
Normal file
131
data/interface/wpreview.ui
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.16.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkAdjustment" id="length">
|
||||
<property name="lower">10</property>
|
||||
<property name="upper">1000</property>
|
||||
<property name="value">60</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkDialog" id="dialog_preview">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Preview video</b>
|
||||
|
||||
Devede will create a preview with the selected parameters, so you will be able to check the video quality, audio sync and so on.</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="wrap">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Preview length:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="spinbutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="adjustment">length</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button1</action-widget>
|
||||
<action-widget response="1">button2</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkWindow" id="progress">
|
||||
<property name="width_request">640</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Creating...</property>
|
||||
<property name="resizable">False</property>
|
||||
|
|
@ -16,6 +17,19 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Creating disc</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">28</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="progress_frame">
|
||||
<property name="visible">True</property>
|
||||
|
|
@ -32,7 +46,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -44,7 +58,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
|
@ -60,7 +74,7 @@
|
|||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">8</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@ class avconv_converter(devede.executor.executor):
|
|||
|
||||
self.text = _("Converting %(X)s") % {"X" : file_project.title_name}
|
||||
|
||||
self.final_length = file_project.original_length
|
||||
if (video_length == 0):
|
||||
self.final_length = file_project.original_length
|
||||
else:
|
||||
self.final_length = video_length
|
||||
self.command_var=[]
|
||||
self.command_var.append("avconv")
|
||||
self.command_var.append("-i")
|
||||
|
|
|
|||
|
|
@ -110,10 +110,7 @@ class configuration(GObject.GObject):
|
|||
self.tmp_folder=linea[12:].strip()
|
||||
continue
|
||||
if linea[:10]=="multicore:":
|
||||
if linea[10:].strip()=="1":
|
||||
self.multicore = False
|
||||
else:
|
||||
self.multicore = True
|
||||
self.multicore = int(linea[10:].strip())
|
||||
continue
|
||||
if linea[:13]=="final_folder:":
|
||||
self.final_folder=linea[13:].strip()
|
||||
|
|
@ -166,11 +163,7 @@ class configuration(GObject.GObject):
|
|||
config_data.write("ntsc\n")
|
||||
if (self.tmp_folder != None):
|
||||
config_data.write("temp_folder:"+str(self.tmp_folder)+"\n")
|
||||
config_data.write("multicore:")
|
||||
if (self.multicore):
|
||||
config_data.write("0\n")
|
||||
else:
|
||||
config_data.write("1\n")
|
||||
config_data.write("multicore:"+str(self.multicore))
|
||||
if (self.final_folder != None):
|
||||
config_data.write("final_folder:"+str(self.final_folder)+"\n")
|
||||
if (self.sub_language != None):
|
||||
|
|
|
|||
|
|
@ -109,6 +109,13 @@ class converter:
|
|||
|
||||
return ( analizers, players, converters, menuers )
|
||||
|
||||
def get_film_player(self):
|
||||
""" returns a class for the desired film player, or the most priviledged if the desired is not installed """
|
||||
|
||||
if (self.config.film_player == None) or (self.players.has_key(self.config.film_player) == False):
|
||||
return self.default_player
|
||||
else:
|
||||
return self.players[self.config.film_analizer]
|
||||
|
||||
def get_film_analizer(self):
|
||||
""" returns a class for the desired film analizer, or the most priviledged if the desired is not installed """
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ class executor(GObject.GObject):
|
|||
child.add_dependency(dep)
|
||||
|
||||
def remove_dependency(self,process):
|
||||
|
||||
# dependencies are removed only in the parent because the running class have all the processes, parents and childs, and calls
|
||||
# this method on all of them
|
||||
if (self.dependencies != None):
|
||||
tmp2 = []
|
||||
for dep in self.dependencies:
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import devede.configuration_data
|
|||
import devede.interface_manager
|
||||
import devede.converter
|
||||
import devede.ask_subtitles
|
||||
import devede.preview
|
||||
|
||||
class file_movie(devede.interface_manager.interface_manager):
|
||||
|
||||
|
|
@ -42,8 +43,6 @@ class file_movie(devede.interface_manager.interface_manager):
|
|||
self.add_text("title_name", os.path.splitext(os.path.basename(file_name))[0])
|
||||
self.add_label("original_size",None)
|
||||
self.add_label("original_length",None)
|
||||
self.add_label("original_videorate",None)
|
||||
self.add_label("original_audiorate",None)
|
||||
self.add_label("original_aspect_ratio",None)
|
||||
self.add_label("original_fps",None)
|
||||
|
||||
|
|
@ -441,3 +440,25 @@ class file_movie(devede.interface_manager.interface_manager):
|
|||
converter = disc_converter()
|
||||
converter.convert_file(self,output_path,duration)
|
||||
return converter
|
||||
|
||||
def on_button_preview_clicked(self,b):
|
||||
self.do_preview()
|
||||
|
||||
def do_preview(self):
|
||||
|
||||
wpreview = devede.preview.preview_window()
|
||||
if (wpreview.run() == False):
|
||||
return
|
||||
|
||||
run_window = devede.runner.runner()
|
||||
p = self.do_conversion(os.path.join(self.config.tmp_folder,"movie_preview.mpg"),wpreview.lvalue)
|
||||
run_window.add_process(p)
|
||||
run_window.connect("done",self.preview_done)
|
||||
run_window.run()
|
||||
|
||||
def preview_done(self,o,retval):
|
||||
|
||||
if (retval == 0):
|
||||
cv = devede.converter.converter()
|
||||
disc_player = (cv.get_film_player())()
|
||||
disc_player.play_film(os.path.join(self.config.tmp_folder,"movie_preview.mpg"))
|
||||
|
|
@ -44,6 +44,17 @@ class mplayer_detector(devede.executor.executor):
|
|||
devede.executor.executor.__init__(self)
|
||||
self.config = devede.configuration_data.configuration.get_config()
|
||||
|
||||
def play_film(self,file_name):
|
||||
|
||||
command_line = ["mplayer", file_name]
|
||||
self.launch_process(command_line)
|
||||
|
||||
def process_stdout(self,data):
|
||||
return
|
||||
|
||||
def process_stderr(self,data):
|
||||
return
|
||||
|
||||
def get_film_data(self, file_name):
|
||||
""" processes a file, refered by the FILE_MOVIE movie object, and fills its
|
||||
main data (resolution, FPS, length...) """
|
||||
|
|
|
|||
46
src/devede/preview.py
Normal file
46
src/devede/preview.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Copyright 2014 (C) Raster Software Vigo (Sergio Costas)
|
||||
#
|
||||
# This file is part of DeVeDe-NG
|
||||
#
|
||||
# DeVeDe-NG is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# DeVeDe-NG is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
from gi.repository import Gtk
|
||||
import os
|
||||
import devede.configuration_data
|
||||
|
||||
class preview_window:
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self.config = devede.configuration_data.configuration.get_config()
|
||||
|
||||
def run(self):
|
||||
|
||||
builder = Gtk.Builder()
|
||||
builder.set_translation_domain(self.config.gettext_domain)
|
||||
|
||||
builder.add_from_file(os.path.join(self.config.glade,"wpreview.ui"))
|
||||
builder.connect_signals(self)
|
||||
wpreview_window = builder.get_object("dialog_preview")
|
||||
wlength = builder.get_object("length")
|
||||
|
||||
wpreview_window.show_all()
|
||||
wlength.set_value(60.0)
|
||||
retval = wpreview_window.run()
|
||||
self.lvalue = int(wlength.get_value())
|
||||
wpreview_window.destroy()
|
||||
if (retval == 1):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
|
@ -282,3 +282,10 @@ class devede_project:
|
|||
def disc_done(self,object,value):
|
||||
|
||||
self.wmain_window.show()
|
||||
|
||||
def on_preview_file_clicked(self,b):
|
||||
|
||||
(element, position, model, treeiter) = self.get_current_file()
|
||||
if (element == None):
|
||||
return
|
||||
element.do_preview()
|
||||
|
|
@ -29,10 +29,16 @@ class runner(GObject.GObject):
|
|||
GObject.GObject.__init__(self)
|
||||
|
||||
self.config = devede.configuration_data.configuration.get_config()
|
||||
if (self.config.multicore):
|
||||
self.count_cores()
|
||||
max_cores = self.count_cores()
|
||||
if (self.config.multicore > 0):
|
||||
if max_cores < self.config.multicore:
|
||||
self.cores = max_cores
|
||||
else:
|
||||
self.cores = self.config.multicore
|
||||
else:
|
||||
self.cores = 1
|
||||
self.cores = max_cores - self.config.multicore
|
||||
if (self.cores <= 0):
|
||||
self.cores = 1
|
||||
|
||||
self.proc_list = []
|
||||
self.running = 0
|
||||
|
|
@ -80,11 +86,12 @@ class runner(GObject.GObject):
|
|||
|
||||
def count_cores(self):
|
||||
|
||||
self.cores = 0
|
||||
cores = 0
|
||||
proc_file = open("/proc/cpuinfo","r")
|
||||
for line in proc_file:
|
||||
if (line.startswith("processor")):
|
||||
self.cores += 1
|
||||
cores += 1
|
||||
return cores
|
||||
|
||||
def run(self, clear_log = True):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue