Exemple #1
0
    def _create_dirs(self):
        def full_path_create(p):
            tmp = p.parent
            while not tmp.exists():
                tmp.mkdir()
                tmp = tmp.parent

        self.data_dir = Path(winshell.application_data()) / \
            'Youtube Downloader'
        self.archive_dir = self.data_dir / 'archives'
        self.user_options_dir = self.data_dir / 'User Options'
        self.plist_inputs_dir = self.data_dir / 'Multi-Playlist Configs'
        self.default_config_location = self.data_dir / \
            "last_opened_options.cfg"

        full_path_create(self.data_dir)
        full_path_create(self.archive_dir)
        full_path_create(self.user_options_dir)
        full_path_create(self.plist_inputs_dir)
Exemple #2
0
import subprocess
import os
import shlex
import winshell
import sys

SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
CDRDAO_EXEC = os.path.join(SCRIPT_DIR,"cdrdao.exe")
TOC_FILE = os.path.join(winshell.application_data(),"KLAP-TOC.dat")

def scan_devices():
    cmd = [ CDRDAO_EXEC, "scanbus", "-v", "0" ]
    print cmd
    result = subprocess.check_output(cmd,stderr=subprocess.STDOUT)
    result = result.split("\n")
    lst = []
    for line in result:
        if len(line) == 0:
            continue
        chunks = line.split(":")
        deviceid = chunks[0].strip()
        devicename = chunks[1].strip()
        lst.append( (deviceid,devicename) )
    return lst
    
def read_toc(device):
    try:
        os.remove(TOC_FILE)
    except WindowsError:
        pass
    cmd = [ CDRDAO_EXEC, "read-toc", "--fast-toc", "--device", device, TOC_FILE ]
Exemple #3
0
    parser = ArgumentParser(prog="Youtube Downloader",
                            description="A simple GUI app for \
                            downloading videos and mp3s from Youtube with \
                            youtube-dl")
    parser.add_argument("-c",
                        "--config",
                        metavar="CONFIG_FILE",
                        const="EMPTY",
                        nargs='?',
                        help="The .cfg file, located in the 'User Options' \
                            folder, to load the application with")
    parser.add_argument("-l",
                        "--log",
                        metavar="LOG_FILE",
                        default=str(
                            Path(winshell.application_data()) /
                            "Youtube Downloader" / "output.log"),
                        help="The file to log stdout and stderr to")
    args = parser.parse_args()

    def full_path_create(p):
        tmp = p.parent
        while not tmp.exists():
            tmp.mkdir()
            tmp = tmp.parent

        if not p.is_dir():
            p.touch(exist_ok=True)

    filepath = Path(args.log)
    full_path_create(filepath)
Exemple #4
0
 def pipe_path(to=1):
     pipe_file = "back"
     if to != 1:
         pipe_file = "front"
     return winshell.application_data(1) + "\\pipe_" + pipe_file + ".js"
 def test_application_data(self):
     self.assert_folder_exists("application_data personal", winshell.application_data(0))
     self.assert_folder_exists("application_data common", winshell.application_data(1))