2
# -*- coding: utf-8 -*-
4
# Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd
5
# This program is free software: you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 3, as published
7
# by the Free Software Foundation.
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY; without even the implied warranties of
11
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12
# PURPOSE. See the GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License along
15
# with this program. If not, see <http://www.gnu.org/licenses/>.
19
from xml.etree import ElementTree
21
class SystemHistory():
25
def scan_the_xml(self, homedir):
27
xml_path = '%s/.local/share/' % homedir
29
xml_path = os.path.expanduser('~/.local/share/')
31
full_path = xml_path + 'recently-used.xbel'
33
tree = ElementTree.parse(full_path)
34
nodes = tree.findall("bookmark")
37
hreflist.append(node.get('href'))
41
def clean_the_xml(self, homedir):
42
xml_path = '%s/.local/share/' % homedir
43
full_path = xml_path + 'recently-used.xbel'
45
tree = ElementTree.parse(full_path)
49
tree.write(full_path, encoding="UTF-8", xml_declaration=None, default_namespace=None, method="xml")