@All
Here is a MediaVault script that has been modified with the following changes:
* Made it easier to change players by setting a player variable.
* Added showmode 1 option to ffplay to display audio waves.
* Added ability to show requester to choose player when play is clicked.
* Requester can be disabled by setting a variable in script.
* Changed error messages so they display in a requester.
See the "User Settings" area in the script to set variables to make
it work the way you want it to. Directions in script.
Copy the code below and past it into an editor. Then save it to the
"MediaVault/scripts" folder with the name, "start_player". It will then be
executed when you click "Play" in MediaVault.
;
; File: start_player
;
; Version 1.2
;
; Copyright (c) 2021, Georgios Sokianos
;
; This file is part of MediaVault
;
; Author: Georgios Sokianos (
walkero@gmail.com)
; Date: October 2021
;
; Modified by Kevin Taddeucci (ktadd)
; Date: Oct. 10th, 2021
; Made it easier to change players by setting a player variable.
; Added showmode 1 option to ffplay to display audio waves.
;
; Date: Oct. 11th, 2021
; Added ability to show requester to choose player.
; Changed error messages so they display in a requester.
;
; Summary of File:
;
; This file contains code that is used to start
; user's preferred player. So, instead using a
; default player, MediaVault now executes this
; script, passing the URL of the source. User is
; able to change this script and make it work
; on his system as he wants.
; Set the variables in the "User Settings" area below.
;
; This file is a sample and not used by
; MediaVault.
; You have to copy/rename it to: start_player
; Place this script in the MediaVault/scripts directory.
.KEY url/A
.BRA {
.KET }
;================ User Settings ================
;
; Choose the audio player by setting "player" to one of the following:
; 0 = Emotion
; 1 = AmigaAmp3
; 2 = ffplay
SET player 1
; Choose to show a requester to select player when 'Play' is clicked.
; 0 = Do not show requester.
; 1 = Show requester
SET show_req 1
; (Note: player setting above will be overriden if requester is used.)
;========== Edit below this line at your own risk ==========
If NOT "{url}" EQ ""
if $show_req EQ "1"
SET player `RequestChoice "MediaVault Player Select" "Select program to play stream...*N*NTo disable requester:*NSet 'show_req' in 'Start_Player' script to 0.*N*N(Requester will auto close in 3 seconds!)" "AmigaAmp3" "ffplay" "Emotion" TYPE QUESTION TIMEOUTSECS 3`
;if requester timed out, set to AmigaAmp3
if $player EQ "-1"
Set player 1
Endif
Endif
If $player EQ "0"
If EXISTS APPDIR:emotion
Set emotionPID `Status COM=APPDIR:emotion`
If VAL $emotionPID GT 0
Break $emotionPID
EndIf
Run <>NIL: APPDIR:emotion "{url}"
EndIf
Endif
IF $player EQ "1"
If EXISTS APPDIR:AmigaAmp3
Run <>NIL: APPDIR:AmigaAmp3 "{url}"
EndIf
ENDIF
If $player EQ "2"
If EXISTS APPDIR:ffplay
Set ffplayPID `Status COM=APPDIR:ffplay`
If VAL $ffplayPID GT 0
Break $ffplayPID
EndIf
Run <>NIL: APPDIR:ffplay -showmode 1 "{url}"
EndIf
Endif
If $player GT "2"
RequestChoice "MediaVault Player" "Error in 'start_player' script!*N*NInvalid player selected!" "OK" TYPE ERROR
Endif
Else
RequestChoice "MediaVault Player" "Error in 'start_player' script!*N*NNo URL detected!" "OK" TYPE ERROR
EndIf
Edited by ktadd on 2021/10/12 22:21:33
Edited by ktadd on 2021/10/13 1:06:22