Example #1
0
def store_pack_data(subtitle, data):
    subtitle_id = get_pack_id(subtitle)

    archive = os.path.join(config.pack_cache_dir, subtitle_id + ".archive")

    Log.Info("Storing archive in pack cache: %s", subtitle_id)
    try:
        FileIO.write(archive, data, 'wb')

    except:
        Log.Error("Couldn't store archive in pack cache: %s: %s", subtitle_id, traceback.format_exc())
Example #2
0
def store_pack_data(subtitle, data):
    subtitle_id = get_pack_id(subtitle)

    archive = os.path.join(config.pack_cache_dir, subtitle_id + ".archive")

    Log.Info("Storing archive in pack cache: %s", subtitle_id)
    try:
        FileIO.write(archive, data, 'wb')

    except:
        Log.Error("Couldn't store archive in pack cache: %s: %s", subtitle_id, traceback.format_exc())
Example #3
0
    def getVersion(self):
	curDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
	info_file_path = os.path.abspath(os.path.join(curDir, "..", "..", "Info.plist"))
	data = FileIO.read(info_file_path)
	result = VERSION_RE.search(data)
	if result:
	    return result.group(1)
Example #4
0
 def getVersion(self):
     curDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
     info_file_path = os.path.abspath(os.path.join(curDir, "..", "..", "Info.plist"))
     data = FileIO.read(info_file_path)
     result = VERSION_RE.search(data)
     if result:
         return result.group(1)
Example #5
0
    def get_advanced_config(self):
        path = os.path.join(config.data_path, "advanced_settings.json")
        if os.path.isfile(path):
            data = FileIO.read(path, "r")

            return Dicked(**jstyleson.loads(data))

        return Dicked()
Example #6
0
def get_pack_data(subtitle):
    subtitle_id = get_pack_id(subtitle)

    archive = os.path.join(config.pack_cache_dir, subtitle_id + ".archive")
    if os.path.isfile(archive):
        Log.Info("Loading archive from pack cache: %s", subtitle_id)
        try:
            data = FileIO.read(archive, 'rb')

            return data
        except:
            Log.Error("Couldn't load archive from pack cache: %s: %s", subtitle_id, traceback.format_exc())
Example #7
0
def get_pack_data(subtitle):
    subtitle_id = get_pack_id(subtitle)

    archive = os.path.join(config.pack_cache_dir, subtitle_id + ".archive")
    if os.path.isfile(archive):
        Log.Info("Loading archive from pack cache: %s", subtitle_id)
        try:
            data = FileIO.read(archive, 'rb')

            return data
        except:
            Log.Error("Couldn't load archive from pack cache: %s: %s", subtitle_id, traceback.format_exc())
Example #8
0
def DownloadLogs():
    buff = StringIO.StringIO()
    zip_archive = ZipFile(buff, mode='w', compression=ZIP_DEFLATED)

    logs = sorted(glob.glob(config.plugin_log_path + '*')) + [config.server_log_path]
    for path in logs:
        data = StringIO.StringIO()
        data.write(FileIO.read(path))
        zip_archive.writestr(os.path.basename(path), data.getvalue())

    zip_archive.close()

    return ZipObject(buff.getvalue())
Example #9
0
def DownloadLogs():
    buff = StringIO.StringIO()
    zip_archive = ZipFile(buff, mode='w', compression=ZIP_DEFLATED)

    logs = sorted(glob.glob(config.plugin_log_path + '*')) + [config.server_log_path]
    for path in logs:
        data = StringIO.StringIO()
        data.write(FileIO.read(path))
        zip_archive.writestr(os.path.basename(path), data.getvalue())

    zip_archive.close()

    return ZipObject(buff.getvalue())
Example #10
0
    def get_advanced_config(self):
        paths = []
        if Prefs['path_to_advanced_settings']:
            paths = [
                Prefs['path_to_advanced_settings'],
                os.path.join(Prefs['path_to_advanced_settings'], "advanced_settings.json")
            ]

        paths.append(os.path.join(config.data_path, "advanced_settings.json"))

        for path in paths:
            if os.path.isfile(path):
                data = FileIO.read(path, "r")

                d = Dicked(**jstyleson.loads(data))
                self.adv_cfg_path = path
                Log.Info(u"Using advanced settings from: %s", path)
                return d

        return Dicked()
Example #11
0
def DownloadLogs():
    buff = StringIO.StringIO()
    zip_archive = ZipFile(buff, mode='w', compression=ZIP_DEFLATED)
    paths = get_log_paths()
    if (paths[0] is not False) & (paths[1] is not False):
        logs = sorted(glob.glob(paths[0] + '*')) + [paths[1]]
        for path in logs:
            Log.Debug("Trying to read path: " + path)
            data = StringIO.StringIO()
            data.write(FileIO.read(path))
            zip_archive.writestr(os.path.basename(path), data.getvalue())

        zip_archive.close()

        return ZipObject(buff.getvalue())

    Log.Debug("No log path found, foo.")
    return ObjectContainer(no_cache=True,
                           title1="No logs found",
                           no_history=True,
                           view_group="Details")
Example #12
0
 def get_plugin_info(self):
     curDir = os.path.dirname(
         os.path.abspath(inspect.getfile(inspect.currentframe())))
     info_file_path = os.path.abspath(
         os.path.join(curDir, "..", "..", "Info.plist"))
     return FileIO.read(info_file_path)
Example #13
0
 def get_plugin_info(self):
     curDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
     info_file_path = os.path.abspath(os.path.join(curDir, "..", "..", "Info.plist"))
     return FileIO.read(info_file_path)