示例#1
0
文件: gui.py 项目: Letractively/vdown
 def swindow_close_clicked(
                           self,
                           widget
                          ):
     sfcb = self.wTree.get_widget("sfcb")
     swindow = self.wTree.get_widget("settingswindow")
     convertcmdentry = self.wTree.get_widget("convertcmdentry")
     convertbutton = self.wTree.get_widget("convertbutton")
     fextension_entry = self.wTree.get_widget("fextension_entry")
     deletesourcefilebutton = self.wTree.get_widget("deletesourcefilebutton")
     outputdir = sfcb.get_filename()
     if convertbutton.get_active():
         self.config.set(
                         "general",
                         "convert",
                         "yes"
                        )
     else:
         self.config.set(
                         "general",
                         "convert",
                         "no"
                        )
     convertcmd = convertcmdentry.get_text()
     self.config.set(
                     "general",
                     "convertcmd",
                     convertcmd
                    )
     self.config.set(
                     "general",
                     "convert_filename_extension",
                     fextension_entry.get_text()
                    )
     deletesourcefile = deletesourcefilebutton.get_active()
     if deletesourcefile:
         self.config.set(
                         "general",
                         "delete_source_file_after_converting",
                         "yes"
                        )
     else:
         self.config.set(
                         "general",
                         "delete_source_file_after_converting",
                         "no"
                        )
     self.config.write_config()
     if not folder_is_writable(outputdir):
         print _("Cannot write to video output folder. Choose another.")
     else:
         self.config.set(
                         "general",
                         "save_videos_in",
                         outputdir
                        )
         self.config.write_config()
         swindow.hide()
示例#2
0
文件: gui.py 项目: Letractively/vdown
    def __init__(self):
        self.wTree = gtk.glade.XML(gladefile)
        dic = {
               "closedSomehow" : self.closedSomehow,
               "download_single" : self.download_single,
               "menu_help_info_clicked" : self.menu_help_info_clicked,
               "on_aboutdialog_delete" : self.on_aboutdialog_delete,
               "menu_file_open_clicked" : self.menu_file_open_clicked,
               "fc_open_file_clicked" : self.fc_open_clicked,
               "fc_cancel_clicked" : self.fc_cancel_clicked,
               "on_filechooserdialog_delete" : self.on_filechooserdialog_delete,
               "menu_file_settings_clicked" : self.menu_file_settings_clicked,
               "on_swindow_delete" : self.on_swindow_delete,
               "swindow_close_clicked" : self.swindow_close_clicked
              }
        self.wTree.signal_autoconnect(dic)

        self.config = configuration()
        self.config.readconfig()

        self.listdownloading = False

        if not os.path.isdir(
                             self.config.get(
                                             "general",
                                             "save_videos_in"
                                            )
                            ):
            try:
                os.mkdir(
                         self.config.get(
                                         "general",
                                         "save_videos_in"
                                        )
                        )
            except OSError:
                print _("Could not create the directory where the videos shall be saved in (specified in %(configfile)s)! Check permissions.") % {"configfile" : os.path.join(
                             userhome,
                             ".gvdownrc"
                            ) }
                sys.exit(1)
        if not folder_is_writable(
                                  self.config.get(
                                                  "general",
                                                  "save_videos_in"
                                                 )
                                 ):
            print _("Cannot write to video output directoy! Check permissions or change the directory in %(configfile)s") % {"configfile" : os.path.join(userhome, ".gvdownrc")}
            sys.exit(1)
示例#3
0
文件: cli.py 项目: Letractively/vdown
                  metavar="DEST",
                  default="."
                 )

parser.add_option(
                  "-s",
                  "--save-as",
                  dest="saveAs",
                  help=_("save video file as FILE"),
                  metavar="FILE",
                  default=None
                 )

(options, args) = parser.parse_args()

if not folder_is_writable(options.destination):
    print _("Can't write to this directory! Change to another.")
    sys.exit(1)

config = configuration()
config.readconfig()

if len(args) < 1:
    print _("Specify at least one video.")
    sys.exit(1)

for i in args:

    print "----"
    print _("Trying to download the video...")
    print _("URL: %(url)s") % {"url" : i}