1 # -*- coding: utf-8 -*-
3 # ****************************************************************************
4 # Copyright (c) 2008 INdT/Fucapi.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # ============================================================================
19 # Project Name : PC Remote
20 # Author : Jonatas Isvi
21 # Email : jonatas.nona@gmail.com
26 # Description : plisparser
27 # ============================================================================
29 from xml.etree import cElementTree as ElementTree
34 return parse_playlist_file(xml)
37 def parse_playlist_file(xml):
38 tree = ElementTree.parse(xml)
41 count = duration = filesize = 0
42 title = artist = path = ''
44 for child in tree.getiterator():
45 if child.tag == 'Title':
47 elif child.tag == 'Artist':
49 elif child.tag == 'Length':
51 elif child.tag == 'Filesize':
54 dictsongs = {'track' : count,
57 'duration' : duration,
58 'filesize' : filesize,
62 listsongs.append(dictsongs)