File size: 1,653 Bytes
6309782
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from mainLogic.big4.dl import DL
from mainLogic.startup.checkup import CheckState
from mainLogic.utils.glv import Global
from mainLogic.main import Main
from beta.shellLogic import simpleParser


class HandleShellDL:

    def __init__(self):
        self.commandList = {
            "edl":{
                "func": self.edownload
            },
            "dl":{
                "func": self.download
            }
        }

    def edownload(self,args=[]):
        # print(args)
        if not args or len(args) < 2:
            print("Please provide a name and id")
            return

        name = args[0]
        id = args[1]

        dl = DL()
        ch =CheckState()
        prefs = ch.checkup(Global.EXECUTABLES,verbose=False)
        dl.downloadAudioAndVideo(name=name,
                                 id=id,
                                 directory='./',
                                 nm3Path=prefs['nm3'],
                                 verbose=False if not 'verbose' in prefs else prefs['verbose'],
                                 )

    def download(self,args=[]):
        if not args or len(args) < 2:
            print("Please provide a name and id")
            return

        name = args[0]
        id = args[1]

        ch = CheckState()
        prefs = ch.checkup(Global.EXECUTABLES,verbose=False)

        Main(id=id,
             name=name,
             directory='./',
             nm3Path=prefs['nm3'],
             mp4d=prefs['mp4decrypt'],
             ffmpeg=prefs['ffmpeg']
             ).process()



    def parseAndRun(self,command,args=[]):
        simpleParser.parseAndRun(self.commandList, command, args)