|
[blogs.title] from jezra.net |
MuttonChop
MuttonChop is a media player designed to be controlled through a web interface or by a JSON API (the web interface uses the JSON API). Technically, MuttonChop is two separate applications; a daemon like player/server and a default HTML/JavaScript/CSS interface.
Compiling
MuttonChop is written in Vala and the source contains a very simple build script named "build". Yea, fancy that.
Dependencies
- gtk3
- glib
- json-glib
- gio
- sqlite3
- gstreamer-0.10
- gee
- libxml-2.0
Configuration
MuttonChop will look for a configuration file named "muttonchop.conf" in one of two places:
- The current directory of the user launching MuttonChop
- In a directory named ".muttonchop" in the current user's home directory
The configuration file is a simple text file in [key][whitespace][value] format with few options. The options are:
- video_dir - the path to a directory containing video files
- audio_dir - the path to a directory containing audio files
- web_server_public_dir - where the WebUI files are located
- cast_dir - where to download caught casts
- audio_auto_play - boolean [true, false] if audio should auto play on startup
- audio_play_random - boolean [true, false] play randomly selected audio
- audio_continuous_play - boolean [true, false]... um, I don't know what this does or was supposed to do
- start_up_volume - integer value between 0 and 100, if excluded, defaults to 50
- days_to_save_played_casts - integer value representing the number of days until played casts are deleted
An example config file might look like this:
video_dir /storage/video
audio_dir /storage/music
web_server_public_dir /storage/projects/muttonchop/public
cast_dir /storage/casts
audio_auto_play false
audio_play_random true
audio_continuous_play true
start_up_volume 70
days_to_save_played_casts 7
Basic Usage
Run MuttonChop on a computer. Direct a web browser to port 2876 on the machine running MuttonChop.
NOTE: on first run, MuttonChop will create a directory named ".muttonchop" in the current user's home directory, and create an sqlite3 database in the new directory. MuttonChop will then try to read the tags of audio files in the audio directory.
the API
The API is still in an experimental phase and it will most certainly change in the future.
Video
Get video directory contents
HOST:2876/video/content
return value: a JSON representation of directory info with some additional information
similarly, to get the content of a directory within the video directory:
HOST:2876/video/content/URLENCODED_PATH_OF_DIRECTORY
Play a video
HOST:2876/video/content/URLENCODED_PATH_TO_FILE
Audio
List Artists
HOST:2876/audio/artist returns a JSON array of strings
List an Artist's tunes
HOST:2876/audio/artist_tracks/URLENCODED_ARTIST_NAME
returns an array of track information from the database
Play Audio
HOST:2876/audio/play
to play a specific track
HOST:2876/audio/play/TRACK_ID
Set random to true or false
HOST:2876/audio/random/true
or
HOST:2876/audio/random/false
Update the database
HOST:2876/audio/update
Control the playing audio or video
Get the status of the player
HOST:2876/player/status
returns basic information about the player (this will definitely be changing)
jump the playback to a percentile location in the time of the file
HOST:2876/player/percent/PERCENT_AMOUNT
set the playback volume
HOST:2876/player/volume/NUMBER_BETWEEN_0_AND_100
basic playback commands
HOST:2876/player/play
HOST:2876/player/pause
HOST:2876/player/stop
HOST:2876/player/next
HOST:2876/player/previous
HOST:2876/player/forward : just forward 1%
HOST:2876/player/reverse : jump back 1%
Catcher
add a new feed
HOST:2876/catcher/add/URLENCODED_FEED_URL
get a list of feeds
HOST:2876/catcher/feeds
update all feeds
HOST:2876/catcher/update/all : this will return a list of all new episodes of all feeds
update a single feed
HOST:2876/catcher/update/FEED_ID
get a list of a feeds episodes
HOST:2876/catcher/episodes/FEED_ID
get info about a specific episode
HOST:2876/catcher/episode/EPISODE_ID
play a specific episode
HOST:2876/catcher/play/EPISODE_ID
download episodes
HOST:2876/catcher/download/EPISODE_ID1:EPISODE_ID2:EPISODE_ID3
get information about active download
HOST:2876/catcher/download_status