Log in

View Full Version : Make your spare computer work for you as a music jukebox



ckaihatsu
19th March 2012, 09:18
Okay, comrades, I could've gone petty-bourgeois with this, but it's sourced from free software, anyway, so what the heck....


If you have a spare, older (PC) computer lying around somewhere, or can get one, this guide is for you.

Don't you think that by now any old PC should be able to serve you like a regular household appliance does, like a TV, DVD player, or a toaster -- ? How about as a music jukebox that you can add music to and control from your existing computer, or from a handheld tablet, just by browsing it like any other folder on your desktop?

Now it's absolutely possible, for free, as long as you have the hardware. You don't even need it to have a working display (if it's a laptop), because you can just attach a separate screen for the part where you're installing the software and setting it up. Once it's set up it runs "headless" because you access it over your local area network (LAN) (through your router), from your regular computer, using a regular web browser.

The first step is to download the operating system that enables all of this, for free:


File Server Appliance - Simple Network Attached Storage

http://www.turnkeylinux.org/fileserver

http://www.turnkeylinux.org/download?file=turnkey-fileserver-11.3-lucid-x86.iso


Use whatever CD-burning software you have to burn the ISO file directly onto a blank CD. You'll then use this disc to boot the older PC and install 'TurnKey Linux - Fileserver' onto the hard drive of the PC.

[EDIT -- from post #24:]




It's come to my attention that it may be best to have your spare computer *disconnected* from the network/Internet when first installing the whole system to the hard drive. Once installed, after the reboot, *then* reconnect the Ethernet cord and say 'yes' to the prompt to install security updates.


All done? Great. Use the web address listed on the blue TurnKey Linux screen to "get" to your PC from whatever computer you normally use. The syntax will be something like this:

https://192.168.xx.xx:12321


Got there? Your screen should look something like this:

http://s16.postimage.org/4pc8uyz9t/120318_Screenshot_1.png


The first thing to do right away is to make sure that you lock out anyone who is not on your local area network (local to your router). From the 'Webmin Configuration' select 'IP Access Control' and you'll see a screen like this:

http://s16.postimage.org/5g4z0r1n5/120318_Screenshot_2_0.png

Select 'Only allow from listed addresses' and enter a value of 192.168.xx.0, where 'xx' corresponds to whatever address is currently in your browser's address field. (The '0' part indicates that the last value can be any value, thus covering all local devices on your local area network.) Click 'Save'.


The next step is to upgrade the version of Webmin. This is entirely procedural and is not that critical.

http://s16.postimage.org/5hewu63gx/120318_Screenshot_3_0.png

http://s16.postimage.org/xisy7v8r5/120318_Screenshot_3_75.png


Next is to upgrade the software repository that is available to you. This includes thousands of freely developed software titles that you can add as you like to increase the functionality of that PC, including things I'm not covering here. Go to 'System' => 'Software Packages':

http://s16.postimage.org/m7qaji1w1/120318_Screenshot_4_0.png

At the bottom of the screen click 'Upgrade Now'.


Okay, now the complete list of software packages has been loaded in. You can request whatever's available -- you may want to look through the list, by clicking on the 'Search APT ..' button, but for now you're going to install the Music Player Daemon, which is the jukebox. (A 'daemon' is a computer process that runs on its own continuously in the background, and can be controlled with user inputs.)

Get back to 'System' => 'Software Packages' and type 'mpd' into the 'Package from APT' field. Make sure the radio button is selected as well. Then click 'Install'.

http://s16.postimage.org/jex2zh1jl/120318_Screenshot_5.png


Now the thing with this version of (TurnKey) Linux is that it wasn't made for handling audio, but that's okay. It can be upgraded, just as with any other version of Linux, to provide the functionality you want it to. For audio you need to do a few more steps. Again, get back to 'System' => 'Software Packages' and this time type 'alsa-base' into the 'Package from APT' field. Make sure the radio button is selected. Then click 'Install'. (ALSA is the sound manager for Linux.)

http://s16.postimage.org/sb7v3es5t/120318_Screenshot_6.png


Do the same thing for 'alsa-utils' and 'alsa-tools':

http://s16.postimage.org/6dbe9md5d/120318_Screenshot_7.png

http://s16.postimage.org/d56eq7rip/120318_Screenshot_8.png


And that's it! All of the installations are done, and you're almost there. You need to turn on the volume for the computer's audio. You can adjust this anytime by doing the following step. Go to https://192.168.xx.xx:12320 and you'll get a command-line screen. Use 'root' as the fileserver login and whatever password you provided when you installed TurnKey Linux.

At the prompt type 'alsamixer' and press Enter:

http://s16.postimage.org/4bfi944k1/120318_Screenshot_9.png


You'll get a screen that looks something like this:

http://s16.postimage.org/4bfi944k1/120318_Screenshot_10.png

You can navigate side-to-side by using the left and right arrow keys on your keyboard, and 'm' will unmute or mute each channel. Increase or decrease each setting by using the up or down arrow keys. (The three leftmost channels are the relevant ones.) When you're done, press Esc. Remember that you can always repeat these steps to get back here to make further adjustments.


Finally you'll need to configure, or specify, the correct settings so that the Music Player Daemon knows where to find your music collection. (Other options are available as well, but this guide only covers what you need to get you playing your music right away.) Go to 'Tools' => 'Text Editor' and type '/etc/mpd.conf' into the text field. (The 'mpd.conf' file is the text file that contains all of the specific data that MPD needs.) Click the 'Edit' button.

http://s16.postimage.org/5t0yko9ap/120318_Screenshot_11.png


You'll then see a screen that looks like this:

http://s16.postimage.org/5t0yko9ap/120318_Screenshot_12.png


You can either navigate through to edit the text file in the field provided on the web page, or simply select all of the text and copy it over to the text editor or word processor of your choosing. You can save it out, save versions of it, or anything else that you would normally do with a text file. Once done just copy-and-paste it back over to replace the original text in the field.

The important parts to customize are these:


#
music_directory "/media/sdXX/YOUR_MUSIC_LIBRARY_DIRECTORY"


# For network
bind_to_address "192.168.xx.xx"


By now you should be able to go to the 'Network' part of your regular computer's settings (or file manager) to find your Linux PC on your local network. You can access the '/srv/storage/' folder on the same hard disk partition that contains the Linux installation, by default, to then copy over music files, or else add a separate (external) hard drive and configure Linux to recognize it using the 'Hardware' => 'Partitions on Local Disks' selection from your web browser.

Once you know the Linux directory you're going to use, go ahead and type it in. The default would be:


#
music_directory "/srv/storage/"


MPD easily provides a way to stream your playing music to any computer or device that can access web-based streams. To enable this, change the part of the text file (towards the end) so that it looks like this:


# An example of a httpd output (built-in HTTP streaming server):
#
audio_output {
type "httpd"
name "My HTTP Stream"
encoder "vorbis" # optional, vorbis or lame
port "8000"
# quality "5.0" # do not define if bitrate is defined
bitrate "128" # do not define if quality is defined
format "44100:16:1"
}


Make sure to click 'Save' when you're done, and then go to 'Tools' => 'Command Shell' and type 'mpd' in the field and click 'Execute Command:' to get MPD running. You will want to select and install an MPD client application on your regular computer or device so that you can control MPD remotely. Several are available:

http://mpd.wikia.com/wiki/Clients


Once you have the client up-and-running and you've entered the web address for your older PC where MPD is running, you'll want to Refresh or Update the directory of your music files so that MPD reads them all in. That should be the final step here, and you'll see all of your music available to you for playing.

This information can be found at this discussion thread at the TurnKey Linux forum:


Audio player (LAMP box) with web control

http://www.turnkeylinux.org/forum/general/20120211/audio-player-lamp-box-web-control

ckaihatsu
19th March 2012, 18:24
(Sorry for the small screenshots. They shouldn't have been resized when I uploaded them to the image hosting service. I'll tend to it presently.)

ckaihatsu
11th October 2012, 05:26
As an update / recommendation, it may be worth looking into a particular device that happens to make for a perfect (headless) server, once it's set up properly.

One can install 'mpd' as the jukebox software, with the following proviso for the DockStar -- the configuration file should have *no* output devices enabled, as noted at this page:

http://forum.doozan.com/read.php?2,8088,8088





#audio_output {
# type "alsa"
# name "My ALSA Device"
# device "hw:0,0" # optional
# format "44100:16:2" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
#}


Here's about the device:

http://www.revleft.com/vb/showpost.php?p=2511905&postcount=57

PC LOAD LETTER
11th October 2012, 06:33
Related-

Run deluge as a daemon on the media center and set it to download to mpd's media library folder. Then you can run deluge as a client on your main pc, hook up to the server end on the media center, and use it as a normal torrent client. Everything you download legally and with permission of the content owner will download directly to the media center and immediately be available. You'll just be controlling the torrents from your main pc.


Deluge is cross-platform. I've hooked up a linux media center running deluge as a daemon to a windows 7 pc running deluge as a client with zero issues.

ckaihatsu
17th October 2012, 07:42
Also:

Found a slammin' track on YouTube but bummed that you have to go there and play it as a video clip in your browser every time you want to hear it -- ?


Or:

Did everything 'to-the-T' on this thread but now you're staring at an *empty* play queue of music -- ?


Twiddle your thumbs no more and instead build up your music collection from the bounty that YouTube has to offer. Impress cyberphobes and cyberphiles alike with a few choice Linux commands to your headless server that shows your metal tool who's boss -- !


1. You'll need to install a few add-on software packages to expand the capabilities of your TurnKey or DockStar Debian Linux operating system. These are close to tiny in size and should take almost no time to download and install.





apt-get install youtube-dl ffmpeg sox lame pacpl

- or -




sudo apt-get install youtube-dl ffmpeg sox lame pacpl


The YouTube downloader may need to be updated right away:





youtube-dl -U


2. Find one or more videos on YouTube that you'd like to include in your music collection (as mp3 files). Use the right-click contextual menu on a video's link to copy only the web link address to your clipboard.

For an individual video clip / music track, just use this command's format, along with the Paste command, to specify the website address for the clip you want:





youtube-dl -t -c -i --audio-format=mp3 http://www.youtube.com/watch?v=xxxxxxxxxxx


(The -t -c -i part specifies three options that can be used -- they can also be omitted. Use 'youtube-dl -h' to see all of the options available for the command.)

For more than one clip at a time repeat the copy-and-paste step, but paste each link's address into a plain text file, one per line. Once done use the following command, and make sure to specify the full path and filename for that (batch) text file. You may also want to switch into your intended directory before using the command so that all of the video clip files download into that directory -- use 'cd /your/directory/here'.





youtube-dl -t -c -i --audio-format=mp3 --batch-file=/your/directory/here/"text file of YouTube links.txt"


3. Once you have the video clip files on board (mostly .flv and .mp4 file types), use the following command to initiate a two-step process for all of the (downloaded) files in the directory. The command will first strip out the existing audio in each video clip to a .wav (uncompressed audio) file, then will initiate a second step that processes the .wav file into a (10-to-1 compressed) .mp3 audio file for everyday use.





pacpl -t mp3 -r -v *

ckaihatsu
23rd October 2012, 07:27
It's come to my attention that this may be helpful:





echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list

apt-get update

apt-get -t squeeze-backports install youtube-dl

ellipsis
29th October 2012, 00:46
Why would u set up a seperate computer for this and control it from your main computer? Why not just use you main computer?

PC LOAD LETTER
29th October 2012, 00:59
Why would u set up a seperate computer for this and control it from your main computer? Why not just use you main computer?
You can set it up as a generalized media center and hook it up to your TV / stereo. I've done this with spare PCs I had lying around that I'd acquired however. "free" section of craigslist sometimes pops up with shit.



Also, Raspberry Pi + spare USB hard drive works well. ~$100 spent and it can play 1080p video that you download legally and with written permission of the copyright holder. And it's tiny.

ckaihatsu
29th October 2012, 01:27
Why would u set up a seperate computer for this and control it from your main computer? Why not just use you main computer?


It could be for a variety of reasons, depending on the user's particular needs:

- You often move your laptop around, taking it with you and returning it to serve as your main computer, but you want a fixed "appliance" that plays music 24/7, regardless.

- If in a group setting you may want several people to be able to access and co-determine the selection of tracks played.

- You may want to run additional instances of 'mpd', for additional, different audio outputs, to various 'zones' around a location.

- You want a secondary filesystem for a fixed, whole music collection, and for making backups.

- You are trying out different kinds of Linux distros and are constantly changing the OS on your main computer, necessitating frequent restarts. You want a dedicated appliance that will continue playing music and will not be interrupted by restarts on your main computer.

- You use your main computer in a processor-intensive way (as for rendering 3-D graphics images) and you do not want to possibly interfere with the smooth playback of your music.

- You may not even use a regular computer that often, but would like to control a fixed music collection from your handheld device.

ckaihatsu
27th November 2012, 03:30
- Aside from having to use a text editor to set up the particulars, mpd is very *non*-technical -- if you don't already know, you will probably get mpd running automatically if you reboot after installing it. Then go to your graphical client app and hit 'refresh' -- that will make mpd scan through your specified folder to update its index of it, to reflect how it currently is. You can begin by adding just a handful of titles or albums, and then refreshing the mpd database. Add more whenever you like and then refresh it again, etc.

- You can use the free MPDroid app for Android devices to stream your audio from mpd running on your server, to play on your device, and even beyond, to any Bluetooth device, as perhaps to Bluetooth wireless speakers.





# An example of a httpd output (built-in HTTP streaming server):
#
audio_output {
type "httpd"
name "My HTTP Stream"
encoder "vorbis" # optional, vorbis or lame
port "8000"
# quality "5.0" # do not define if bitrate is defined
bitrate "128" # do not define if quality is defined
format "44100:16:1"
}


- Some (USB) sound cards don't provide their own hardware support for volume control with mpd -- if you're using one and you're finding that the volume control on your mpd client isn't accessible, you may want to change the settings (the configuration file at /etc/mpd.conf) to enable the 'software mixer' so that the volume works again.





# Volume control mixer ################################################## ######
#
# These are the global volume control settings. By default, this setting will
# be detected to the available audio output device, with preference going to
# hardware mixing. Hardware and software mixers for individual audio_output
# sections cannot yet be mixed.
#
# An example for controlling an ALSA, OSS or Pulseaudio mixer; If this
# setting is used other sound applications will be affected by the volume
# being controlled by MPD.
#
#mixer_type "hardware"
#
# An example for controlling all mixers through software. This will control
# all controls, even if the mixer is not supported by the device and will not
# affect any other sound producing applications.
#
mixer_type "software"
#
# This example will not allow MPD to touch the mixer at all and will disable
# all volume controls.
#
#mixer_type "disabled"
#
################################################## #############################


If you're bringing over a pre-existing filesystem of mp3s, as on an external hard drive, you may run into 'Permission denied' problems on a Windows FAT32 formatted drive. Changing permissions with the regular chmod command, 'chmod a=rwx -R *', may not take effect. Try adding the /dev/sdb1 line below -- modified for your particular drive filepath -- to your /etc/fstab file, and reboot.





# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx / ext4 errors=remount-ro 0 1
# swap was on /dev/sda3 during installation
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx none swap sw 0 0
/dev/sdb1 /mnt/sdb1 vfat iocharset=utf8,umask=000 0 0

ckaihatsu
10th February 2013, 21:50
You can skip the 'pacpl' process from post #5 and use the youtube-dl command to both download any video(s) *and* extract the audio from them, at the same time:





You can turn this into a podcast downloader for youtube videos

# mkdir ~/YouTube/videos-to-audio

# cd ~/YouTube/videos-to-audio

# youtube-dl -citwk -a "videos-to-audio.txt" --extract-audio --audio-format mp3

This would download the videos and extract the audio into a separate mp3 file. If you do not add the "k" option, the downloaded video will be deleted after the audio extraction. This is a bad idea when using the batch files to update when new videos are available in the channels/playlists, as it would re-download all videos since they are no longer present in the folder.




http://www.webdesignblog.asia/software/download-youtube-videos-channels-and-playlists-with-youtube-dl/

ckaihatsu
18th February 2013, 20:18
You can also use the youtube-dl command with links from SoundCloud to get mp3 tracks directly -- music, and other kinds of audio.

ckaihatsu
20th February 2013, 12:27
http://pkgs.org/download/tablet-encode


This isn't directly related to the jukebox, but if in the course of downloading videos from YouTube you come across some that don't play quite right, it's probably because their resolution is too much to be easily streamed, depending on the hardware you're using. (You'll notice that the video freezes on one frame or plays continuously but only haltingly.)

There's a good utility at the link above that will downsample the resolution of the video and also convert the audio to a format that's more tablet-friendly.

After installing you can use 'tablet-encode -h' to see all available options. This configuration is probably suitable for most users:


tablet-encode --preset=n900 -o /directory/of/source_file.ext /directory/of/destination/folder


If you already have your server set up for the jukebox you can add this utility to *its* capabilities so that all of tablet-encode's functioning -- its processor-intensive video processing work -- is done *over there* on the server, freeing up your main computer for your regular, more-interactive routines.

From a browser you can get a terminal window for the server by going to https://192.168.xx.xx:12320 -- use 'root' as the fileserver login and whatever password you provided when you installed TurnKey Linux. Alternatively you can use a local Terminal application and log into your server remotely using SSH:


ssh [email protected]


http://en.wikipedia.org/wiki/Secure_Shell

ckaihatsu
24th February 2013, 18:41
http://www.freewarelovers.com


If you're not that crazy about using a conventional computer and would rather use your handheld device *exclusively*, the following are some core utility apps that enable you to displace your main PC entirely for regular routine tasks while still making use of the "secondary", spare computer running as a server on your local area network -- the links are for the Android platform but other platforms can be found at the link above.





Simple notepad app for the Android OS that can open, edit and save text files to and from the SD card.

https://github.com/paulmach/Text-Edit-for-Android/downloads





ES File Explorer (also known as EStrongs File Explorer) is a free manager & application manager & task killer & dropbox client & ftp client, which can explore the phone and PC.

It allows android users anywhere in the world to manage their resources, stay connected using 3G, EDGE or WiFi, and share with friends, upload photos, watch videos.

http://www.freewarelovers.com/android/app/es-file-explorer





Ghost Commander is a file manager app for Android that is similar as e.g. Total commander for the desktops. If you would like file managers with two panels, to manage your files, you will like Ghost Commander.

Besides the basic functionality of copy, move, create new folder, rename files, etc, it can access the root folder, which not many file managers do in Android.

http://www.freewarelovers.com/android/app/ghost-commander





ConnectBot is a simple, powerful, open-source Secure Shell (SSH) client for Android device. The app lets you connect to SSH servers that typically run on UNIX.

The app can manage several simultaneous SSH sessions, create secure tunnels, and copy/paste between other apps.

http://www.freewarelovers.com/android/app/connectbot

ckaihatsu
3rd March 2013, 16:05
In a blatantly obvious attempt to bump this thread (grin), I'm adding this post that deals with two sub-topics merely tangential to the jukebox itself:


For the /etc/mpd.conf file:





You can set up replay gain with MPD, a great feature some music apps in Linux does not offer:




replaygain "track"




And before I forget, a must have feature for me and for all real music lovers is gapless of course, you can enable it from this line:




gapless_mp3_playback "yes"




http://crunchbang.org/forums/viewtopic.php?pid=182574


---


If you're fairly new to the Linux command line you may be interested in a quick rundown on 'wildcards', which are shortcuts to specifying certain files as a grouping, based on commonalities in their names.

The 'pacpl' command from post #5 serves as a good example for wildcards:





pacpl -t mp3 -r -v *


This command only requires the *input* file or files -- the audio-clip video files you downloaded from YouTube -- to be specified, since it just uses the same filenames for the output files, but with an '.mp3' extension on the end once the conversion to the mp3 format is completed.

This is why it's easy to just first navigate to the *folder* containing all of the video files, and then to issue the command. Note that there's an asterisk ('*') at the end of the command -- this is actually a wildcard character that means 'all of the files in the current directory, no matter what their names are'.

So when you issue the command it takes all of the files in your current directory, 'rips' the audio portion from those video files, and then converts the audio to the mp3 format, no matter what the filenames are.

For another example let's look at the 'tablet-encode' command from post #13:





tablet-encode --preset=n900 -o /directory/of/source_file.ext /directory/of/destination/folder


*This* command requires both the source file name(s) *and* the name of the folder to be used as the destination for the resulting, converted files -- the command simply appends an '.avi' extension onto the original filename and extension, for the resulting files.

So since you may want to convert more than one file at a time using this command, this is where wildcards come in and may be handy. If you first navigate to the folder containing your video files, as you would for the 'pacpl' command, then you could use the asterisk wildcard character with the 'tablet-encode' command in the same way:





tablet-encode --preset=n900 -o * /directory/of/destination/folder


This is in effect saying 'Convert the media format of all of the files in the current directory I'm at, no matter what their filenames or filename extensions may happen to be.'

There's *another* shortcut available, using wildcards, for this command, if we follow the 'pacpl' model and decide to use the *same*, current folder, as the *destination* folder, too -- recall that the command simply appends an '.avi' extension, so the new, resulting files *will* be different than the files they're sourced from -- no confusion.

The wildcard that means 'the current directory', or 'refresh the listing of the current directory', is the period character ('.') -- the wildcard for 'the parent directory' is *two* periods ('..').

So, for example, to 'go up a level' to the folder that encloses the one you're currently in, you can use the 'change directory' command with two periods, instead of specifying that parent directory literally, by its filepath and name:





cd ..


(You can use the 'pwd' command -- 'print working directory' -- at any time to see exactly where you are in the filesystem hierarchy.)

Back to the 'tablet-encode' command, let's use the single-period, 'current directory' wildcard to shorten the command, in order to lessen the specificity required for it:





tablet-encode --preset=n900 -o * .


This command now looks more like the simple-syntax 'pacpl' command, since both commands can take advantage of your navigating to the folder to be used for both source *and* resulting files. Of course you can customize this command as you like, with *different* folders for source and destination files, and still use some wildcards to keep things simple -- here's a guide:


How to Use Wildcards

http://www.linfo.org/wildcard.html

ckaihatsu
7th March 2013, 17:40
A few things that may be helpful here, if you don't know them already:

- The 'up' arrow key on your keyboard acts like the 'Back' button on a web browser, pulling up the previous commands you've used, one-by-one, going back.

- Files of yours that contain spaces may not work well through the command line, due to issues of syntax -- when in doubt put your filename within pairs of quotation marks like this: "130307 filename with spaces". Wildcards will still work, *outside* of the quotation marks.

- Use the 'top' command to see moment-by-moment feedback on your processor's activity, including a listing of all processes ('applications' or 'programs') currently running. Use the 'q' key to quit.

- You can get a listing of the files in the directory you're in with the 'ls -l' command. Also try 'ls -1' -- there are many more customizable options to be seen by invoking 'ls --help'.

- The /etc/mpd.conf configuration text file may be edited using a webpage-based utility, the Webmin feature of your TurnKey Linux server, at https://192.168.xx.xx:12321 -- use 'root' and the password you provided at installation time, then go to the menu that says Tools, and select 'Text Editor' from the menu options. The '...' button will bring up a window with the root directory (topmost in the file hierarchy), from which you can click (two times) to get into each successive folder, to then select your file. The resulting filepath will be displayed, along with an 'OK' button for you to click. Then click the 'Edit' button to bring up the text file in an email-like text field. You can select all of the text and copy it out to paste into the text editor or word processor of your choice, for editing and saving. Once done, reverse the process, selecting all of the text in your text editor or word processor, copying it, and pasting it over the all-selected text in the Text Editor text field, to replace it. Click the 'Save' button to save it, updating the text file on the server. Alternatively you could use the command line with 'nano filename.ext' or 'nano /path/folder/filename.ext' to bring up a text-based text editor.

- After updating the /etc/mpd.conf file you may either restart the mpd daemon ('process' or 'application' or 'program') at the command line, or just by restarting the system using Webmin -- go to the System menu, then the 'Bootup and Shutdown' menu option. At the bottom of the page is a 'Reboot System' button, after which you'll be asked to confirm with another button click. If you have your MPD client up and running you'll be able to see right away when the server comes back up after rebooting with MPD ready to play because the MPD client will be automatically checking for the daemon over the network several times per minute. Alternatively you could bring up the command line by going to https://192.168.xx.xx:12320, to issue the commands 'mpd --kill' and then 'mpd -v' to restart the daemon with the new configuration file, without having to reboot the machine.

ckaihatsu
16th April 2013, 04:32
Here's a command to turn off the screen on the server, which is not used anyway:





vbetool dpms off

vbetool dpms on


The vbetool command could be put in a startup script like rc.local to boot with the display off.

http://www.installationexperiences.com/2009/01/turn-off-lcd-display-backlight-with.html

ckaihatsu
28th July 2013, 23:33
Many computers these days have multiple processors ('cores') available, for computing-intensive tasks. Unfortunately the tablet-encode command (from post #13) doesn't take advantage of any additional cores you may have.

There's an alternative to tablet-encode that *does* use all of the processors that are available, plus it has a user-friendly graphical user interface (GUI), and is cross-platform -- Handbrake.


http://handbrake.fr/downloads.php


On Linux this command should install it...





sudo apt-get install handbrake handbrake-cli handbrake-gtk


...but if you run into any problems about lacking the appropriate software repository, try this link:


http://pkgs.org/search/?keyword=handbrake

ckaihatsu
5th August 2013, 23:08
This is a follow-up to post #5:





Once you have the video clip files on board (mostly .flv and .mp4 file types), use the following command to initiate a two-step process for all of the (downloaded) files in the directory. The command will first strip out the existing audio in each video clip to a .wav (uncompressed audio) file, then will initiate a second step that processes the .wav file into a (10-to-1 compressed) .mp3 audio file for everyday use.




pacpl -t mp3 -r -v *


If you want to put your PC's full multi-core computing power to use for extracting audio files, in mp3 format, from your videos, try the utility SoundKonverter. It has a graphical user interface (GUI), so you won't have to use the command line. It also gives you detailed options for the destination file(s).


http://pkgs.org/search/?keyword=soundkonverter

ckaihatsu
11th August 2013, 22:17
This is a follow-up to post #18 -- I remembered that the 'youtube-dl' command gives options for the video quality / file size of the video file being downloaded, for any given YouTube video -- why bother with a post-download transcoding step when you can just get the most appropriate video file for your device to begin with -- ? Here's from the help listing for the 'youtube-dl' command:





youtube-dl --help




Video Format Options:

-F, --list-formats list all available formats (currently youtube only)

-f, --format FORMAT video format code, specifiy the order of preference using slashes: "-f 22/17/18"


Using the 'list formats' option...





youtube-dl -tci -F -a /directory/of/source_file.ext


...gives output that looks like this:





[youtube] Setting language
[youtube] xxxxxxxxxxx: Downloading video webpage
[youtube] xxxxxxxxxxx: Downloading video info webpage
[youtube] xxxxxxxxxxx: Extracting video information

Available formats:
22 : mp4 [720x1280]
45 : webm [720x1280]
35 : flv [480x854]
44 : webm [480x854]
34 : flv [360x640]
18 : mp4 [360x640]
43 : webm [360x640]
5 : flv [240x400]
17 : mp4 [144x176]


I found that video format code '18' works with my device, so the command would be:





youtube-dl -tci -f 18 -a /directory/of/source_file.ext


Also note that the filename of your batch file may contain spaces, so here's a reminder regarding that:





- Files of yours that contain spaces may not work well through the command line, due to issues of syntax -- when in doubt put your filename within pairs of quotation marks like this: "130307 filename with spaces". Wildcards will still work, *outside* of the quotation marks.

ckaihatsu
21st August 2013, 22:49
In light of the video formats option, and as a follow-up to post #11, here is a good command to use for getting the audio from a YouTube video, in the mp3 file format:





youtube-dl -tci -f 18 --extract-audio --audio-format mp3 -a /directory/of/source_file.ext


Note that the download size will be lesser just by using the '-f 18' option -- using a still-smaller option, like '-f 17', will also reduce the sound quality, too, unfortunately.

The audio extraction step is only single-processor, though. I haven't found a multi-core variation that can be issued from the command line -- if you're using a regular desktop Linux OS there's always SoundKonverter (post #19), for speedier video-to-audio conversions.

ckaihatsu
16th February 2014, 17:05
This is a follow-up to post #20 -- to review:


Using the 'list formats' option...





youtube-dl -tci -F -a /directory/of/source_file.ext


...gives output that looks like this:





[YOUTUBE] Setting language
[YOUTUBE] xxxxxxxxxxx: Downloading video webpage
[YOUTUBE] xxxxxxxxxxx: Downloading video info webpage
[YOUTUBE] xxxxxxxxxxx: Extracting video information

Available formats:
22 : mp4 [720x1280]
45 : webm [720x1280]
35 : flv [480x854]
44 : webm [480x854]
34 : flv [360x640]
18 : mp4 [360x640]
43 : webm [360x640]
5 : flv [240x400]
17 : mp4 [144x176]


It turns out that *some* YouTube videos have the option of downloading the *audio only*, so that one doesn't have to download the content with the video portion included. This saves on download time and the resulting audio file, in m4a format, is closer to the desired mp3 audio format than having to deal with a video-format mp4 file.

So, using the same command as above, one might get output from YouTube that looks like this:





171 webm audio only DASH webm audio , [email protected] 48k (worst)
140 m4a audio only DASH audio , [email protected]
160 mp4 192p DASH video
133 mp4 240p DASH video
134 mp4 360p DASH video
135 mp4 480p DASH video
136 mp4 720p DASH video
137 mp4 1080p DASH video
17 3gp 176x144
36 3gp 320x240
5 flv 400x240
43 webm 640x360
18 mp4 640x360
22 mp4 1280x720 (best)


Using the command from post #21, one could specify the 'm4a audio only' option -- format #140:





youtube-dl -tci -f 140 -a /directory/of/source_file.ext


If the received m4a file(s) can be played on whatever device you're using, great -- otherwise you may want to convert them to mp3 files, which is the universal format for audio. One simple app for Linux does this easily, and is multi-processor as well:


http://pkgs.org/search/?query=soundconverter

ckaihatsu
1st July 2014, 22:43
Of course it might be objected that Sound Converter is a regular graphical-interface application, while the TurnKey Linux server has no graphical interface.

So, then, for TurnKey Linux Fileserver v.12 (Debian Squeeze) one needs to first add the multimedia repository to the system's sources file. From a browser you can get a terminal window for the server by going to https://192.168.xx.xx:12320 -- use 'root' as the fileserver login and whatever password you provided when you installed TurnKey Linux, or use a local Terminal application and log into your server remotely using SSH:





ssh [email protected]


Then execute the following two commands to add the appropriate lines to your /etc/apt/sources.list.d/sources.list file -- alternately you can use the Tools > Text Editor feature of Webmin to edit the file manually, at http:192.168.xx.xx:12321





sh -c "echo 'deb http://www.deb-multimedia.org/ squeeze main non-free' >> /etc/apt/sources.list.d/sources.list"




sh -c "echo 'deb-src http://www.deb-multimedia.org/ squeeze main non-free' >> /etc/apt/sources.list.d/sources.list"


Then issue the following commands to update the system's sources and install the necessary utilities, either from the command line in front of you, or from the Command Shell (through the Tools menu of the Webmin interface):





apt-get update




apt-get install ffmpeg lame


Here's a simple implementation of the ffmpeg utility that will convert all the music files to the .mp3 format -- make sure to change to the directory that contains all of the .m4a files you want to convert ('cd /directory/of/folder').





for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ab 128k "${f%.m4a}.mp3"; done




http://www.commandlinefu.com/commands/view/7643/m4a-to-mp3-conversion-with-ffmpeg-and-lame

ckaihatsu
28th August 2014, 21:11
It's come to my attention that it may be best to have your spare computer *disconnected* from the network/Internet when first installing the whole system to the hard drive. Once installed, after the reboot, *then* reconnect the Ethernet cord and say 'yes' to the prompt to install security updates.

ckaihatsu
28th January 2015, 21:02
The hands-down best client application for the Music Player Daemon jukebox is GMPC, the Gnome Music Player Client, and it's also free.

It happens to be cross-platform, and is identical for Linux, Windows, or Mac.

http://gmpclient.org/

ckaihatsu
11th October 2015, 03:26
If this isn't already immediately obvious, apparent, or done -- you may want to set up the mpd jukebox server (with potentially several hundred gigabytes of music storage and access), and then use an mpd client on Android or otherwise to 'stream' the music over wifi (using port 8000 -- see the initial post), and then use Bluetooth on the device to pass the music stream along to whatever headphones or speakers you have paired and connected to the device, over Bluetooth.

Easy -- !

ckaihatsu
3rd November 2015, 06:20
https://github.com/abarisain/dmix/releases


The MPDroid app has a 20-40 second *delay* of streaming after being initiated, but there's a good workaround -- the user can continue to use the MPD client for controlling the jukebox, but streaming can be done with any app, like GoodPlayer, MX Player, or VLC, that supports network streaming. (Make sure to include the 'http' part and port '8000' with the full address, like 'http://192.168.xx.xx:8000', without the quotes.)


http://mpd.wikia.com/wiki/Clients

ckaihatsu
2nd March 2016, 18:54
For the command-line- and scripts-oriented user, one can send commands to mpd through 'mpc':

http://www.musicpd.org/news/2015/06/mpc-0-27-released/


(On Windows one can install PuTTY, www.putty.org/, to issue command-line commands, while Android users have ConnectBot, connectbot.org, for the same.)

A web search for 'mpc scripts' will bring up dozens of pre-written scripts for various macro-type automated routines for mpd.


---


Separately, one might say that the whole mpd implementation may no longer be necessary, if one is satisfied with the UPnP protocol for the local-network (personal router-hub / Wifi network) streaming of media content like music, etc.

Many devices, including routers, have a UPnP server set up already, so that the user only has to find a UPnP client, like eezUPnP (Java), eezupnp.de, for the immediate use of hard-drive-size collections of music and media. Bluetooth, as usual, can provide the 'last-leg' wireless delivery of the stream to one's preferred type of speakers, earbuds, or headphones.