Subversion Repositories basico

Rev

Rev 353 | Rev 356 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 353 Rev 355
Line 8... Line 8...
8
"""
8
"""
9
9
10
import os
10
import os
11
import re
11
import re
12
import sys
12
import sys
-
 
13
import json
13
import subprocess
14
import subprocess
14
import tarfile
15
import tarfile
15
import zipfile
16
import zipfile
16
import shutil
17
import shutil
17
import requests
18
import requests
18
import webbrowser
19
import webbrowser
19
import feedparser
20
import feedparser
20
from datetime import datetime
21
from datetime import datetime
21
from basico.core.mod_env import GPATH, LPATH
-
 
-
 
22
from basico.core.mod_env import GPATH, LPATH, FILE
22
from basico.core.mod_srv import Service
23
from basico.core.mod_srv import Service
23
24
24
class Utils(Service):
25
class Utils(Service):
25
    """
26
    """
26
    Missing class docstring (missing-docstring)
27
    Missing class docstring (missing-docstring)
Line 29... Line 30...
29
    def initialize(self):
30
    def initialize(self):
30
        """
31
        """
31
        Missing method docstring (missing-docstring)
32
        Missing method docstring (missing-docstring)
32
        """
33
        """
33
        self.get_services()
34
        self.get_services()
-
 
35
        self.load_extensions()
-
 
36
-
 
37
-
 
38
    def load_extensions(self):
-
 
39
        with open(FILE['EXT'], 'r') as fext:
-
 
40
            self.extensions = json.load(fext)
-
 
41
            self.log.debug("%d extensions loaded", len(self.extensions))
34
42
35
43
36
    def get_services(self):
44
    def get_services(self):
37
        """
45
        """
38
        Missing method docstring (missing-docstring)
46
        Missing method docstring (missing-docstring)
39
        """
47
        """
40
        self.srvdtb = self.get_service('DB')
48
        self.srvdtb = self.get_service('DB')
-
 
49
-
 
50
-
 
51
    def get_file_description(self, ext):
-
 
52
        try:
-
 
53
            filetype, description = self.extensions[ext]
-
 
54
            return description
-
 
55
        except:
-
 
56
            return None
41
57
42
58
43
    def get_disk_usage(self, path):
59
    def get_disk_usage(self, path):
44
        """
60
        """
45
        Get disk usage for a given path
61
        Get disk usage for a given path