maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   qtcmdplayer - cmdline music player for SFOS (https://talk.maemo.org/showthread.php?t=100558)

wolke 2018-11-17 21:23

qtcmdplayer - cmdline music player for SFOS
 
pyqt wrapper around QMediaPlayer (and also QAudioDecoder for MP3, since QMediaPlayer doesnt support seeking MP3s)

-CLI with keyboard support, vaguely like mplayer
-single python script for easy installation
-only dependency is pyqt, AFAIK
-supports reading commands from a FIFO, also vaguely like mplayer
-works on debian, sailfish, and probably any other unix-like platform with pyqt

Code:

nemo@sailfishx:~$ qtcmdplayer Caravan\ Palace/Clas
h\ EP/01\ Clash.ogg
00:02.820 / 03:26.093 - 01 Clash.ogg

Code:

usage: qtcmdplayer [-h] [--daemon] [--loop]
                  [--volume VOLUME]
                  [--mp3] [--nomp3]
                  FILE [POSITION_MILLIS]
                  [COMMAND_FIFO]

Play music/sound files from the command line using PyQt5 media tools.

positional arguments:
  FILE                  sound file to play
  POSITION_MILLIS      optional starting position in
                        millis
  COMMAND_FIFO          optional path to existing
                        FIFO for listening to
                        commands

optional arguments:
  -h, --help            show this message and exit
  --daemon, -daemon    disable keyboard commands
                        and print machine-readable
                        property changes instead of
                        status line
  --loop, -loop        when playback is finished,
                        play again immediately
                        forever
  --volume VOLUME, -volume VOLUME
                        set volume 0 - 100
                        (values greater than 100
                        are allowed only for MP3s,
                        or with --mp3)
  --mp3                force MP3 mode
                        regardless of file extension
                        (use
                        QAudioDecoder+QAudioOutput
                        instead of QMediaPlayer)
  --nomp3              force non-MP3 mode
                        regardless of file extension
                        (use QMediaPlayer instead of
                        QAudioDecoder+QAudioOutput)

qtcmdplayer:
https://github.com/teleshoes/klomp/b...rc/qtcmdplayer

pyqt:
https://openrepos.net/content/sailfishlib/pyqt

wolke 2018-11-17 21:28

Re: qtcmdplayer - cmdline music player for SFOS
 
p.s.: its also NUTS. dont assume that it will do any particular non-crazy thing, be cause it probably wont.
i wrote it just to replace mplayer as the backend to my equally-bizarre music player, klomp, and im sharing it only because i dont know if there are any CLI music players at all running on SFOS

wolke 2019-12-02 08:21

Re: qtcmdplayer - cmdline music player for SFOS
 
NOTE: QMediaPlayer apparently supports seeking in MP3s now, both in debian and sailfish, so i updated qtcmdplayer to use QMediaPlayer instead of QAudioDecoder for all files, including MP3s (--player-alt can be used to use the old player for old versions of pyqt5-multimedia)

(QMediaPlayer is much more efficient, and unlike QAudioDecoder, doesnt have to decode everything up to a certain point to seek to that point)


All times are GMT. The time now is 22:51.

vBulletin® Version 3.8.8