Giter Club home page Giter Club logo

Comments (2)

yasoob avatar yasoob commented on May 28, 2024

I am sorry but I am unable to understand what you want to know. Can you ask the question in a bit more detailed manner? I would love to help you out.

from youtube-dl-gui.

Zerokami avatar Zerokami commented on May 28, 2024

I want to save the ongoing/downloading links, directory, quality options in a list.

I want resume functionality of qutting the app.

i.e if the app is closed I want to resume un-finished downloads when the program is opened again.

def download_url(self, url,  row = None, by_user = True, directory = os.getcwd(), quality = False):
        if row >= 0:
            row = row
        elif row is None:
            row = self.rowcount

#My code start
        if by_user == True:
            directory = str(self.ui.saveToLineEdit.text())
            quality = False
            if self.ui.ConvertCheckBox.isChecked():
                quality = str(self.ui.ConvertComboBox.currentText())
           print row, self.rowcount
        else:
            pass
        options = {
            'url': url,
            'directory': directory,
            'rowcount': row,
            'proxy': '',
            'convert_format': quality,
            'parent':self,
        }

#My code for adding to resume list and writing to json for storage.
       opt_list.append(options)

        with f as open('links_to_resume.json', 'w'):
            json.dump(f)

        print(opt_list)
#My code end

        if not self.ui.DeleteFileCheckBox.isChecked():
            options['keep_file'] = True


        self.thread_pool['thread{}'.format(row)] = Download(options)
        self.thread_pool['thread{}'.format(row)].status_bar_signal.connect(self.ui.statusbar.showMessage)
        self.thread_pool['thread{}'.format(row)].remove_url_signal.connect(self.remove_url)
        self.thread_pool['thread{}'.format(row)].add_update_list_signal.connect(self.add_to_table)
        self.thread_pool['thread{}'.format(row)].remove_row_signal.connect(self.decrease_rowcount)
        self.thread_pool['thread{}'.format(row)].start()

        self.ui.tabWidget.setCurrentIndex(2)
        self.ui.statusbar.showMessage('Extracting information..')

        self.url_list.append(url)
        self.complete_url_list[row] = url

        self.rowcount += 1

        if len(self.url_list) is not 0:
            if len(self.url_list) < 2:
                self.ui.statusbar.showMessage('Downloading {0} file'.format(len(self.url_list)))
            else:
                self.ui.statusbar.showMessage('Downloading {0} files'.format(len(self.url_list)))
        else:
self.ui.statusbar.showMessage("done")


On boot the Youtube-DL-GUI app loads a list of dictionaries of download options like URL, Location, Qulaity.

opt_list = []
with f as open('links_to_resume.json', 'r'):
    opt_list = json.load(f)
    print(opt_list)
print(['{'url' : 'https://www.youtube.com/watch?v=U1fRcfcj5To', 'directory': '/home/use/logmytech#>/youtube', 'convert_format': '720p'}', {'url' : 'https://www.youtube.com/watch?v=_NXrTujMP50',
'location': '/home/use/logmytech/youtube', 'convert_format': '720p'}']) # prints this

def resume_links(opt_list):
    for i in opt_list:
        download_url(self, i['url'],  row = None, by_user = Flase, directory = i['directory'], quality = False) 

resume_links(opt_list)



from youtube-dl-gui.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.