Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trying to control MPV Player through a python script

Featured Replies

Hey guys, I am pretty new to this. I am working on turning my Le Potato into a TV shuffler. I have decided to go with Armbian, since I can't SSH (which is required for the CoreElec method), because I use college internet, and it just isn't configured properly. I am currently trying to get a script going that will open a folder and begin randomly playing videos from within, but I cannot figure out where to start really. I think I need to import mpv into the script somehow, but I honestly cannot find any resources on how to do this. 

 

Any help is appreciated, thanks in advance.

I guess you could do something as simple as a bash[0] script, really.  But something like Kodi would give you a lot more control, I think (among many other niceties).

 

I would also try and figure out how to communicate with the device over the network, if at all possible.  Barring that, I guess you could use an IR remote (especially in Kodi).

 

[0] or Python, or whatever language you like

#!/bin/bash

TOP=/home/share/video/music

if [ -n "$1" ];
then
    TOP=$1
fi

OLDIFS=$IFS
IFS=$'\n'

find $TOP -name "*.[maowf][povgklm][gvim]" -print | shuf -n 100 > randomplaylist
mpv -fs -vf=pp=de --playlist=randomplaylist
rm randomplaylist

IFS=$OLDIFS

This will play 100 randomly selected files from /home/share/video/music and subdirectories or whatever directory you pass on the command line.

I wrote the script years ago but as far as I recall I made the regexp myself. I probably just made a list of all the video file extensions I had and then listed the letters in each position.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.