예제 #1
0
    def switch_Process(self, *varargs):
        """
        Show a panel for processing task only. 
        This is a panel that should not be instantiated at the beginning 
        of the main frame (as others) because otherwise it would immediately
        start running.
        """
        duration = self.DnD.duration[:] # the streams duration list
        
        if self.showpanelbar.IsChecked():
            self.btnpanel.Hide()# hide buttons bar if the user has shown it:

        IO_tools.process(self, varargs, 
                         self.path_log, 
                         self.panelshown, 
                         duration,
                         self.OS,
                         self.time_seq,
                         )
        #make the positioning:
        self.DnDsizer.Add(self.ProcessPanel, 1, wx.EXPAND|wx.ALL, 0)
        #Hide all others panels:
        self.DnD.Hide(), self.PrstsPanel.Hide(), self.VconvPanel.Hide()
        self.AconvPanel.Hide()
        #Show the panel:
        self.ProcessPanel.Show()
        self.Layout()
        self.SetTitle(_('..Start Encoding - Videomass'))

        self.Setup_items_bar()# call set default layout method
예제 #2
0
    def switch_Process(self, *varargs):
        """
        Show a panel for processing task only. 
        This is a panel that should not be instantiated at the beginning 
        of the main frame (as others) because otherwise it would immediately
        start running.
        """
        duration = self.DnD.duration[:]  # the streams duration list

        if self.showpanelbar.IsChecked():
            self.btnpanel.Hide()  # hide buttons bar if the user has shown it:

        IO_tools.process(
            self,
            varargs,
            self.path_log,
            self.panelshown,
            duration,
            self.OS,
            self.time_seq,
        )
        #make the positioning:
        self.DnDsizer.Add(self.ProcessPanel, 1, wx.EXPAND | wx.ALL, 0)
        #Hide all others panels:
        self.DnD.Hide(), self.PrstsPanel.Hide(), self.VconvPanel.Hide()
        self.AconvPanel.Hide()
        #Show the panel:
        self.ProcessPanel.Show()
        self.Layout()
        self.SetTitle(_('..Start Encoding - Videomass'))

        self.Setup_items_bar()  # call set default layout method
예제 #3
0
 def ImportPlay(self, filepath):
     """
     Redirect input file clicked at stream_play for playback feature.
     This feature is available by context menu in drag n drop panel only.
     """
     IO_tools.stream_play(
         filepath,
         self.time_seq,
         '',  # parameters
     )
예제 #4
0
 def ImportPlay(self):
     """
     Redirect input file clicked at stream_play for playback feature.
     This feature is available by context menu in drag n drop panel only.
     """
     filepath = self.import_clicked
     IO_tools.stream_play(filepath, 
                          self.time_seq, 
                          self.ffplay_link, 
                          self.loglevel_type, 
                          self.OS,
                          )
예제 #5
0
 def ImportPlay(self):
     """
     Redirect input file clicked at stream_play for playback feature.
     This feature is available by context menu in drag n drop panel only.
     """
     filepath = self.import_clicked
     IO_tools.stream_play(
         filepath,
         self.time_seq,
         self.ffplay_link,
         self.loglevel_type,
         self.OS,
     )
예제 #6
0
 def ImportInfo(self, event):
     """
     Redirect input file clicked at stream_info for metadata display
     """
     filepath = self.import_clicked
     if not filepath:
         wx.MessageBox(_("No file selected into Drag and Drop list"), 
                       'Videomass', wx.ICON_EXCLAMATION, self)
         return
     title = 'Metadata of selected media - Videomass'
     IO_tools.stream_info(title, 
                          filepath, 
                          self.ffprobe_link,
                          )
예제 #7
0
 def ImportInfo(self, event):
     """
     Redirect input file clicked at stream_info for metadata display
     """
     filepath = self.import_clicked
     if not filepath:
         wx.MessageBox(_("No file selected into Drag and Drop list"),
                       'Videomass', wx.ICON_EXCLAMATION, self)
         return
     title = 'Metadata of selected media - Videomass'
     IO_tools.stream_info(
         title,
         filepath,
         self.ffprobe_link,
     )
