Re: [Dorset] Ending Playback in mpg321 from Within Python

2017-01-10 Thread Ralph Corderoy
Hi Terry, > > subdir = './Playlist1' > > mp3_files = sorted(os.path.join(subdir, x) for x in > > filter(lambda f: f.lower().endswith(".mp3"), os.listdir(subdir))) > > Thanks Will, that worked. If it makes it easier to understand and adapt, the non-functional unwinding of it is subdir =

Re: [Dorset] Ending Playback in mpg321 from Within Python

2017-01-10 Thread Terry Coles
On Tuesday, 10 January 2017 12:31:52 GMT William R Sowerbutts wrote: > You need to add the directory prefix to the result of os.listdir(). > > So if you do os.listdir('foo') it will return ['bar', 'jam']. When you pass > these to mpg321 you want the directory name prefixed ie ['foo/bar', >

Re: [Dorset] Ending Playback in mpg321 from Within Python

2017-01-10 Thread Ralph Corderoy
Hi Terry, > mp3_files = sorted(filter(lambda f: f.lower().endswith(".mp3"), > os.listdir('./ Playlist1'))) Just about to be AFK, but this might help. $ find . ./foo ./foo/bar $ python -c 'import os; print(os.listdir("foo"))' ['bar'] $ You get given bar but it's

Re: [Dorset] Ending Playback in mpg321 from Within Python

2017-01-10 Thread William R Sowerbutts
Terry You need to add the directory prefix to the result of os.listdir(). So if you do os.listdir('foo') it will return ['bar', 'jam']. When you pass these to mpg321 you want the directory name prefixed ie ['foo/bar', 'foo/jam']. So try this: subdir = './Playlist1' mp3_files =

Re: [Dorset] Ending Playback in mpg321 from Within Python

2017-01-10 Thread Terry Coles
On Sunday, 6 November 2016 14:37:53 GMT William R Sowerbutts wrote: > Whipped this quick demo up; it will play at most five seconds of each MP3 > file in the current directory. Tested with both mpg321 and mpg123. Will, The code you gave me a month or two back works beautifully, except I