Changeset 15 for mpd-status


Ignore:
Timestamp:
Nov 9, 2005, 2:14:29 PM (18 years ago)
Author:
simon
Message:

Variableise format and delimiter used to help parsing of mpc output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mpd-status/trunk/mpd-status.py

    r14 r15  
    2424    'status', 'pnum', 'time', 'percent'
    2525    ]
    26 cmd = [ 'mpc','--format',
    27     '"[%artist% - ]::[%album% - ]::[%track% - ]::[%title%]::[%time%]::[%file%]"']
     26delim = '::'
     27format = delim.join([
     28    "[%artist% - ]", "[%album% - ]", "[%track% - ]",
     29    "[%title%]", "[%time%]", "[%file%]"
     30    ])
     31cmd = ['mpc', '--format', format]
    2832
    2933lines = Popen(cmd, stdout=PIPE).communicate()[0].split('\n')
     
    3438        map(
    3539            lambda s: s.strip('\"'),
    36             lines[0].split('::') + lines[1].split()
     40            lines[0].split(delim) + lines[1].split()
    3741            )
    3842        ))
Note: See TracChangeset for help on using the changeset viewer.