예제 #8
0
 def on_Selected(self, event):
     """
     Gets output given ffmpeg -*topic* and set textctrl.
     The topic options are values of the dicdef dictionary.
     """
     dicdef = {"--":'None',
               _("print basic options"): ['-h'],
               _("print more options"):['-h', 'long'],
               _("print all options (very long)"):['-h','full'],
               _("show available devices"):['-devices'],
               _("show available bit stream filters"):['-bsfs'],
               _("show available protocols"):['-protocols'],
               _("show available filters"):['-filters'],
               _("show available pixel formats"):['-pix_fmts'],
               _("show available audio sample formats"):['-sample_fmts'],
               _("show available color names"):['-colors'],
               _("list sources of the input device"):['-sources', 'device'],
               _("list sinks of the output device"):['-sinks', 'device'],
               _("show available HW acceleration methods"):['-hwaccels'],
               }
     if "None" in dicdef[self.cmbx_choice.GetValue()]:
         self.row = None
         self.texthelp.Clear()# reset textctrl
     else:
         self.texthelp.Clear()# reset textctrl
         topic = dicdef[self.cmbx_choice.GetValue()]
         out = IO_tools.findtopic(topic)
         self.row = out
         if self.row:
             self.texthelp.AppendText(self.row)
         else:
             self.texthelp.AppendText(_("\n  ..Nothing available"))
예제 #9
0
    def ExportPlay(self, event):
        """
        Playback functionality for exported files, useful for result 
        testing. The first one exported of the list will be reproduced.
        """
        if not self.post_process:
            wx.MessageBox(_("No files exported with `Start Encoding` yet"), 
                          'Videomass', wx.ICON_EXCLAMATION, self)
            return

        IO_tools.stream_play(self.post_process,
                             '', 
                             self.ffplay_link, 
                             self.loglevel_type,
                             self.OS,
                             )
예제 #10
0
    def dropUpdate(self, path):
        """
        Update list-control and fileList during drag and drop.
        Also, enable certain buttons of the MainFrame toolbar
        and advise with status bar messages
        """
        if os.path.isdir(path):
            mess = _("Directories/folders are not accepted: > '%s'") % path
            print(mess)
            self.parent.statusbar_msg(mess, orange)
            self.invalid = True
            return

        if path not in self.fileList:
            self.invalid = False
            self.fileList.append(path)
            self.InsertItem(self.index, path)
            self.index += 1
            s = IO_tools.probeDuration(path, self.ffprobe_link)
            duration.append(s[0])
            if s[1]:
                if s[1] == 'N/A':
                    msg = "%s; %s" % (s[1], _('duration is skipped'))
                    self.parent.statusbar_msg(msg, greenolive)
                else:
                    self.parent.statusbar_msg(s[1], red)
        else:
            mess = _("Duplicate files are not accepted: > '%s'") % path
            print(mess)
            self.parent.statusbar_msg(mess, yellow)
예제 #11
0
 def dropUpdate(self, path):
     """
     Update list-control during drag and drop
     
     """
     msg_dir = _("Directories are not allowed, just add files, please.")
     
     if os.path.isdir(path):
         self.parent.statusbar_msg(msg_dir, orange)
         return
     
     if not [x for x in data_files if x['format']['filename'] == path]:
         data = IO_tools.probeInfo(path)
     
         if data[1]:
             self.parent.statusbar_msg(data[1], red)
             return
         
         data = eval(data[0])
         self.InsertItem(self.index, path)
         self.index += 1
         if not 'duration' in data['format'].keys():
             data['format']['duration'] = 0
         else:
             data.get('format')['time'] = data.get('format').pop('duration')
             t = time_seconds(data.get('format')['time'])
             data['format']['duration'] = t
         data_files.append(data)
         self.parent.statusbar_msg('', None)
         
     else:
         mess = _("Duplicate files are rejected: > '%s'") % path
         self.parent.statusbar_msg(mess, yellow)
예제 #12
0
 def dropUpdate(self, path):
     """
     Update list-control and fileList during drag and drop.
     Also, enable certain buttons of the MainFrame toolbar
     and advise with status bar messages
     """
     if os.path.isdir(path):
         mess = _("Directories/folders are not accepted: > '%s'") % path
         print (mess)
         self.parent.statusbar_msg(mess, orange)
         self.invalid = True
         return
     
     if path not in self.fileList:
         self.invalid = False
         self.fileList.append(path)
         self.InsertItem(self.index, path)
         self.index += 1
         s = IO_tools.probeDuration(path, self.ffprobe_link)
         duration.append(s[0])
         if s[1]:
             if s[1] == 'N/A':
                 msg = "%s; %s" %(s[1],_('duration is skipped'))
                 self.parent.statusbar_msg(msg, greenolive)
             else:
                 self.parent.statusbar_msg(s[1], red)
     else:
         mess = _("Duplicate files are not accepted: > '%s'") % path
         print (mess)
         self.parent.statusbar_msg(mess, yellow)
예제 #13
0
    def ExportPlay(self, event):
        """
        Playback functionality for exported files, useful for result 
        testing. The first one exported of the list will be reproduced.
        """
        if not self.post_process:
            wx.MessageBox(_("No files exported with `Start Encoding` yet"),
                          'Videomass', wx.ICON_EXCLAMATION, self)
            return

        IO_tools.stream_play(
            self.post_process,
            '',
            self.ffplay_link,
            self.loglevel_type,
            self.OS,
        )
