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 =
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',
>
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
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 =
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
5 matches
Mail list logo