~ubuntu-branches/ubuntu/oneiric/emesene/oneiric-proposed

« back to all changes in this revision

Viewing changes to emesene/plugins/music/handler_moc.py

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2011-03-19 13:47:22 UTC
  • mfrom: (1.1.10 upstream) (5.2.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110319134722-5yjs8aa0xbcbze37
Tags: 2.0~git20110319+dfsg-1
* Set myself as maintainer.
* New upstream git revision, tarball generated removing non-free dlls dir.
* Remove debian/watch, debian/emesene.xpm, debian/install files.
* Update debian/README.source file.
* Remove 21_svn2451_fix_avatar and 20_dont_build_own_libmimic patches.
* debian/control: modify python to python (>= 2.5) in Build-Depends field.
* debian/control: remove python-libmimic from Recommends field.
* debian/control: modify python-gtk2 (>= 2.10) to python-gtk2 (>= 2.12) in
  Depends field.
* debian/control: add python-appindicator and python-xmpp to Recommends
  field.
* debian/control: add python-papyon (>= 0.5.4) and python-webkit to Depends
  field.
* debian/control: update Description field.
* debian/control: add python-setuptools to Build-Depends field.
* debian/control: move python-dbus and python-notify to Depends field.
* Update debian/copyright file.
* Update debian/links file.
* debian/menu: update description field.
* Bump Standards-Version to 3.9.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import songretriever
2
 
import commands
3
 
 
4
 
class MocHandler(songretriever.MusicHandler):
5
 
    '''Handler moc (Music On Console) music player'''
6
 
    NAME = 'Music On Console'
7
 
    DESCRIPTION = 'Music handler for moc'
8
 
    AUTHOR = 'Adolfo Fitoria'
9
 
    WEBSITE = 'www.emesene.org'
10
 
 
11
 
    def __init__(self, main_window = None):
12
 
        songretriever.MusicHandler.__init__(self, main_window)
13
 
 
14
 
    def is_running(self):
15
 
        '''returns True if the player is running'''
16
 
        status = commands.getoutput('ps -e | grep mocp')
17
 
        return status != ''
18
 
 
19
 
    def is_playing(self):
20
 
        '''returns True if the player is playing a song'''
21
 
        command = "mocp -Q '%state' 2>/dev/null"
22
 
        if not self.is_running():
23
 
            return False
24
 
 
25
 
        status = commands.getoutput(command) 
26
 
 
27
 
        return status == 'PLAY' 
28
 
 
29
 
    def get_current_song(self):
30
 
        '''returns the current song or None if no song is playing'''
31
 
        command = "mocp -Q '%artist;%album;%song;%file' 2>/dev/null"
32
 
        output = commands.getoutput(command).split(';')
33
 
        if not self.is_running() or not self.is_playing():
34
 
            return None
35
 
 
36
 
        return songretriever.Song(output[0], output[1], 
37
 
                                  output[2], output[3])