예제 #14
0
    def ExportPlay(self, event):
        """
        Playback with FFplay
        
        """
        with wx.FileDialog(
                self,
                "Videomass: Open a file to playback",
                defaultDir=self.file_destin,
                #wildcard="Audio source (%s)|%s" % (f, f),
                style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as fileDialog:

            if fileDialog.ShowModal() == wx.ID_CANCEL:
                return
            pathname = fileDialog.GetPath()

        IO_tools.stream_play(
            pathname,
            '',  # time_seq is useless for the exported file
            '',  # no others parameters are needed
        )
예제 #15
0
    def parse_info(self):
        """
        Data parsing from youtube-dl extract_info. This method should 
        also populate the listctrl and fill the self.info list.

        If meta[1] is None, sets self.info attribute with dict objetc 
        items and return error=False. Otherwise self.info is a empty 
        list and return error=True. 
        """
        index = 0
        if not self.info:
            self.txt_code.Clear()
            self.parent.statusbar_msg(_("wait... I'm getting the data"),
                                      'GOLDENROD')
            for link in self.parent.data:
                data = IO_tools.youtube_info(link)
                for meta in data:
                    if meta[1]:
                        self.parent.statusbar_msg('Youtube Downloader', None)
                        wx.MessageBox(meta[1], 'youtube_dl ERROR',
                                      wx.ICON_ERROR)
                        self.info, self.error = [], True
                        return self.error
                    if 'entries' in meta[0]:
                        meta[0]['entries'][0]  # not parse all playlist
                    ftime = '%s (%s sec.)' % (time_human(
                        meta[0]['duration']), meta[0]['duration'])
                    date = '%s/%s/%s' % (meta[0]['upload_date'][:4],
                                         meta[0]['upload_date'][4:6],
                                         meta[0]['upload_date'][6:8])
                    self.info.append({
                        'url':
                        link,
                        'title':
                        meta[0]['title'],
                        'categories':
                        meta[0]['categories'],
                        'license':
                        meta[0]['license'],
                        'format':
                        meta[0]['format'],
                        'upload_date':
                        date,
                        'uploader':
                        meta[0]['uploader'],
                        'view':
                        meta[0]['view_count'],
                        'like':
                        meta[0]['like_count'],
                        'dislike':
                        meta[0]['dislike_count'],
                        'average_rating':
                        meta[0]['average_rating'],
                        'id':
                        meta[0]['id'],
                        'duration':
                        ftime,
                        'description':
                        meta[0]['description'],
                    })
                    self.fcode.InsertItem(index, meta[0]['title'])
                    self.fcode.SetItem(index, 1, link)
                    self.fcode.SetItemBackgroundColour(index, 'GREEN')

                    formats = meta[0].get('formats', [meta[0]])
                    for f in formats:
                        index += 1
                        if f['vcodec'] == 'none':
                            vcodec = ''
                            fps = ''
                        else:
                            vcodec = f['vcodec']
                            fps = '%sfps' % f['fps']
                        if f['acodec'] == 'none':
                            acodec = 'Video only'
                        else:
                            acodec = f['acodec']
                        if f['filesize']:
                            size = format_bytes(float(f['filesize']))
                        else:
                            size = ''

                        self.fcode.InsertItem(index, '')
                        self.fcode.SetItem(index, 1, '')
                        self.fcode.SetItem(index, 2, f['format_id'])
                        self.fcode.SetItem(index, 3, f['ext'])
                        self.fcode.SetItem(index, 4, f['format'].split('-')[1])
                        self.fcode.SetItem(index, 5, vcodec)
                        self.fcode.SetItem(index, 6, fps)
                        self.fcode.SetItem(index, 7, acodec)
                        self.fcode.SetItem(index, 8, size)

            self.txt_code.WriteText(f['format_id'])
        self.parent.statusbar_msg(_('Ready, Youtube Downloader'), None)

        return self.error
예제 #16
0
 def Check_conf(self, event):
     """
     Call IO_tools.test_conf
     
     """
     IO_tools.test_conf()
예제 #17
0
 def Check_formats(self, event):
     """
     IO_tools.test_formats
     
     """
     IO_tools.test_formats()
예제 #18
0
 def Openconf(self, event):
     """
     Open the configuration folder with file manager
     
     """
     IO_tools.openpath('dirconf')
예제 #19
0
 def Openlog(self, event):
     """
     Open the log diretctory with file manager
     
     """
     IO_tools.openpath('openlog')
예제 #20
0
 def Check_dec(self, event):
     """
     IO_tools.test_encoders
     
     """
     IO_tools.test_codecs('-decoders')