X-Git-Url: http://git.maemo.org/git/?p=remotepc;a=blobdiff_plain;f=pcremote-server-desktop%2Fdebian%2Fpcremote-server%2Fusr%2Fshare%2Fpcremote-server%2Fplayers%2F.svn%2Ftext-base%2Fplaylist.py.svn-base;fp=pcremote-server-desktop%2Fdebian%2Fpcremote-server%2Fusr%2Fshare%2Fpcremote-server%2Fplayers%2F.svn%2Ftext-base%2Fplaylist.py.svn-base;h=0000000000000000000000000000000000000000;hp=0cbc97b4a6c5907622a2e501e573f2b916e36d13;hb=e164265008086869be2d718f635900a9bf38b7dd;hpb=3885148cece97c7cd7e9e4aaa1cb51f341e53f6c diff --git a/pcremote-server-desktop/debian/pcremote-server/usr/share/pcremote-server/players/.svn/text-base/playlist.py.svn-base b/pcremote-server-desktop/debian/pcremote-server/usr/share/pcremote-server/players/.svn/text-base/playlist.py.svn-base deleted file mode 100755 index 0cbc97b..0000000 --- a/pcremote-server-desktop/debian/pcremote-server/usr/share/pcremote-server/players/.svn/text-base/playlist.py.svn-base +++ /dev/null @@ -1,161 +0,0 @@ -# -*- 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 : players -# Description : Playlist -# ============================================================================ - -import plistparser -import pydcop - -class Playlist(): - - """ Playlist - make the interpreter and manipulation - of the player playlist, creates a composite - with any player class. - """ - - # some importants variables - # analyze if file is a playlist - def __init__(self, file): - if self.isPlaylist(file): - self.file = file - self.songs = self.load() - self.currentSong = 0 - self.fix() - else: - raise("Argument is not a playlist file") - - # analyzes the file - def isPlaylist(self, file): - if not file: - return False - else: - return True - - # make a list of dicts songs - def load(self): - self.songs = plistparser._request(self.file) - return self.songs - - # get the length of the current playlist - def length(self): - return len(self.songs) - - # update the current song in songs list and return a song dict - def update(self, track, title, artist, path, ext): - self.currentSong = track - if self.songs[self.currentSong - 1]['title'] == 'Unknown Title': - self.songs[self.currentSong - 1]['title'] = title - if self.songs[self.currentSong - 1]['artist'] == 'Unknown Artist': - self.songs[self.currentSong - 1]['artist'] = artist - self.songs[self.currentSong - 1]['path'] = path - self.songs[self.currentSong - 1]['extension'] = ext - print self.songs[self.currentSong - 1] - - - # show the current song - def show_playing_now(self): - return ('TITLE: %s' % self.songs[self.currentSong - 1]['title'], \ - 'ARTIST: %s' % self.songs[self.currentSong - 1]['artist'],\ - 'TRACK: %s' % self.songs[self.currentSong - 1]['track'] - ) - - # get the current song filename if index is None - def song_filename(self, index=None): - if index == None: - return self.songs[self.currentSong-1]['title'] +" - "+\ - self.songs[self.currentSong-1]['artist'] + \ - self.songs[self.currentSong-1]['extension'] - - else: - return self.songs[index-1]['title'] +" - "+\ - self.songs[index-1]['artist'] + \ - self.songs[index-1]['extension'] - - # get thr current song filesize if index is None - def song_size(self, index=None): - if index == None: - return int(self.songs[self.currentSong-1]['filesize']) - else: - return int(self.songs[index-1]['filesize']) - - # show all songs of the playlist - def show(self): - for i in range(self.length()): - print self.songs[i]['track'], " - ", \ - self.songs[i]['title'], " | ", \ - self.songs[i]['artist'], \ - "\n" - - # fix some problems of musics tags - def fix(self): - for i in range(self.length()): - if self.songs[i]['title'] == None: - self.songs[i]['title'] = 'Unknown Title' - elif self.songs[i]['artist'] == None: - self.songs[i]['artist'] = 'Unknown Artist' - - - # get the porperties of any song of ther playlist - def song_properties(self, index=None, track=False, title=False,\ - artist=False, ext=False, filesize=False, \ - duration=False, path=False): - props = {} - if index == None: - if track: - props['track'] = self.songs[self.currentSong-1]['track'] - if title: - props['title'] = self.songs[self.currentSong-1]['title'] - if artist: - props['artist'] = self.songs[self.currentSong-1]['artist'] - if ext: - props['ext'] = self.songs[self.currentSong-1]['extension'] - if filesize: - props['filesize'] = self.songs[self.currentSong-1]['filesize'] - if duration: - props['duration'] = self.songs[self.currentSong-1]['duration'] - if path: - props['path'] = self.songs[self.currentSong-1]['path'] - - return props - else: - if track: - props['track'] = self.songs[index-1]['track'] - if title: - props['title'] = self.songs[index-1]['title'] - if artist: - props['artist'] = self.songs[index-1]['artist'] - if ext: - props['ext'] = self.songs[index-1]['extension'] - if filesize: - props['filesize'] = self.songs[index-1]['filesize'] - if duration: - props['duration'] = self.songs[index-1]['duration'] - if path: - props['path'] = self.songs[index-1]['path'] - - return props -