X-Git-Url: http://git.maemo.org/git/?p=remotepc;a=blobdiff_plain;f=pcremote-server-desktop-60%2Fdebian%2Fpcremote-server%2Fusr%2Fshare%2Fpcremote-server%2Futils%2F.svn%2Ftext-base%2Fplistparser.py.svn-base;fp=pcremote-server-desktop-60%2Fdebian%2Fpcremote-server%2Fusr%2Fshare%2Fpcremote-server%2Futils%2F.svn%2Ftext-base%2Fplistparser.py.svn-base;h=faaa0ac17b89c6053eb796986ff1b901564e4edc;hp=0000000000000000000000000000000000000000;hb=8eeea3225c010dea378cdc71c4e91294e04a6e9c;hpb=e8447209e336f2a6845027f50b84cc914fa2c796 diff --git a/pcremote-server-desktop-60/debian/pcremote-server/usr/share/pcremote-server/utils/.svn/text-base/plistparser.py.svn-base b/pcremote-server-desktop-60/debian/pcremote-server/usr/share/pcremote-server/utils/.svn/text-base/plistparser.py.svn-base new file mode 100755 index 0000000..faaa0ac --- /dev/null +++ b/pcremote-server-desktop-60/debian/pcremote-server/usr/share/pcremote-server/utils/.svn/text-base/plistparser.py.svn-base @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +# **************************************************************************** +# Copyright (c) 2008 INdT/Fucapi. +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +# ============================================================================ +# Project Name : PC Remote +# Author : Jonatas Isvi +# Email : jonatas.nona@gmail.com +# Reviewer : +# Email : +# Version : 1.0 +# Package : utils +# Description : plisparser +# ============================================================================ + +from xml.etree import cElementTree as ElementTree + +# get the file +def _request(url): + xml = url + return parse_playlist_file(xml) + +# parser the file +def parse_playlist_file(xml): + tree = ElementTree.parse(xml) + listsongs = [] + dictsongs = {} + count = duration = filesize = 0 + title = artist = path = '' + + for child in tree.getiterator(): + if child.tag == 'Title': + title = child.text + elif child.tag == 'Artist': + artist = child.text + elif child.tag == 'Length': + duration = child.text + elif child.tag == 'Filesize': + filesize = child.text + count = count + 1 + dictsongs = {'track' : count, + 'title' : title, + 'artist' : artist, + 'duration' : duration, + 'filesize' : filesize, + 'path' : None, + 'extension' : None, + } + listsongs.append(dictsongs) + + return listsongs + + + + + + + +